summaryrefslogtreecommitdiffstats
path: root/src/base/abci/abcGen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/base/abci/abcGen.c')
-rw-r--r--src/base/abci/abcGen.c106
1 files changed, 106 insertions, 0 deletions
diff --git a/src/base/abci/abcGen.c b/src/base/abci/abcGen.c
index 626e5e1e..5d74bda5 100644
--- a/src/base/abci/abcGen.c
+++ b/src/base/abci/abcGen.c
@@ -254,6 +254,112 @@ void Abc_WriteFullAdder( FILE * pFile )
fprintf( pFile, "\n" );
}
+
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void Abc_WriteCell( FILE * pFile )
+{
+ fprintf( pFile, ".model cell\n" );
+ fprintf( pFile, ".inputs px1 px2 py1 py2 x y\n" );
+ fprintf( pFile, ".outputs fx fy\n" );
+ fprintf( pFile, ".names x y a\n" );
+ fprintf( pFile, "11 1\n" );
+ fprintf( pFile, ".names px1 a x nx\n" );
+ fprintf( pFile, "11- 1\n" );
+ fprintf( pFile, "0-1 1\n" );
+ fprintf( pFile, ".names py1 a y ny\n" );
+ fprintf( pFile, "11- 1\n" );
+ fprintf( pFile, "0-1 1\n" );
+ fprintf( pFile, ".names px2 nx fx\n" );
+ fprintf( pFile, "10 1\n" );
+ fprintf( pFile, "01 1\n" );
+ fprintf( pFile, ".names py2 ny fy\n" );
+ fprintf( pFile, "10 1\n" );
+ fprintf( pFile, "01 1\n" );
+ fprintf( pFile, ".end\n" );
+ fprintf( pFile, "\n" );
+}
+
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void Abc_GenMesh( char * pFileName, int nVars )
+{
+ FILE * pFile;
+ int i, k;
+
+ assert( nVars > 0 );
+
+ pFile = fopen( pFileName, "w" );
+ fprintf( pFile, "# %dx%d mesh generated by ABC on %s\n", nVars, nVars, Extra_TimeStamp() );
+ fprintf( pFile, ".model mesh%d\n", nVars );
+
+ for ( i = 0; i < nVars; i++ )
+ for ( k = 0; k < nVars; k++ )
+ {
+ fprintf( pFile, ".inputs" );
+ fprintf( pFile, " p%d%dx1", i, k );
+ fprintf( pFile, " p%d%dx2", i, k );
+ fprintf( pFile, " p%d%dy1", i, k );
+ fprintf( pFile, " p%d%dy2", i, k );
+ fprintf( pFile, "\n" );
+ }
+ fprintf( pFile, ".inputs" );
+ for ( i = 0; i < nVars; i++ )
+ fprintf( pFile, " v%02d v%02d", 2*i, 2*i+1 );
+ fprintf( pFile, "\n" );
+
+ fprintf( pFile, ".outputs" );
+ fprintf( pFile, " fx00" );
+ fprintf( pFile, "\n" );
+
+ for ( i = 0; i < nVars; i++ ) // horizontal
+ for ( k = 0; k < nVars; k++ ) // vertical
+ {
+ fprintf( pFile, ".subckt cell" );
+ fprintf( pFile, " px1=p%d%dx1", i, k );
+ fprintf( pFile, " px2=p%d%dx2", i, k );
+ fprintf( pFile, " py1=p%d%dy1", i, k );
+ fprintf( pFile, " py2=p%d%dy2", i, k );
+ if ( k == nVars - 1 )
+ fprintf( pFile, " x=v%02d", i );
+ else
+ fprintf( pFile, " x=fx%d%d", i, k+1 );
+ if ( i == nVars - 1 )
+ fprintf( pFile, " y=v%02d", nVars+k );
+ else
+ fprintf( pFile, " y=fy%d%d", i+1, k );
+ // outputs
+ fprintf( pFile, " fx=fx%d%d", i, k );
+ fprintf( pFile, " fy=fy%d%d", i, k );
+ fprintf( pFile, "\n" );
+ }
+ fprintf( pFile, ".end\n" );
+ fprintf( pFile, "\n" );
+ fprintf( pFile, "\n" );
+
+ Abc_WriteCell( pFile );
+ fclose( pFile );
+}
+
+
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////