summaryrefslogtreecommitdiffstats
path: root/src/base/acb/acbFunc.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2020-09-13 19:17:16 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2020-09-13 19:17:16 -0700
commit07bf95f48019dd5472ffffbd32587879e1bcbb9f (patch)
tree4d3b7257499d4b3c017f1f15dfda9ddbfad87ce2 /src/base/acb/acbFunc.c
parenta2c3c21031d0e83f15c8182924a908f54bbb5ab7 (diff)
downloadabc-07bf95f48019dd5472ffffbd32587879e1bcbb9f.tar.gz
abc-07bf95f48019dd5472ffffbd32587879e1bcbb9f.tar.bz2
abc-07bf95f48019dd5472ffffbd32587879e1bcbb9f.zip
Experiments with iterative synthesis.
Diffstat (limited to 'src/base/acb/acbFunc.c')
-rw-r--r--src/base/acb/acbFunc.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/src/base/acb/acbFunc.c b/src/base/acb/acbFunc.c
index eced70e7..6d5bdaad 100644
--- a/src/base/acb/acbFunc.c
+++ b/src/base/acb/acbFunc.c
@@ -145,15 +145,28 @@ char * pLibStr[25] = {
"GATE zero 0 O=CONST0;\n"
"GATE one 0 O=CONST1;\n"
};
-void Acb_IntallLibrary()
+char * pLibStr2[25] = {
+ "GATE buf 1 O=a; PIN * INV 1 999 1.0 0.0 1.0 0.0\n"
+ "GATE inv 1 O=!a; PIN * INV 1 999 1.0 0.0 1.0 0.0\n"
+ "GATE and2 1 O=a*b; PIN * INV 1 999 1.0 0.0 1.0 0.0\n"
+ "GATE or2 1 O=a+b; PIN * INV 1 999 1.0 0.0 1.0 0.0\n"
+ "GATE nand2 1 O=!(a*b); PIN * INV 1 999 1.0 0.0 1.0 0.0\n"
+ "GATE nor2 1 O=!(a+b); PIN * INV 1 999 1.0 0.0 1.0 0.0\n"
+ "GATE xor 1 O=!a*b+a*!b; PIN * INV 1 999 1.0 0.0 1.0 0.0\n"
+ "GATE xnor 1 O=a*b+!a*!b; PIN * INV 1 999 1.0 0.0 1.0 0.0\n"
+ "GATE zero 0 O=CONST0;\n"
+ "GATE one 0 O=CONST1;\n"
+};
+void Acb_IntallLibrary( int f2Ins )
{
extern Mio_Library_t * Mio_LibraryReadBuffer( char * pBuffer, int fExtendedFormat, st__table * tExcludeGate, int fVerbose );
Mio_Library_t * pLib;
int i;
// create library string
Vec_Str_t * vLibStr = Vec_StrAlloc( 1000 );
- for ( i = 0; pLibStr[i]; i++ )
- Vec_StrAppend( vLibStr, pLibStr[i] );
+ char ** ppLibStr = f2Ins ? pLibStr2 : pLibStr;
+ for ( i = 0; ppLibStr[i]; i++ )
+ Vec_StrAppend( vLibStr, ppLibStr[i] );
Vec_StrPush( vLibStr, '\0' );
// create library
pLib = Mio_LibraryReadBuffer( Vec_StrArray(vLibStr), 0, NULL, 0 );
@@ -2600,7 +2613,7 @@ Vec_Ptr_t * Acb_TransformPatchFunctions( Vec_Ptr_t * vSops, Vec_Wec_t * vSupps,
SeeAlso []
***********************************************************************/
-int Acb_NtkEcoPerform( Acb_Ntk_t * pNtkF, Acb_Ntk_t * pNtkG, char * pFileName[4], int fCisOnly, int fCheck, int fVerbose, int fVeryVerbose )
+int Acb_NtkEcoPerform( Acb_Ntk_t * pNtkF, Acb_Ntk_t * pNtkG, char * pFileName[4], int fCisOnly, int fInputs, int fCheck, int fVerbose, int fVeryVerbose )
{
extern Gia_Man_t * Abc_SopSynthesizeOne( char * pSop, int fClp );
@@ -2615,7 +2628,7 @@ int Acb_NtkEcoPerform( Acb_Ntk_t * pNtkF, Acb_Ntk_t * pNtkG, char * pFileName[4]
Vec_Int_t * vSuppF = Acb_NtkFindSupp( pNtkF, vRoots );
Vec_Int_t * vSuppG = Acb_NtkFindSupp( pNtkG, vRoots );
Vec_Int_t * vSupp = Vec_IntTwoMerge( vSuppF, vSuppG );
- Vec_Int_t * vDivs = fCisOnly ? Acb_NtkFindDivsCis( pNtkF, vSupp ) : Acb_NtkFindDivs( pNtkF, vSupp, vBlock, fVerbose );
+ Vec_Int_t * vDivs = (fCisOnly || fInputs) ? Acb_NtkFindDivsCis( pNtkF, vSupp ) : Acb_NtkFindDivs( pNtkF, vSupp, vBlock, fVerbose );
Vec_Int_t * vNodesF = Acb_NtkFindNodes( pNtkF, vRoots, vDivs );
Vec_Int_t * vNodesG = Acb_NtkFindNodes( pNtkG, vRoots, NULL );
@@ -2829,7 +2842,7 @@ void Acb_NtkTestRun2( char * pFileNames[3], int fVerbose )
Acb_Ntk_t * pNtk = Acb_VerilogSimpleRead( pFileNames[0], pFileNames[2] );
Acb_VerilogSimpleWrite( pNtk, pFileNameOut );
Acb_ManFree( pNtk->pDesign );
- Acb_IntallLibrary();
+ Acb_IntallLibrary( 0 );
}
/**Function*************************************************************
@@ -2843,7 +2856,7 @@ void Acb_NtkTestRun2( char * pFileNames[3], int fVerbose )
SeeAlso []
***********************************************************************/
-void Acb_NtkRunEco( char * pFileNames[4], int fCheck, int fRandom, int fVerbose, int fVeryVerbose )
+void Acb_NtkRunEco( char * pFileNames[4], int fCheck, int fRandom, int fInputs, int fVerbose, int fVeryVerbose )
{
char Command[1000]; int Result = 1;
Acb_Ntk_t * pNtkF = Acb_VerilogSimpleRead( pFileNames[0], pFileNames[2] );
@@ -2863,12 +2876,12 @@ void Acb_NtkRunEco( char * pFileNames[4], int fCheck, int fRandom, int fVerbose,
assert( Acb_NtkCiNum(pNtkF) == Acb_NtkCiNum(pNtkG) );
assert( Acb_NtkCoNum(pNtkF) == Acb_NtkCoNum(pNtkG) );
- Acb_IntallLibrary();
+ Acb_IntallLibrary( Abc_FrameReadSignalNames() != NULL );
- if ( !Acb_NtkEcoPerform( pNtkF, pNtkG, pFileNames, 0, fCheck, fVerbose, fVeryVerbose ) )
+ if ( !Acb_NtkEcoPerform( pNtkF, pNtkG, pFileNames, 0, fInputs, fCheck, fVerbose, fVeryVerbose ) )
{
// printf( "General computation timed out. Trying inputs only.\n\n" );
-// if ( !Acb_NtkEcoPerform( pNtkF, pNtkG, pFileNames, 1, fCheck, fVerbose, fVeryVerbose ) )
+// if ( !Acb_NtkEcoPerform( pNtkF, pNtkG, pFileNames, 1, fInputs, fCheck, fVerbose, fVeryVerbose ) )
// printf( "Input-only computation also timed out.\n\n" );
printf( "Computation did not succeed.\n" );
Result = 0;