diff options
Diffstat (limited to 'src/base/abci/abc.c')
-rw-r--r-- | src/base/abci/abc.c | 3268 |
1 files changed, 42 insertions, 3226 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 267d4e0b..5fc9bfad 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -18,44 +18,37 @@ ***********************************************************************/ -#include "abc.h" -#include "main.h" -#include "mainInt.h" -#include "fraig.h" -#include "fxu.h" -#include "cut.h" -#include "fpga.h" -#include "if.h" -#include "sim.h" -#include "res.h" -#include "lpk.h" -#include "giaAig.h" -#include "dar.h" -#include "mfs.h" -#include "mfx.h" -#include "fra.h" -#include "saig.h" -#include "nwkMerge.h" -#include "int.h" -#include "dch.h" -#include "ssw.h" -#include "cgt.h" -#include "kit.h" -#include "amap.h" -#include "retInt.h" -#include "cnf.h" -#include "cec.h" -#include "pdr.h" - -#include "tim.h" -#include "llb.h" -#include "ntlnwk.h" -#include "mfx.h" -#include "bbr.h" -#include "cov.h" - -#include "cmd.h" -#include "extra.h" +#include "src/base/abc/abc.h" +#include "src/base/main/main.h" +#include "src/base/main/mainInt.h" +#include "src/proof/fraig/fraig.h" +#include "src/opt/fxu/fxu.h" +#include "src/opt/cut/cut.h" +#include "src/map/fpga/fpga.h" +#include "src/map/if/if.h" +#include "src/opt/sim/sim.h" +#include "src/opt/res/res.h" +#include "src/opt/lpk/lpk.h" +#include "src/aig/gia/giaAig.h" +#include "src/opt/dar/dar.h" +#include "src/opt/mfs/mfs.h" +#include "src/proof/fra/fra.h" +#include "src/aig/saig/saig.h" +#include "src/proof/int/int.h" +#include "src/proof/dch/dch.h" +#include "src/proof/ssw/ssw.h" +#include "src/opt/cgt/cgt.h" +#include "src/bool/kit/kit.h" +#include "src/map/amap/amap.h" +#include "src/opt/ret/retInt.h" +#include "src/sat/cnf/cnf.h" +#include "src/proof/cec/cec.h" +#include "src/proof/pdr/pdr.h" +#include "src/misc/tim/tim.h" +#include "src/proof/llb/llb.h" +#include "src/proof/bbr/bbr.h" +#include "src/map/cov/cov.h" +#include "src/base/cmd/cmd.h" #ifdef _WIN32 //#include <io.h> @@ -112,7 +105,7 @@ static int Abc_CommandMfs ( Abc_Frame_t * pAbc, int argc, cha static int Abc_CommandTrace ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSpeedup ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPowerdown ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandMerge ( Abc_Frame_t * pAbc, int argc, char ** argv ); +//static int Abc_CommandMerge ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandRewrite ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandRefactor ( Abc_Frame_t * pAbc, int argc, char ** argv ); @@ -287,44 +280,6 @@ static int Abc_CommandCexMin ( Abc_Frame_t * pAbc, int argc, cha static int Abc_CommandTraceStart ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandTraceCheck ( Abc_Frame_t * pAbc, int argc, char ** argv ); - -static int Abc_CommandAbc8Read ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8ReadLogic ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8Write ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8WriteLogic ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8ReadLut ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8PrintLut ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8Check ( Abc_Frame_t * pAbc, int argc, char ** argv ); - -static int Abc_CommandAbc8Ps ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8Pfan ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8If ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8DChoice ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8Dch ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8Dc2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8Bidec ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8Strash ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8Mfs ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8Lutpack ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8Lutmin ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8Balance ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8Speedup ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8Merge ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8Insert ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8ClpLut ( Abc_Frame_t * pAbc, int argc, char ** argv ); - -static int Abc_CommandAbc8Fraig ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8Scl ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8Lcorr ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8Ssw ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8Scorr ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8Sweep ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8Zero ( Abc_Frame_t * pAbc, int argc, char ** argv ); - -static int Abc_CommandAbc8Cec ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8DSec ( Abc_Frame_t * pAbc, int argc, char ** argv ); - - static int Abc_CommandAbc9Get ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Put ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Read ( Abc_Frame_t * pAbc, int argc, char ** argv ); @@ -466,24 +421,6 @@ void Abc_FrameReplaceCexVec( Abc_Frame_t * pAbc, Vec_Ptr_t ** pvCexVec ) ***********************************************************************/ void Abc_FrameClearDesign() { - Abc_Frame_t * pAbc; - - pAbc = Abc_FrameGetGlobalFrame(); - if ( pAbc->pAbc8Ntl ) - { - Ntl_ManFree( pAbc->pAbc8Ntl ); - pAbc->pAbc8Ntl = NULL; - } - if ( pAbc->pAbc8Aig ) - { - Aig_ManStop( pAbc->pAbc8Aig ); - pAbc->pAbc8Aig = NULL; - } - if ( pAbc->pAbc8Nwk ) - { - Nwk_ManFree( pAbc->pAbc8Nwk ); - pAbc->pAbc8Nwk = NULL; - } } /**Function************************************************************* @@ -536,18 +473,6 @@ void Abc_CommandUpdate9( Abc_Frame_t * pAbc, Gia_Man_t * pNew ) ***********************************************************************/ void Abc_Init( Abc_Frame_t * pAbc ) { -/* - char * pBuff = ABC_ALLOC( char, (1<<29) ); - int i, clk = clock(); - for ( i = 0; i < (1<<29); i++ ) - pBuff[i] = i % 53; - if ( pBuff == NULL ) - printf( "Not allocated. " ); - else - printf( "Allocated %d bytes. ", (1<<29) ); - Abc_PrintTime( 1, "Time", clock() - clk ); -*/ - Cmd_CommandAdd( pAbc, "Printing", "print_stats", Abc_CommandPrintStats, 0 ); Cmd_CommandAdd( pAbc, "Printing", "print_exdc", Abc_CommandPrintExdc, 0 ); Cmd_CommandAdd( pAbc, "Printing", "print_io", Abc_CommandPrintIo, 0 ); @@ -591,7 +516,7 @@ void Abc_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "Synthesis", "trace", Abc_CommandTrace, 0 ); Cmd_CommandAdd( pAbc, "Synthesis", "speedup", Abc_CommandSpeedup, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "powerdown", Abc_CommandPowerdown, 1 ); - Cmd_CommandAdd( pAbc, "Synthesis", "merge", Abc_CommandMerge, 1 ); +// Cmd_CommandAdd( pAbc, "Synthesis", "merge", Abc_CommandMerge, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "rewrite", Abc_CommandRewrite, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "refactor", Abc_CommandRefactor, 1 ); @@ -762,42 +687,6 @@ void Abc_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "Verification", "reconcile", Abc_CommandReconcile, 1 ); Cmd_CommandAdd( pAbc, "Verification", "cexmin", Abc_CommandCexMin, 0 ); - - Cmd_CommandAdd( pAbc, "ABC8", "*r", Abc_CommandAbc8Read, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*rlogic", Abc_CommandAbc8ReadLogic, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*w", Abc_CommandAbc8Write, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*wlogic", Abc_CommandAbc8WriteLogic, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*rlut", Abc_CommandAbc8ReadLut, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*plut", Abc_CommandAbc8PrintLut, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*check", Abc_CommandAbc8Check, 0 ); - - Cmd_CommandAdd( pAbc, "ABC8", "*ps", Abc_CommandAbc8Ps, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*pfan", Abc_CommandAbc8Pfan, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*if", Abc_CommandAbc8If, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*dchoice", Abc_CommandAbc8DChoice, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*dch", Abc_CommandAbc8Dch, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*dc2", Abc_CommandAbc8Dc2, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*bidec", Abc_CommandAbc8Bidec, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*st", Abc_CommandAbc8Strash, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*mfs", Abc_CommandAbc8Mfs, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*lp", Abc_CommandAbc8Lutpack, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*b", Abc_CommandAbc8Balance, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*speedup", Abc_CommandAbc8Speedup, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*merge", Abc_CommandAbc8Merge, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*insert", Abc_CommandAbc8Insert, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*clplut", Abc_CommandAbc8ClpLut, 0 ); - - Cmd_CommandAdd( pAbc, "ABC8", "*fraig", Abc_CommandAbc8Fraig, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*scl", Abc_CommandAbc8Scl, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*lcorr", Abc_CommandAbc8Lcorr, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*ssw", Abc_CommandAbc8Ssw, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*scorr", Abc_CommandAbc8Scorr, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*sw", Abc_CommandAbc8Sweep, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*zero", Abc_CommandAbc8Zero, 0 ); - - Cmd_CommandAdd( pAbc, "ABC8", "*cec", Abc_CommandAbc8Cec, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*dsec", Abc_CommandAbc8DSec, 0 ); - Cmd_CommandAdd( pAbc, "ABC9", "&get", Abc_CommandAbc9Get, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&put", Abc_CommandAbc9Put, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&r", Abc_CommandAbc9Read, 0 ); @@ -956,11 +845,6 @@ void Abc_End( Abc_Frame_t * pAbc ) // extern void Au_TabManPrint(); // Au_TabManPrint(); } - { - extern void If_LutLibFree( If_Lib_t * pLutLib ); - if ( Abc_FrameGetGlobalFrame()->pAbc8Lib ) - If_LutLibFree( (If_Lib_t *)Abc_FrameGetGlobalFrame()->pAbc8Lib ); - } // Dar_LibDumpPriorities(); { @@ -4570,6 +4454,7 @@ usage: return 1; } +#if 0 /**Function************************************************************* Synopsis [] @@ -4702,7 +4587,7 @@ usage: Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } - +#endif /**Function************************************************************* Synopsis [] @@ -21305,3075 +21190,6 @@ usage: } - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8Read( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - FILE * pFile; - char * pFileName; - int c; - int fMapped; - int fTest; - - // set defaults - fMapped = 0; - fTest = 0; - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "mth" ) ) != EOF ) - { - switch ( c ) - { - case 'm': - fMapped ^= 1; - break; - case 't': - fTest ^= 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - - // get the input file name - pFileName = argv[globalUtilOptind]; - if ( (pFile = fopen( pFileName, "r" )) == NULL ) - { - Abc_Print( -1, "Cannot open input file \"%s\". ", pFileName ); - if ( (pFileName = Extra_FileGetSimilarName( pFileName, ".blif", NULL, NULL, NULL, NULL )) ) - Abc_Print( 1, "Did you mean \"%s\"?", pFileName ); - Abc_Print( 1, "\n" ); - return 1; - } - fclose( pFile ); - if ( fTest ) - { - Ntl_Man_t * pTemp = Ntl_ManReadBlif( pFileName, 1 ); - if ( pTemp ) - { -// Ntl_ManWriteBlif( pTemp, "test_boxes.blif" ); - Ntl_ManPrintStats( pTemp ); - Ntl_ManFree( pTemp ); - } - return 0; - } - - Abc_FrameClearDesign(); - pAbc->pAbc8Ntl = Ntl_ManReadBlif( pFileName, 1 ); - if ( pAbc->pAbc8Ntl == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Read(): Reading BLIF has failed.\n" ); - return 1; - } - pAbc->pAbc8Aig = Ntl_ManExtract( pAbc->pAbc8Ntl ); - if ( pAbc->pAbc8Aig == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Read(): AIG extraction has failed.\n" ); - return 1; - } - if ( fMapped ) - { - pAbc->pAbc8Nwk = Ntl_ManExtractNwk( pAbc->pAbc8Ntl, pAbc->pAbc8Aig, NULL ); - if ( pAbc->pAbc8Nwk == NULL ) - Abc_Print( -1, "Abc_CommandAbc8Read(): Warning! Mapped network is not extracted.\n" ); - } - return 0; - -usage: - Abc_Print( -2, "usage: *r [-mth]\n" ); - Abc_Print( -2, "\t reads the design with whiteboxes\n" ); - Abc_Print( -2, "\t-m : toggle extracting mapped network [default = %s]\n", fMapped? "yes": "no" ); - Abc_Print( -2, "\t-t : toggle reading in the test mode [default = %s]\n", fTest? "yes": "no" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8ReadLogic( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - FILE * pFile; - char * pFileName; - Nwk_Man_t * pNtkNew; - int c; - - // set defaults - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) - { - switch ( c ) - { - case 'h': - goto usage; - default: - goto usage; - } - } - - // get the input file name - pFileName = argv[globalUtilOptind]; - if ( (pFile = fopen( pFileName, "r" )) == NULL ) - { - Abc_Print( -1, "Cannot open input file \"%s\". ", pFileName ); - if ( (pFileName = Extra_FileGetSimilarName( pFileName, ".blif", NULL, NULL, NULL, NULL )) ) - Abc_Print( 1, "Did you mean \"%s\"?", pFileName ); - Abc_Print( 1, "\n" ); - return 1; - } - fclose( pFile ); - - if ( pAbc->pAbc8Ntl == NULL || pAbc->pAbc8Aig == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8ReadLogic(): There is no design or its AIG.\n" ); - return 1; - } - - // read the new logic - pNtkNew = Ntl_ManReadNwk( pFileName, pAbc->pAbc8Aig, Ntl_ManReadTimeMan(pAbc->pAbc8Ntl) ); - if ( pNtkNew == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8ReadLogic(): Procedure has failed.\n" ); - return 1; - } - if ( pAbc->pAbc8Nwk != NULL ) - Nwk_ManFree( pAbc->pAbc8Nwk ); - pAbc->pAbc8Nwk = pNtkNew; - return 0; - -usage: - Abc_Print( -2, "usage: *rlogic [-h]\n" ); - Abc_Print( -2, "\t reads the logic part of the design without whiteboxes\n" ); - Abc_Print( -2, "\t and sets the new logic as the current mapped network\n" ); - Abc_Print( -2, "\t (the logic part should be comb and with the same PIs/POs)\n" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8Write( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - char * pFileName; - Aig_Man_t * pTemp; - Ntl_Man_t * pTemp2; - int fAig; - int fBlif; - int fCollapsed; - int c; - - // set defaults - fAig = 0; - fBlif = 1; - fCollapsed = 0; - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "abch" ) ) != EOF ) - { - switch ( c ) - { - case 'a': - fAig ^= 1; - break; - case 'b': - fBlif ^= 1; - break; - case 'c': - fCollapsed ^= 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - if ( pAbc->pAbc8Ntl == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Write(): There is no design to write.\n" ); - return 1; - } - // create the design to write - pFileName = argv[globalUtilOptind]; - if ( fAig ) - { - if ( fCollapsed ) - { - pTemp = Ntl_ManCollapseSeq( pAbc->pAbc8Ntl, 0, 0 ); - if ( fBlif ) - Saig_ManDumpBlif( pTemp, pFileName ); - else - Ioa_WriteAiger( pTemp, pFileName, 0, 0 ); - Aig_ManStop( pTemp ); - } - else - { - if ( pAbc->pAbc8Aig != NULL ) - { - if ( fBlif ) - { - pTemp2 = Ntl_ManInsertAig( pAbc->pAbc8Ntl, pAbc->pAbc8Aig ); - if ( pTemp2 == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Write(): Inserting AIG has failed.\n" ); - return 1; - } - Ntl_ManWriteBlif( pTemp2, pFileName ); - Ntl_ManFree( pTemp2 ); - } - else - Ioa_WriteAiger( pAbc->pAbc8Aig, pFileName, 0, 0 ); - } - else - { - Abc_Print( -1, "There is no AIG to write.\n" ); - return 1; - } - } - } - else - { - if ( pAbc->pAbc8Nwk != NULL ) - { - pTemp2 = Ntl_ManInsertNtk( pAbc->pAbc8Ntl, pAbc->pAbc8Nwk ); - if ( pTemp2 == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Write(): Inserting mapped network has failed.\n" ); - return 1; - } - Ntl_ManWriteBlif( pTemp2, pFileName ); - Ntl_ManFree( pTemp2 ); - } - else - { - Abc_Print( -1, "Writing the unmapped netlist.\n" ); - pTemp2 = pAbc->pAbc8Ntl; - Ntl_ManWriteBlif( pTemp2, pFileName ); - } - } - return 0; - -usage: - Abc_Print( -2, "usage: *w [-abch]\n" ); - Abc_Print( -2, "\t write the design with whiteboxes\n" ); - Abc_Print( -2, "\t-a : toggle writing design or internal AIG [default = %s]\n", fAig? "AIG": "design" ); - Abc_Print( -2, "\t-b : toggle writing AIG as BLIF or AIGER [default = %s]\n", fBlif? "BLIF": "AIGER" ); - Abc_Print( -2, "\t-c : toggle writing collapsed sequential AIG [default = %s]\n", fCollapsed? "yes": "no" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8WriteLogic( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - Vec_Ptr_t * vCiNames = NULL, * vCoNames = NULL; - char * pFileName; - int fAig; - int c; - - // set defaults - fAig = 0; - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "ah" ) ) != EOF ) - { - switch ( c ) - { - case 'a': - fAig ^= 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - if ( pAbc->pAbc8Ntl == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Write(): There is no design to write.\n" ); - return 1; - } - // create the design to write - pFileName = argv[globalUtilOptind]; -// vCiNames = Ntl_ManCollectCiNames( pAbc->pAbc8Ntl ); -// vCoNames = Ntl_ManCollectCoNames( pAbc->pAbc8Ntl ); - // the problem is duplicated CO names... - if ( fAig ) - { - if ( pAbc->pAbc8Aig != NULL ) - Aig_ManDumpBlif( pAbc->pAbc8Aig, pFileName, vCiNames, vCoNames ); - else - { - Abc_Print( -1, "There is no AIG to write.\n" ); - return 1; - } - } - else - { - if ( pAbc->pAbc8Nwk != NULL ) - Nwk_ManDumpBlif( pAbc->pAbc8Nwk, pFileName, vCiNames, vCoNames ); - else - { - Abc_Print( -1, "There is no mapped network to write.\n" ); - return 1; - } - } - if ( vCiNames ) Vec_PtrFree( vCiNames ); - if ( vCoNames ) Vec_PtrFree( vCoNames ); - return 0; - -usage: - Abc_Print( -2, "usage: *wlogic [-ah]\n" ); - Abc_Print( -2, "\t write the logic part of the design without whiteboxes\n" ); - Abc_Print( -2, "\t-a : toggle writing mapped network or AIG [default = %s]\n", fAig? "AIG": "network" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [Command procedure to read LUT libraries.] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8ReadLut( Abc_Frame_t * pAbc, int argc, char **argv ) -{ - FILE * pFile; - char * FileName; - If_Lib_t * pLib; - int c; - extern If_Lib_t * If_LutLibRead( char * FileName ); - extern void If_LutLibFree( If_Lib_t * pLutLib ); - - // set the defaults - Extra_UtilGetoptReset(); - while ( (c = Extra_UtilGetopt(argc, argv, "h")) != EOF ) - { - switch (c) - { - case 'h': - goto usage; - break; - default: - goto usage; - } - } - - - if ( argc != globalUtilOptind + 1 ) - { - goto usage; - } - - // get the input file name - FileName = argv[globalUtilOptind]; - if ( (pFile = fopen( FileName, "r" )) == NULL ) - { - Abc_Print( -1, "Cannot open input file \"%s\". ", FileName ); - if ( (FileName = Extra_FileGetSimilarName( FileName, ".lut", NULL, NULL, NULL, NULL )) ) - Abc_Print( 1, "Did you mean \"%s\"?", FileName ); - Abc_Print( 1, "\n" ); - return 1; - } - fclose( pFile ); - - // set the new network - pLib = If_LutLibRead( FileName ); - if ( pLib == NULL ) - { - Abc_Print( -1, "Reading LUT library has failed.\n" ); - goto usage; - } - // replace the current library - if ( pAbc->pAbc8Lib != NULL ) - If_LutLibFree( pAbc->pAbc8Lib ); - pAbc->pAbc8Lib = pLib; - return 0; - -usage: - Abc_Print( -2, "\nusage: *rlut [-h]\n"); - Abc_Print( -2, "\t read the LUT library from the file\n" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - Abc_Print( -2, "\t \n"); - Abc_Print( -2, "\t File format for a LUT library:\n"); - Abc_Print( -2, "\t (the default library is shown)\n"); - Abc_Print( -2, "\t \n"); - Abc_Print( -2, "\t # The area/delay of k-variable LUTs:\n"); - Abc_Print( -2, "\t # k area delay\n"); - Abc_Print( -2, "\t 1 1 1\n"); - Abc_Print( -2, "\t 2 2 2\n"); - Abc_Print( -2, "\t 3 4 3\n"); - Abc_Print( -2, "\t 4 8 4\n"); - Abc_Print( -2, "\t 5 16 5\n"); - Abc_Print( -2, "\t 6 32 6\n"); - return 1; /* error exit */ -} - -/**Function************************************************************* - - Synopsis [Command procedure to read LUT libraries.] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8PrintLut( Abc_Frame_t * pAbc, int argc, char **argv ) -{ - int c; - extern void If_LutLibPrint( If_Lib_t * pLutLib ); - - // set the defaults - Extra_UtilGetoptReset(); - while ( (c = Extra_UtilGetopt(argc, argv, "h")) != EOF ) - { - switch (c) - { - case 'h': - goto usage; - break; - default: - goto usage; - } - } - - if ( argc != globalUtilOptind ) - { - goto usage; - } - - // set the new network - if ( pAbc->pAbc8Lib == NULL ) - Abc_Print( -1, "Abc_CommandAbc8PrintLut(): LUT library is not specified.\n" ); - else - If_LutLibPrint( (If_Lib_t *)pAbc->pAbc8Lib ); - return 0; - -usage: - Abc_Print( -2, "\nusage: *plut [-h]\n"); - Abc_Print( -2, "\t print the current LUT library\n" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; /* error exit */ -} - -/**Function************************************************************* - - Synopsis [Command procedure to read LUT libraries.] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8Check( Abc_Frame_t * pAbc, int argc, char **argv ) -{ - int c; - - // set the defaults - Extra_UtilGetoptReset(); - while ( (c = Extra_UtilGetopt(argc, argv, "h")) != EOF ) - { - switch (c) - { - case 'h': - goto usage; - break; - default: - goto usage; - } - } - - if ( argc != globalUtilOptind ) - { - goto usage; - } - - // set the new network - if ( pAbc->pAbc8Nwk == NULL ) - Abc_Print( -1, "Abc_CommandAbc8Check(): There is no mapped network.\n" ); - else - Nwk_ManCheck( pAbc->pAbc8Nwk ); - return 0; - -usage: - Abc_Print( -2, "\nusage: *check [-h]\n"); - Abc_Print( -2, "\t checks if the current mapped network has duplicated fanins\n" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; /* error exit */ -} - - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8Ps( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - int c; - int fSaveBest; - int fDumpResult; - int fPower; - int fShort; - extern If_Lib_t * If_SetSimpleLutLib( int nLutSize ); - - // set defaults - fSaveBest = 0; - fDumpResult = 0; - fPower = 0; - fShort = 1; - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "bdpsh" ) ) != EOF ) - { - switch ( c ) - { - case 'b': - fSaveBest ^= 1; - break; - case 'd': - fDumpResult ^= 1; - break; - case 'p': - fPower ^= 1; - break; - case 's': - fShort ^= 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - if ( pAbc->pAbc8Ntl == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Ps(): There is no design to show.\n" ); - return 1; - } - - if ( fShort ) - { - Nwk_ManPrintStatsShort( pAbc->pAbc8Ntl, pAbc->pAbc8Aig, pAbc->pAbc8Nwk ); - return 0; - } - // get the input file name - if ( pAbc->pAbc8Ntl ) - { - Abc_Print( -1, "NETLIST: " ); - Ntl_ManPrintStats( pAbc->pAbc8Ntl ); - } - if ( pAbc->pAbc8Aig ) - { - Abc_Print( -1, "AIG: " ); - Aig_ManPrintStats( pAbc->pAbc8Aig ); - } - if ( pAbc->pAbc8Nwk ) - { - if ( pAbc->pAbc8Lib == NULL ) - { - Abc_Print( -1, "LUT library is not given. Using default LUT library.\n" ); - pAbc->pAbc8Lib = If_SetSimpleLutLib( 6 ); - } - Abc_Print( -1, "MAPPED: " ); - Nwk_ManPrintStats( pAbc->pAbc8Nwk, pAbc->pAbc8Lib, fSaveBest, fDumpResult, fPower, pAbc->pAbc8Ntl ); - } - return 0; - -usage: - Abc_Print( -2, "usage: *ps [-bdpsh]\n" ); - Abc_Print( -2, "\t prints design statistics\n" ); - Abc_Print( -2, "\t-b : toggles saving the best logic network in \"best.blif\" [default = %s]\n", fSaveBest? "yes": "no" ); - Abc_Print( -2, "\t-d : toggles dumping network into file \"<input_file_name>_dump.blif\" [default = %s]\n", fDumpResult? "yes": "no" ); - Abc_Print( -2, "\t-p : toggles printing power dissipation due to switching [default = %s]\n", fPower? "yes": "no" ); - Abc_Print( -2, "\t-s : toggles short printing mode [default = %s]\n", fShort? "yes": "no" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8Pfan( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - int c; - - // set defaults - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) - { - switch ( c ) - { - case 'h': - goto usage; - default: - goto usage; - } - } - if ( pAbc->pAbc8Nwk == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Pfan(): There is no mapped network for print fanin/fanout.\n" ); - return 1; - } - Nwk_ManPrintFanioNew( pAbc->pAbc8Nwk ); - return 0; - -usage: - Abc_Print( -2, "usage: *pfan [-h]\n" ); - Abc_Print( -2, "\t prints fanin/fanout stats of the mapped network\n" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8If( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - char Buffer[200]; - char LutSize[200]; - If_Par_t Pars, * pPars = &Pars; - Nwk_Man_t * pNtkNew; - int c; - - if ( pAbc->pAbc8Lib == NULL ) - { -// Abc_Print( -1, "LUT library is not given. Using default LUT library.\n" ); - pAbc->pAbc8Lib = If_SetSimpleLutLib( 6 ); - } - - // set defaults - Nwk_ManSetIfParsDefault( pPars ); - pPars->pLutLib = pAbc->pAbc8Lib; - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "KCFADEqaflepmrsdbvh" ) ) != EOF ) - { - switch ( c ) - { - case 'K': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-K\" should be followed by a positive integer.\n" ); - goto usage; - } - pPars->nLutSize = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nLutSize < 0 ) - goto usage; - // if the LUT size is specified, disable library - pPars->pLutLib = NULL; - break; - case 'C': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-C\" should be followed by a positive integer.\n" ); - goto usage; - } - pPars->nCutsMax = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nCutsMax < 0 ) - goto usage; - break; - case 'F': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-F\" should be followed by a positive integer.\n" ); - goto usage; - } - pPars->nFlowIters = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nFlowIters < 0 ) - goto usage; - break; - case 'A': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-A\" should be followed by a positive integer.\n" ); - goto usage; - } - pPars->nAreaIters = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nAreaIters < 0 ) - goto usage; - break; - case 'D': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-D\" should be followed by a floating point number.\n" ); - goto usage; - } - pPars->DelayTarget = (float)atof(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->DelayTarget <= 0.0 ) - goto usage; - break; - case 'E': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-E\" should be followed by a floating point number.\n" ); - goto usage; - } - pPars->Epsilon = (float)atof(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->Epsilon < 0.0 || pPars->Epsilon > 1.0 ) - goto usage; - break; - case 'q': - pPars->fPreprocess ^= 1; - break; - case 'a': - pPars->fArea ^= 1; - break; - case 'r': - pPars->fExpRed ^= 1; - break; - case 'f': - pPars->fFancy ^= 1; - break; - case 'l': - pPars->fLatchPaths ^= 1; - break; - case 'e': - pPars->fEdge ^= 1; - break; - case 'p': - pPars->fPower ^= 1; - break; - case 'm': - pPars->fCutMin ^= 1; - break; - case 's': - pPars->fSeqMap ^= 1; - break; - case 'd': - pPars->fBidec ^= 1; - break; - case 'b': - pPars->fUseBat ^= 1; - break; - case 'v': - pPars->fVerbose ^= 1; - break; - case 'h': - default: - goto usage; - } - } - if ( pAbc->pAbc8Aig == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8If(): There is no AIG to map.\n" ); - return 1; - } - - if ( pPars->nLutSize < 3 || pPars->nLutSize > IF_MAX_LUTSIZE ) - { - Abc_Print( -1, "Incorrect LUT size (%d).\n", pPars->nLutSize ); - return 1; - } - - if ( pPars->nCutsMax < 1 || pPars->nCutsMax >= (1<<12) ) - { - Abc_Print( -1, "Incorrect number of cuts.\n" ); - return 1; - } - - // enable truth table computation if choices are selected - if ( (c = Aig_ManChoiceNum( pAbc->pAbc8Aig )) ) - { -// Abc_Print( 0, "Performing LUT mapping with %d choices.\n", c ); - pPars->fExpRed = 0; - } - - if ( pPars->fUseBat ) - { - if ( pPars->nLutSize < 4 || pPars->nLutSize > 6 ) - { - Abc_Print( -1, "This feature only works for {4,5,6}-LUTs.\n" ); - return 1; - } - pPars->fCutMin = 1; - } - - // enable truth table computation if cut minimization is selected - if ( pPars->fCutMin ) - { - pPars->fTruth = 1; - pPars->fExpRed = 0; - } - - // complain if truth tables are requested but the cut size is too large - if ( pPars->fTruth && pPars->nLutSize > IF_MAX_FUNC_LUTSIZE ) - { - Abc_Print( -1, "Truth tables cannot be computed for LUT larger than %d inputs.\n", IF_MAX_FUNC_LUTSIZE ); - return 1; - } - - pNtkNew = Nwk_MappingIf( pAbc->pAbc8Aig, Ntl_ManReadTimeMan(pAbc->pAbc8Ntl), pPars ); - if ( pNtkNew == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8If(): Mapping of the AIG has failed.\n" ); - return 1; - } - if ( pAbc->pAbc8Nwk != NULL ) - Nwk_ManFree( pAbc->pAbc8Nwk ); - pAbc->pAbc8Nwk = pNtkNew; - return 0; - -usage: - if ( pPars->DelayTarget == -1 ) - sprintf( Buffer, "best possible" ); - else - sprintf( Buffer, "%.2f", pPars->DelayTarget ); - if ( pPars->nLutSize == -1 ) - sprintf( LutSize, "library" ); - else - sprintf( LutSize, "%d", pPars->nLutSize ); - Abc_Print( -2, "usage: *if [-KCFA num] [-DE float] [-qarlepmdbvh]\n" ); - Abc_Print( -2, "\t performs FPGA technology mapping of the network\n" ); - Abc_Print( -2, "\t-K num : the number of LUT inputs (2 < num < %d) [default = %s]\n", IF_MAX_LUTSIZE+1, LutSize ); - Abc_Print( -2, "\t-C num : the max number of priority cuts (0 < num < 2^12) [default = %d]\n", pPars->nCutsMax ); - Abc_Print( -2, "\t-F num : the number of area flow recovery iterations (num >= 0) [default = %d]\n", pPars->nFlowIters ); - Abc_Print( -2, "\t-A num : the number of exact area recovery iterations (num >= 0) [default = %d]\n", pPars->nAreaIters ); - Abc_Print( -2, "\t-D float : sets the delay constraint for the mapping [default = %s]\n", Buffer ); - Abc_Print( -2, "\t-E float : sets epsilon used for tie-breaking [default = %f]\n", pPars->Epsilon ); - Abc_Print( -2, "\t-q : toggles preprocessing using several starting points [default = %s]\n", pPars->fPreprocess? "yes": "no" ); - Abc_Print( -2, "\t-a : toggles area-oriented mapping [default = %s]\n", pPars->fArea? "yes": "no" ); -// Abc_Print( -2, "\t-f : toggles one fancy feature [default = %s]\n", pPars->fFancy? "yes": "no" ); - Abc_Print( -2, "\t-r : enables expansion/reduction of the best cuts [default = %s]\n", pPars->fExpRed? "yes": "no" ); - Abc_Print( -2, "\t-l : optimizes latch paths for delay, other paths for area [default = %s]\n", pPars->fLatchPaths? "yes": "no" ); - Abc_Print( -2, "\t-e : uses edge-based cut selection heuristics [default = %s]\n", pPars->fEdge? "yes": "no" ); - Abc_Print( -2, "\t-p : uses power-aware cut selection heuristics [default = %s]\n", pPars->fPower? "yes": "no" ); - Abc_Print( -2, "\t-m : enables cut minimization by removing vacuous variables [default = %s]\n", pPars->fCutMin? "yes": "no" ); -// Abc_Print( -2, "\t-s : toggles sequential mapping [default = %s]\n", pPars->fSeqMap? "yes": "no" ); - Abc_Print( -2, "\t-d : toggles deriving local AIGs using bi-decomposition [default = %s]\n", pPars->fBidec? "yes": "no" ); - Abc_Print( -2, "\t-b : toggles the use of one special feature [default = %s]\n", pPars->fUseBat? "yes": "no" ); - Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); - Abc_Print( -2, "\t-h : prints the command usage\n"); - return 1; -} - - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8DChoice( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - Aig_Man_t * pAigNew; - int fBalance, fVerbose, fUpdateLevel, fConstruct, c; - int nConfMax, nLevelMax; - extern Aig_Man_t * Ntl_ManPerformChoicing( Aig_Man_t * pAig, int fBalance, int fUpdateLevel, int fConstruct, int nConfMax, int nLevelMax, int fVerbose ); - - // set defaults - fBalance = 1; - fUpdateLevel = 1; - fConstruct = 0; - nConfMax = 1000; - nLevelMax = 0; - fVerbose = 0; - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "CLblcvh" ) ) != EOF ) - { - switch ( c ) - { - case 'C': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); - goto usage; - } - nConfMax = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( nConfMax < 0 ) - goto usage; - break; - case 'L': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); - goto usage; - } - nLevelMax = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( nLevelMax < 0 ) - goto usage; - break; - case 'b': - fBalance ^= 1; - break; - case 'l': - fUpdateLevel ^= 1; - break; - case 'c': - fConstruct ^= 1; - break; - case 'v': - fVerbose ^= 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - if ( pAbc->pAbc8Aig == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8DChoice(): There is no AIG to synthesize.\n" ); - return 1; - } - - // get the input file name - pAigNew = Ntl_ManPerformChoicing( pAbc->pAbc8Aig, fBalance, fUpdateLevel, fConstruct, nConfMax, nLevelMax, fVerbose ); - if ( pAigNew == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8DChoice(): Tranformation has failed.\n" ); - return 1; - } - Aig_ManStop( pAbc->pAbc8Aig ); - pAbc->pAbc8Aig = pAigNew; - return 0; - -usage: - Abc_Print( -2, "usage: *dchoice [-C num] [-L num] [-blcvh]\n" ); - Abc_Print( -2, "\t performs AIG-based synthesis and derives choices\n" ); - Abc_Print( -2, "\t-C num : the max number of conflicts at a node [default = %d]\n", nConfMax ); - Abc_Print( -2, "\t-L num : the max level of nodes to consider (0 = not used) [default = %d]\n", nLevelMax ); - Abc_Print( -2, "\t-b : toggle internal balancing [default = %s]\n", fBalance? "yes": "no" ); - Abc_Print( -2, "\t-l : toggle updating level [default = %s]\n", fUpdateLevel? "yes": "no" ); - Abc_Print( -2, "\t-c : toggle constructive computation of choices [default = %s]\n", fConstruct? "yes": "no" ); - Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8Dch( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - Dch_Pars_t Pars, * pPars = &Pars; - Aig_Man_t * pAigNew; - int c; - extern Aig_Man_t * Ntl_ManPerformChoicingNew( Aig_Man_t * pAig, Dch_Pars_t * pPars ); - - // set defaults - Dch_ManSetDefaultParams( pPars ); - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "WCSsptfvh" ) ) != EOF ) - { - switch ( c ) - { - case 'W': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-W\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nWords = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nWords < 0 ) - goto usage; - break; - case 'C': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nBTLimit = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nBTLimit < 0 ) - goto usage; - break; - case 'S': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nSatVarMax = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nSatVarMax < 0 ) - goto usage; - break; - case 's': - pPars->fSynthesis ^= 1; - break; - case 'p': - pPars->fPower ^= 1; - break; - case 't': - pPars->fSimulateTfo ^= 1; - break; - case 'f': - pPars->fLightSynth ^= 1; - break; - case 'v': - pPars->fVerbose ^= 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - if ( pAbc->pAbc8Aig == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Dch(): There is no AIG to synthesize.\n" ); - return 1; - } - - // get the input file name - pAigNew = Ntl_ManPerformChoicingNew( pAbc->pAbc8Aig, pPars ); - if ( pAigNew == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Dch(): Tranformation has failed.\n" ); - return 1; - } -// Aig_ManStop( pAbc->pAbc8Aig ); - pAbc->pAbc8Aig = pAigNew; - return 0; - -usage: - Abc_Print( -2, "usage: *dch [-WCS num] [-sptfvh]\n" ); - Abc_Print( -2, "\t computes structural choices using a new approach\n" ); - Abc_Print( -2, "\t-W num : the max number of simulation words [default = %d]\n", pPars->nWords ); - Abc_Print( -2, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit ); - Abc_Print( -2, "\t-S num : the max number of SAT variables [default = %d]\n", pPars->nSatVarMax ); - Abc_Print( -2, "\t-s : toggle synthesizing three snapshots [default = %s]\n", pPars->fSynthesis? "yes": "no" ); - Abc_Print( -2, "\t-p : toggle power-aware rewriting [default = %s]\n", pPars->fPower? "yes": "no" ); - Abc_Print( -2, "\t-t : toggle simulation of the TFO classes [default = %s]\n", pPars->fSimulateTfo? "yes": "no" ); - Abc_Print( -2, "\t-f : toggle using lighter logic synthesis [default = %s]\n", pPars->fLightSynth? "yes": "no" ); - Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", pPars->fVerbose? "yes": "no" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8Dc2( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - Aig_Man_t * pAigNew; - int c; - int fBalance; - int fUpdateLevel; - int fVerbose; - int fPower; - - extern Aig_Man_t * Dar_ManCompress2( Aig_Man_t * pAig, int fBalance, int fUpdateLevel, int fFanout, int fPower, int fVerbose ); - - // set defaults - fBalance = 1; - fUpdateLevel = 1; - fPower = 0; - fVerbose = 0; - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "blpvh" ) ) != EOF ) - { - switch ( c ) - { - case 'b': - fBalance ^= 1; - break; - case 'l': - fUpdateLevel ^= 1; - break; - case 'p': - fPower ^= 1; - break; - case 'v': - fVerbose ^= 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - if ( pAbc->pAbc8Aig == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Dc2(): There is no AIG to synthesize.\n" ); - return 1; - } - - // get the input file name - pAigNew = Dar_ManCompress2( pAbc->pAbc8Aig, fBalance, fUpdateLevel, 1, fPower, fVerbose ); - if ( pAigNew == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Dc2(): Tranformation has failed.\n" ); - return 1; - } - Aig_ManStop( pAbc->pAbc8Aig ); - pAbc->pAbc8Aig = pAigNew; - return 0; - -usage: - Abc_Print( -2, "usage: *dc2 [-blpvh]\n" ); - Abc_Print( -2, "\t performs AIG-based synthesis without deriving choices\n" ); - Abc_Print( -2, "\t-b : toggle internal balancing [default = %s]\n", fBalance? "yes": "no" ); - Abc_Print( -2, "\t-l : toggle updating level [default = %s]\n", fUpdateLevel? "yes": "no" ); - Abc_Print( -2, "\t-p : toggle power-aware rewriting [default = %s]\n", fPower? "yes": "no" ); - Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8Bidec( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - int c; - - // set defaults - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) - { - switch ( c ) - { - case 'h': - goto usage; - default: - goto usage; - } - } - if ( pAbc->pAbc8Nwk == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Bidec(): There is no mapped network to strash.\n" ); - return 1; - } - Nwk_ManBidecResyn( pAbc->pAbc8Nwk, 0 ); - return 0; - -usage: - Abc_Print( -2, "usage: *bidec [-h]\n" ); - Abc_Print( -2, "\t performs bi-decomposition of local functions\n" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8Strash( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - Aig_Man_t * pAigNew; - int c; - - // set defaults - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) - { - switch ( c ) - { - case 'h': - goto usage; - default: - goto usage; - } - } - if ( pAbc->pAbc8Nwk == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Strash(): There is no mapped network to strash.\n" ); - return 1; - } - - pAigNew = Nwk_ManStrash( pAbc->pAbc8Nwk ); - if ( pAigNew == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Strash(): Tranformation has failed.\n" ); - return 1; - } - Aig_ManStop( pAbc->pAbc8Aig ); - pAbc->pAbc8Aig = pAigNew; - return 0; - -usage: - Abc_Print( -2, "usage: *st [-h]\n" ); - Abc_Print( -2, "\t performs structural hashing of mapped network\n" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8Mfs( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - Mfx_Par_t Pars, * pPars = &Pars; - int c; -// extern int Mfx_Perform( void * pNtk, Mfx_Par_t * pPars, If_Lib_t * pLutLib ); - - // set defaults - Mfx_ParsDefault( pPars ); - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "WFDMLCraespvwh" ) ) != EOF ) - { - switch ( c ) - { - case 'W': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-W\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nWinTfoLevs = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nWinTfoLevs < 0 ) - goto usage; - break; - case 'F': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nFanoutsMax = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nFanoutsMax < 1 ) - goto usage; - break; - case 'D': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nDepthMax = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nDepthMax < 0 ) - goto usage; - break; - case 'M': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nWinSizeMax = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nWinSizeMax < 0 ) - goto usage; - break; - case 'L': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nGrowthLevel = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nGrowthLevel < 0 || pPars->nGrowthLevel > ABC_INFINITY ) - goto usage; - break; - case 'C': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nBTLimit = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nBTLimit < 0 ) - goto usage; - break; - case 'r': - pPars->fResub ^= 1; - break; - case 'a': - pPars->fArea ^= 1; - break; - case 'e': - pPars->fMoreEffort ^= 1; - break; - case 's': - pPars->fSwapEdge ^= 1; - break; - case 'p': - pPars->fPower ^= 1; - break; - case 'v': - pPars->fVerbose ^= 1; - break; - case 'w': - pPars->fVeryVerbose ^= 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - if ( pAbc->pAbc8Nwk == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Mfs(): There is no mapped network.\n" ); - return 1; - } - if ( pAbc->pAbc8Lib == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Mfs(): There is no LUT library.\n" ); - return 1; - } - if ( If_LutLibDelaysAreDifferent(pAbc->pAbc8Lib) ) - { - Abc_Print( -1, "Abc_CommandAbc8Mfs(): Cannot perform don't-care simplication with variable-pin-delay LUT model.\n" ); - Abc_Print( -1, "The delay model should be fixed-pin-delay, for example, the delay of all pins of all LUTs is 0.4.\n" ); - return 1; - } - - - // modify the current network - if ( !Mfx_Perform( pAbc->pAbc8Nwk, pPars, pAbc->pAbc8Lib ) ) - { - Abc_Print( -1, "Abc_CommandAbc8Mfs(): Command has failed.\n" ); - return 1; - } - return 0; - -usage: - Abc_Print( -2, "usage: *mfs [-WFDMLC num] [-raespvh]\n" ); - Abc_Print( -2, "\t performs don't-care-based optimization of logic networks\n" ); - Abc_Print( -2, "\t-W <num> : the number of levels in the TFO cone (0 <= num) [default = %d]\n", pPars->nWinTfoLevs ); - Abc_Print( -2, "\t-F <num> : the max number of fanouts to skip (1 <= num) [default = %d]\n", pPars->nFanoutsMax ); - Abc_Print( -2, "\t-D <num> : the max depth nodes to try (0 = no limit) [default = %d]\n", pPars->nDepthMax ); - Abc_Print( -2, "\t-M <num> : the max node count of windows to consider (0 = no limit) [default = %d]\n", pPars->nWinSizeMax ); - Abc_Print( -2, "\t-L <num> : the max increase in node level after resynthesis (0 <= num) [default = %d]\n", pPars->nGrowthLevel ); - Abc_Print( -2, "\t-C <num> : the max number of conflicts in one SAT run (0 = no limit) [default = %d]\n", pPars->nBTLimit ); - Abc_Print( -2, "\t-r : toggle resubstitution and dc-minimization [default = %s]\n", pPars->fResub? "resub": "dc-min" ); - Abc_Print( -2, "\t-a : toggle minimizing area or area+edges [default = %s]\n", pPars->fArea? "area": "area+edges" ); - Abc_Print( -2, "\t-e : toggle high-effort resubstitution [default = %s]\n", pPars->fMoreEffort? "yes": "no" ); - Abc_Print( -2, "\t-s : toggle evaluation of edge swapping [default = %s]\n", pPars->fSwapEdge? "yes": "no" ); - Abc_Print( -2, "\t-p : toggle power-aware optimization [default = %s]\n", pPars->fPower? "yes": "no" ); - Abc_Print( -2, "\t-v : toggle printing optimization summary [default = %s]\n", pPars->fVerbose? "yes": "no" ); - Abc_Print( -2, "\t-w : toggle printing detailed stats for each node [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8Lutpack( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - int c; - - Abc_Print( -1, "This command is temporarily disabled.\n" ); - return 0; - - // set defaults - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) - { - switch ( c ) - { - case 'h': - goto usage; - default: - goto usage; - } - } - if ( pAbc->pAbc8Nwk == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Lutpack(): There is no mapped network to strash.\n" ); - return 1; - } - - - return 0; -usage: -/* - Abc_Print( -2, "usage: *lp [-h]\n" ); - Abc_Print( -2, "usage: lutpack [-N <num>] [-Q <num>] [-S <num>] [-L <num>] [-szfovwh]\n" ); - Abc_Print( -2, "\t performs \"rewriting\" for LUT network;\n" ); - Abc_Print( -2, "\t determines LUT size as the max fanin count of a node;\n" ); - Abc_Print( -2, "\t if the network is not LUT-mapped, packs it into 6-LUTs\n" ); - Abc_Print( -2, "\t (there is another command for resynthesis after LUT mapping, \"imfs\")\n" ); - Abc_Print( -2, "\t-N <num> : the max number of LUTs in the structure (2 <= num) [default = %d]\n", pPars->nLutsMax ); - Abc_Print( -2, "\t-Q <num> : the max number of LUTs not in MFFC (0 <= num) [default = %d]\n", pPars->nLutsOver ); - Abc_Print( -2, "\t-S <num> : the max number of LUT inputs shared (0 <= num <= 3) [default = %d]\n", pPars->nVarsShared ); - Abc_Print( -2, "\t-L <num> : max level increase after resynthesis (0 <= num) [default = %d]\n", pPars->nGrowthLevel ); - Abc_Print( -2, "\t-s : toggle iteration till saturation [default = %s]\n", pPars->fSatur? "yes": "no" ); - Abc_Print( -2, "\t-z : toggle zero-cost replacements [default = %s]\n", pPars->fZeroCost? "yes": "no" ); - Abc_Print( -2, "\t-f : toggle using only first node and first cut [default = %s]\n", pPars->fFirst? "yes": "no" ); - Abc_Print( -2, "\t-o : toggle using old implementation [default = %s]\n", pPars->fOldAlgo? "yes": "no" ); - Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", pPars->fVerbose? "yes": "no" ); - Abc_Print( -2, "\t-w : toggle detailed printout of decomposed functions [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); - Abc_Print( -2, "\t-h : print the command usage\n"); -*/ - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8Balance( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - Aig_Man_t * pAigNew; - int c; - int fExor; - int fUpdateLevel; - int fVerbose; - extern Aig_Man_t * Dar_ManBalanceXor( Aig_Man_t * pAig, int fExor, int fUpdateLevel, int fVerbose ); - - // set defaults - fExor = 0; - fUpdateLevel = 1; - fVerbose = 0; - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "xlh" ) ) != EOF ) - { - switch ( c ) - { - case 'x': - fExor ^= 1; - break; - case 'l': - fUpdateLevel ^= 1; - break; - case 'v': - fVerbose ^= 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - if ( pAbc->pAbc8Aig == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Balance(): There is no AIG to synthesize.\n" ); - return 1; - } - - // get the input file name - pAigNew = Dar_ManBalanceXor( pAbc->pAbc8Aig, fExor, fUpdateLevel, fVerbose ); - if ( pAigNew == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Balance(): Tranformation has failed.\n" ); - return 1; - } - Aig_ManStop( pAbc->pAbc8Aig ); - pAbc->pAbc8Aig = pAigNew; - return 0; - -usage: - Abc_Print( -2, "usage: *b [-xlvh]\n" ); - Abc_Print( -2, "\t performs balancing of the AIG\n" ); - Abc_Print( -2, "\t-x : toggle using XOR-balancing [default = %s]\n", fExor? "yes": "no" ); - Abc_Print( -2, "\t-l : toggle updating level [default = %s]\n", fUpdateLevel? "yes": "no" ); - Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8Speedup( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - Aig_Man_t * pAigNew; - int c; - int fUseLutLib = 0; - int Percentage = 100; - int Degree = 5; - int fVerbose = 0; - int fVeryVerbose = 0; - - // set defaults - fUseLutLib = 0; - Percentage = 5; - Degree = 2; - fVerbose = 0; - fVeryVerbose = 0; - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "PNlvwh" ) ) != EOF ) - { - switch ( c ) - { - case 'P': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); - goto usage; - } - Percentage = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( Percentage < 1 || Percentage > 100 ) - goto usage; - break; - case 'N': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); - goto usage; - } - Degree = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( Degree < 1 || Degree > 5 ) - goto usage; - break; - case 'l': - fUseLutLib ^= 1; - break; - case 'v': - fVerbose ^= 1; - break; - case 'w': - fVeryVerbose ^= 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - if ( pAbc->pAbc8Nwk == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Speedup(): There is no mapped network to strash.\n" ); - return 1; - } - - pAigNew = Nwk_ManSpeedup( pAbc->pAbc8Nwk, fUseLutLib, Percentage, Degree, fVerbose, fVeryVerbose ); - if ( pAigNew == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Speedup(): Tranformation has failed.\n" ); - return 1; - } - Aig_ManStop( pAbc->pAbc8Aig ); - pAbc->pAbc8Aig = pAigNew; - return 0; - -usage: - Abc_Print( -2, "usage: *speedup [-P num] [-N num] [-lvwh]\n" ); - Abc_Print( -2, "\t transforms LUT-mapped network into an AIG with choices;\n" ); - Abc_Print( -2, "\t the choices are added to speedup the next round of mapping\n" ); - Abc_Print( -2, "\t-P <num> : delay delta defining critical path for library model [default = %d%%]\n", Percentage ); - Abc_Print( -2, "\t-N <num> : the max critical path degree for resynthesis (0 < num < 6) [default = %d]\n", Degree ); - Abc_Print( -2, "\t-l : toggle using unit- or LUT-library-delay model [default = %s]\n", fUseLutLib? "lib" : "unit" ); - Abc_Print( -2, "\t-v : toggle printing optimization summary [default = %s]\n", fVerbose? "yes": "no" ); - Abc_Print( -2, "\t-w : toggle printing detailed stats for each node [default = %s]\n", fVeryVerbose? "yes": "no" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8Merge( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - Nwk_LMPars_t Pars, * pPars = &Pars; - Vec_Int_t * vResult; - int c; - - // set defaults - memset( pPars, 0, sizeof(Nwk_LMPars_t) ); - pPars->nMaxLutSize = 5; // the max LUT size for merging (N=5) - pPars->nMaxSuppSize = 5; // the max total support size after merging (S=5) - pPars->nMaxDistance = 3; // the max number of nodes separating LUTs - pPars->nMaxLevelDiff = 2; // the max difference in levels - pPars->nMaxFanout = 100; // the max number of fanouts to traverse - pPars->fUseDiffSupp = 0; // enables the use of nodes with different support - pPars->fUseTfiTfo = 0; // enables the use of TFO/TFO nodes as candidates - pPars->fVeryVerbose = 0; // enables additional verbose output - pPars->fVerbose = 1; // enables verbose output - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "NSDLFscvwh" ) ) != EOF ) - { - switch ( c ) - { - case 'N': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nMaxLutSize = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nMaxLutSize < 2 ) - goto usage; - break; - case 'S': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nMaxSuppSize = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nMaxSuppSize < 2 ) - goto usage; - break; - case 'D': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nMaxDistance = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nMaxDistance < 2 ) - goto usage; - break; - case 'L': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nMaxLevelDiff = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nMaxLevelDiff < 2 ) - goto usage; - break; - case 'F': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nMaxFanout = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nMaxFanout < 2 ) - goto usage; - break; - case 's': - pPars->fUseDiffSupp ^= 1; - break; - case 'c': - pPars->fUseTfiTfo ^= 1; - break; - case 'w': - pPars->fVeryVerbose ^= 1; - break; - case 'v': - pPars->fVerbose ^= 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - if ( pAbc->pAbc8Nwk == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Speedup(): There is no mapped network to merge LUTs.\n" ); - return 1; - } - - vResult = Nwk_ManLutMerge( pAbc->pAbc8Nwk, pPars ); - Vec_IntFree( vResult ); - return 0; - -usage: - Abc_Print( -2, "usage: *merge [-NSDLF num] [-scwvh]\n" ); - Abc_Print( -2, "\t creates pairs of topologically-related LUTs\n" ); - Abc_Print( -2, "\t-N <num> : the max LUT size for merging (1 < num) [default = %d]\n", pPars->nMaxLutSize ); - Abc_Print( -2, "\t-S <num> : the max total support size after merging (1 < num) [default = %d]\n", pPars->nMaxSuppSize ); - Abc_Print( -2, "\t-D <num> : the max distance in terms of LUTs (0 < num) [default = %d]\n", pPars->nMaxDistance ); - Abc_Print( -2, "\t-L <num> : the max difference in levels (0 <= num) [default = %d]\n", pPars->nMaxLevelDiff ); - Abc_Print( -2, "\t-F <num> : the max number of fanouts to stop traversal (0 < num) [default = %d]\n", pPars->nMaxFanout ); - Abc_Print( -2, "\t-s : toggle the use of nodes without support overlap [default = %s]\n", pPars->fUseDiffSupp? "yes" : "no" ); - Abc_Print( -2, "\t-c : toggle the use of TFI/TFO nodes as candidates [default = %s]\n", pPars->fUseTfiTfo? "yes" : "no" ); - Abc_Print( -2, "\t-w : toggle printing detailed stats for each node [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); - Abc_Print( -2, "\t-v : toggle printing optimization summary [default = %s]\n", pPars->fVerbose? "yes": "no" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8Insert( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - Ntl_Man_t * pNtlNew; - int c; - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF ) - { - switch ( c ) - { - case 'h': - goto usage; - default: - goto usage; - } - } - if ( pAbc->pAbc8Ntl == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Insert(): There is no design.\n" ); - return 1; - } - if ( pAbc->pAbc8Nwk == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Insert(): There is no network to insert.\n" ); - return 1; - } - pNtlNew = Ntl_ManInsertNtk( pAbc->pAbc8Ntl, pAbc->pAbc8Nwk ); - Abc_FrameClearDesign(); - pAbc->pAbc8Ntl = pNtlNew; - return 0; - -usage: - Abc_Print( -2, "usage: *insert [-h]\n" ); - Abc_Print( -2, "\t inserts the mapped network into the netlist\n" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8ClpLut( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - Ntl_Man_t * pNtlNew; - int c; - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF ) - { - switch ( c ) - { - case 'h': - goto usage; - default: - goto usage; - } - } - if ( pAbc->pAbc8Ntl == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Insert(): There is no design.\n" ); - return 1; - } - pNtlNew = Ntl_ManDupCollapseLuts( pAbc->pAbc8Ntl ); - Abc_FrameClearDesign(); - pAbc->pAbc8Ntl = pNtlNew; - pAbc->pAbc8Aig = Ntl_ManExtract( pAbc->pAbc8Ntl ); - return 0; - -usage: - Abc_Print( -2, "usage: *clplut [-h]\n" ); - Abc_Print( -2, "\t collapses comb white boxes whose model name begins with \"LUT\"\n" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8Fraig( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - Ntl_Man_t * pNtlNew, * pNtlOld; - int c, fVerbose; - int nPartSize; - int nConfLimit; - int nLevelMax; - int fUseCSat; - - // set defaults - nPartSize = 0; - nConfLimit = 100; - nLevelMax = 0; - fUseCSat = 0; - fVerbose = 0; - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "PCLcvh" ) ) != EOF ) - { - switch ( c ) - { - case 'P': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); - goto usage; - } - nPartSize = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( nPartSize < 0 ) - goto usage; - break; - case 'C': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); - goto usage; - } - nConfLimit = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( nConfLimit < 0 ) - goto usage; - break; - case 'L': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); - goto usage; - } - nLevelMax = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( nLevelMax < 0 ) - goto usage; - break; - case 'c': - fUseCSat ^= 1; - break; - case 'v': - fVerbose ^= 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - - if ( pAbc->pAbc8Ntl == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Fraig(): There is no design to SAT sweep.\n" ); - return 1; - } - - // get the input file name - pNtlOld = pAbc->pAbc8Ntl; pAbc->pAbc8Ntl = NULL; - pNtlNew = Ntl_ManFraig( pNtlOld, nPartSize, nConfLimit, nLevelMax, fUseCSat, fVerbose ); - if ( pNtlNew == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Fraig(): Tranformation has failed.\n" ); - return 1; - } - - Abc_FrameClearDesign(); - pAbc->pAbc8Ntl = pNtlNew; - if ( pAbc->pAbc8Ntl == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Fraig(): Reading BLIF has failed.\n" ); - return 1; - } - pAbc->pAbc8Aig = Ntl_ManExtract( pAbc->pAbc8Ntl ); - if ( pAbc->pAbc8Aig == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Fraig(): AIG extraction has failed.\n" ); - return 1; - } - return 0; - -usage: - Abc_Print( -2, "usage: *fraig [-P num] [-C num] [-L num] [-vh]\n" ); - Abc_Print( -2, "\t applies SAT sweeping to netlist with white-boxes\n" ); - Abc_Print( -2, "\t-P num : partition size (0 = partitioning is not used) [default = %d]\n", nPartSize ); - Abc_Print( -2, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfLimit ); - Abc_Print( -2, "\t-L num : limit on node level to fraig (0 = fraig all nodes) [default = %d]\n", nLevelMax ); -// Abc_Print( -2, "\t-c : toggle using new AIG package and SAT solver [default = %s]\n", fUseCSat? "yes": "no" ); - Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8Scl( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - Ntl_Man_t * pNtlNew, * pNtlOld; - int c; - int fLatchConst; - int fLatchEqual; - int fVerbose; - - // set defaults - fLatchConst = 1; - fLatchEqual = 1; - fVerbose = 0; - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "cevh" ) ) != EOF ) - { - switch ( c ) - { - case 'c': - fLatchConst ^= 1; - break; - case 'e': - fLatchEqual ^= 1; - break; - case 'v': - fVerbose ^= 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - - if ( pAbc->pAbc8Ntl == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Scl(): There is no design to SAT sweep.\n" ); - return 1; - } - - if ( Ntl_ManIsComb(pAbc->pAbc8Ntl) ) - { - Abc_Print( -1, "Abc_CommandAbc8Scl(): The network is combinational.\n" ); - return 0; - } - - // get the input file name - pNtlOld = pAbc->pAbc8Ntl; pAbc->pAbc8Ntl = NULL; - pNtlNew = Ntl_ManScl( pNtlOld, fLatchConst, fLatchEqual, fVerbose ); - if ( pNtlNew == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Scl(): Tranformation has failed.\n" ); - return 1; - } - - Abc_FrameClearDesign(); - pAbc->pAbc8Ntl = pNtlNew; - if ( pAbc->pAbc8Ntl == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Scl(): Reading BLIF has failed.\n" ); - return 1; - } - pAbc->pAbc8Aig = Ntl_ManExtract( pAbc->pAbc8Ntl ); - if ( pAbc->pAbc8Aig == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Scl(): AIG extraction has failed.\n" ); - return 1; - } - return 0; - -usage: - Abc_Print( -2, "usage: *scl [-cevh]\n" ); - Abc_Print( -2, "\t performs sequential cleanup of the netlist\n" ); - Abc_Print( -2, "\t by removing nodes and latches that do not feed into POs\n" ); - Abc_Print( -2, "\t-c : sweep stuck-at latches detected by ternary simulation [default = %s]\n", fLatchConst? "yes": "no" ); - Abc_Print( -2, "\t-e : merge equal latches (same data inputs and init states) [default = %s]\n", fLatchEqual? "yes": "no" ); - Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8Lcorr( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - Ntl_Man_t * pNtlNew, * pNtlOld; - int c; - int fScorrGia; - int fUseCSat; - int nFramesP; - int nConfMax; - int fVerbose; - - // set defaults - fScorrGia = 0; - fUseCSat = 0; - nFramesP = 0; - nConfMax = 10000; - fVerbose = 0; - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "PCncvh" ) ) != EOF ) - { - switch ( c ) - { - case 'P': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); - goto usage; - } - nFramesP = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( nFramesP < 0 ) - goto usage; - break; - case 'C': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); - goto usage; - } - nConfMax = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( nConfMax < 0 ) - goto usage; - break; - case 'n': - fScorrGia ^= 1; - break; - case 'c': - fUseCSat ^= 1; - break; - case 'v': - fVerbose ^= 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - - if ( pAbc->pAbc8Ntl == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Lcorr(): There is no design to SAT sweep.\n" ); - return 1; - } - - if ( Ntl_ManIsComb(pAbc->pAbc8Ntl) ) - { - Abc_Print( -1, "Abc_CommandAbc8Lcorr(): The network is combinational.\n" ); - return 0; - } - - // get the input file name - pNtlOld = pAbc->pAbc8Ntl; pAbc->pAbc8Ntl = NULL; - pNtlNew = Ntl_ManLcorr( pNtlOld, nConfMax, fScorrGia, fUseCSat, fVerbose ); - if ( pNtlNew == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Lcorr(): Tranformation has failed.\n" ); - return 1; - } - - Abc_FrameClearDesign(); - pAbc->pAbc8Ntl = pNtlNew; - if ( pAbc->pAbc8Ntl == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Lcorr(): Reading BLIF has failed.\n" ); - return 1; - } - pAbc->pAbc8Aig = Ntl_ManExtract( pAbc->pAbc8Ntl ); - if ( pAbc->pAbc8Aig == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Lcorr(): AIG extraction has failed.\n" ); - return 1; - } - return 0; - -usage: - Abc_Print( -2, "usage: *lcorr [-C num] [-ncvh]\n" ); - Abc_Print( -2, "\t computes latch correspondence for the netlist\n" ); -// Abc_Print( -2, "\t-P num : number of time frames to use as the prefix [default = %d]\n", nFramesP ); - Abc_Print( -2, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfMax ); - Abc_Print( -2, "\t-n : toggle using new AIG package [default = %s]\n", fScorrGia? "yes": "no" ); - Abc_Print( -2, "\t-c : toggle using new AIG package and SAT solver [default = %s]\n", fUseCSat? "yes": "no" ); - Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8Ssw( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - Ntl_Man_t * pNtlNew, * pNtlOld; - Fra_Ssw_t Pars, * pPars = &Pars; - int c; - - // set defaults - pPars->nPartSize = 0; - pPars->nOverSize = 0; - pPars->nFramesP = 0; - pPars->nFramesK = 1; - pPars->nMaxImps = 5000; - pPars->nMaxLevs = 0; - pPars->nMinDomSize = 100; - pPars->fUseImps = 0; - pPars->fRewrite = 0; - pPars->fFraiging = 0; - pPars->fLatchCorr = 0; - pPars->fWriteImps = 0; - pPars->fUse1Hot = 0; - pPars->fVerbose = 0; - pPars->TimeLimit = 0; - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "PQNFILDirfletvh" ) ) != EOF ) - { - switch ( c ) - { - case 'P': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nPartSize = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nPartSize < 2 ) - goto usage; - break; - case 'Q': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-Q\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nOverSize = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nOverSize < 0 ) - goto usage; - break; - case 'N': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nFramesP = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nFramesP < 0 ) - goto usage; - break; - case 'F': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nFramesK = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nFramesK <= 0 ) - goto usage; - break; - case 'I': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nMaxImps = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nMaxImps <= 0 ) - goto usage; - break; - case 'L': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nMaxLevs = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nMaxLevs <= 0 ) - goto usage; - break; - case 'D': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nMinDomSize = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nMinDomSize <= 0 ) - goto usage; - break; - case 'i': - pPars->fUseImps ^= 1; - break; - case 'r': - pPars->fRewrite ^= 1; - break; - case 'f': - pPars->fFraiging ^= 1; - break; - case 'l': - pPars->fLatchCorr ^= 1; - break; - case 'e': - pPars->fWriteImps ^= 1; - break; - case 't': - pPars->fUse1Hot ^= 1; - break; - case 'v': - pPars->fVerbose ^= 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - - if ( pAbc->pAbc8Ntl == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Ssw(): There is no design to SAT sweep.\n" ); - return 1; - } - - if ( Ntl_ManIsComb(pAbc->pAbc8Ntl) ) - { - Abc_Print( -1, "The network is combinational.\n" ); - return 0; - } - - if ( pPars->nFramesK > 1 && pPars->fUse1Hot ) - { - Abc_Print( -1, "Currrently can only use one-hotness for simple induction (K=1).\n" ); - return 0; - } - - if ( pPars->nFramesP && pPars->fUse1Hot ) - { - Abc_Print( -1, "Currrently can only use one-hotness without prefix.\n" ); - return 0; - } - - // get the input file name - pNtlOld = pAbc->pAbc8Ntl; pAbc->pAbc8Ntl = NULL; - pNtlNew = Ntl_ManSsw( pNtlOld, pPars ); - if ( pNtlNew == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Ssw(): Tranformation has failed.\n" ); - return 1; - } - - Abc_FrameClearDesign(); - pAbc->pAbc8Ntl = pNtlNew; - if ( pAbc->pAbc8Ntl == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Ssw(): Reading BLIF has failed.\n" ); - return 1; - } - pAbc->pAbc8Aig = Ntl_ManExtract( pAbc->pAbc8Ntl ); - if ( pAbc->pAbc8Aig == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Ssw(): AIG extraction has failed.\n" ); - return 1; - } - return 0; - -usage: - Abc_Print( -2, "usage: *ssw [-PQNFLD num] [-lrfetvh]\n" ); - Abc_Print( -2, "\t performs sequential sweep using K-step induction on the netlist \n" ); - Abc_Print( -2, "\t-P num : max partition size (0 = no partitioning) [default = %d]\n", pPars->nPartSize ); - Abc_Print( -2, "\t-Q num : partition overlap (0 = no overlap) [default = %d]\n", pPars->nOverSize ); - Abc_Print( -2, "\t-N num : number of time frames to use as the prefix [default = %d]\n", pPars->nFramesP ); - Abc_Print( -2, "\t-F num : number of time frames for induction (1=simple) [default = %d]\n", pPars->nFramesK ); - Abc_Print( -2, "\t-L num : max number of levels to consider (0=all) [default = %d]\n", pPars->nMaxLevs ); - Abc_Print( -2, "\t-D num : min size of a clock domain used for synthesis [default = %d]\n", pPars->nMinDomSize ); -// Abc_Print( -2, "\t-I num : max number of implications to consider [default = %d]\n", pPars->nMaxImps ); -// Abc_Print( -2, "\t-i : toggle using implications [default = %s]\n", pPars->fUseImps? "yes": "no" ); - Abc_Print( -2, "\t-l : toggle latch correspondence only [default = %s]\n", pPars->fLatchCorr? "yes": "no" ); - Abc_Print( -2, "\t-r : toggle AIG rewriting [default = %s]\n", pPars->fRewrite? "yes": "no" ); - Abc_Print( -2, "\t-f : toggle fraiging (combinational SAT sweeping) [default = %s]\n", pPars->fFraiging? "yes": "no" ); - Abc_Print( -2, "\t-e : toggle writing implications as assertions [default = %s]\n", pPars->fWriteImps? "yes": "no" ); - Abc_Print( -2, "\t-t : toggle using one-hotness conditions [default = %s]\n", pPars->fUse1Hot? "yes": "no" ); - Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8Scorr( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - Ntl_Man_t * pNtlNew, * pNtlOld; - Ssw_Pars_t Pars, * pPars = &Pars; - int c; - - // set defaults - Ssw_ManSetDefaultParams( pPars ); - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "PQFCLSDVMpldsncvh" ) ) != EOF ) - { - switch ( c ) - { - case 'P': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nPartSize = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nPartSize < 2 ) - goto usage; - break; - case 'Q': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-Q\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nOverSize = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nOverSize < 0 ) - goto usage; - break; - case 'F': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nFramesK = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nFramesK <= 0 ) - goto usage; - break; - case 'C': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nBTLimit = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nBTLimit <= 0 ) - goto usage; - break; - case 'L': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nMaxLevs = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nMaxLevs <= 0 ) - goto usage; - break; - case 'S': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nFramesAddSim = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nFramesAddSim < 0 ) - goto usage; - break; - case 'D': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nMinDomSize = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nMinDomSize < 0 ) - goto usage; - break; - case 'V': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-V\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nSatVarMax2 = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nSatVarMax2 < 0 ) - goto usage; - break; - case 'M': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nRecycleCalls2 = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nRecycleCalls2 < 0 ) - goto usage; - break; - case 'p': - pPars->fPolarFlip ^= 1; - break; - case 'l': - pPars->fLatchCorr ^= 1; - break; - case 'd': - pPars->fDynamic ^= 1; - break; - case 's': - pPars->fLocalSim ^= 1; - break; - case 'n': - pPars->fScorrGia ^= 1; - break; - case 'c': - pPars->fUseCSat ^= 1; - break; - case 'v': - pPars->fVerbose ^= 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - - if ( pAbc->pAbc8Ntl == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Ssw(): There is no design to SAT sweep.\n" ); - return 1; - } - - if ( Ntl_ManIsComb(pAbc->pAbc8Ntl) ) - { - Abc_Print( -1, "The network is combinational.\n" ); - return 0; - } - - if ( pPars->fDynamic && (pPars->nPartSize || pPars->nOverSize) ) - { - pPars->nPartSize = 0; - pPars->nOverSize = 0; - Abc_Print( -1, "With dynamic partitioning (-d) enabled, static one (-P <num> -Q <num>) is ignored.\n" ); - } - - // get the input file name - pNtlOld = pAbc->pAbc8Ntl; pAbc->pAbc8Ntl = NULL; - pNtlNew = Ntl_ManScorr( pNtlOld, pPars ); - if ( pNtlNew == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Scorr(): Tranformation has failed.\n" ); - return 1; - } - - Abc_FrameClearDesign(); - pAbc->pAbc8Ntl = pNtlNew; - if ( pAbc->pAbc8Ntl == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Scorr(): Reading BLIF has failed.\n" ); - return 1; - } - pAbc->pAbc8Aig = Ntl_ManExtract( pAbc->pAbc8Ntl ); - if ( pAbc->pAbc8Aig == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Scorr(): AIG extraction has failed.\n" ); - return 1; - } - return 0; - -usage: - Abc_Print( -2, "usage: *scorr [-PQFCLSDVM num] [-pldsncvh]\n" ); - Abc_Print( -2, "\t performs sequential sweep using K-step induction\n" ); - Abc_Print( -2, "\t-P num : max partition size (0 = no partitioning) [default = %d]\n", pPars->nPartSize ); - Abc_Print( -2, "\t-Q num : partition overlap (0 = no overlap) [default = %d]\n", pPars->nOverSize ); - Abc_Print( -2, "\t-F num : number of time frames for induction (1=simple) [default = %d]\n", pPars->nFramesK ); - Abc_Print( -2, "\t-C num : max number of conflicts at a node (0=inifinite) [default = %d]\n", pPars->nBTLimit ); - Abc_Print( -2, "\t-L num : max number of levels to consider (0=all) [default = %d]\n", pPars->nMaxLevs ); - Abc_Print( -2, "\t-S num : additional simulation frames for c-examples (0=none) [default = %d]\n", pPars->nFramesAddSim ); - Abc_Print( -2, "\t-D num : min size of a clock domain used for synthesis [default = %d]\n", pPars->nMinDomSize ); - Abc_Print( -2, "\t-V num : min var num needed to recycle the SAT solver [default = %d]\n", pPars->nSatVarMax2 ); - Abc_Print( -2, "\t-M num : min call num needed to recycle the SAT solver [default = %d]\n", pPars->nRecycleCalls2 ); - Abc_Print( -2, "\t-p : toggle alighning polarity of SAT variables [default = %s]\n", pPars->fPolarFlip? "yes": "no" ); - Abc_Print( -2, "\t-l : toggle latch correspondence only [default = %s]\n", pPars->fLatchCorr? "yes": "no" ); - Abc_Print( -2, "\t-d : toggle dynamic addition of constraints [default = %s]\n", pPars->fDynamic? "yes": "no" ); - Abc_Print( -2, "\t-s : toggle local simulation in the cone of influence [default = %s]\n", pPars->fLocalSim? "yes": "no" ); - Abc_Print( -2, "\t-n : toggle using new AIG package [default = %s]\n", pPars->fScorrGia? "yes": "no" ); - Abc_Print( -2, "\t-c : toggle using new AIG package and SAT solver [default = %s]\n", pPars->fUseCSat? "yes": "no" ); - Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8Sweep( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - Ntl_Man_t * pNtlTemp; - int Counter; - int fMapped; - int fVerbose; - int c; - - // set defaults - fMapped = 0; - fVerbose = 0; - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "mvh" ) ) != EOF ) - { - switch ( c ) - { - case 'm': - fMapped ^= 1; - break; - case 'v': - fVerbose ^= 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - if ( pAbc->pAbc8Ntl == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Sweep(): There is no design to sweep.\n" ); - return 1; - } - - // if mapped, insert the network - if ( fMapped ) - { - if ( pAbc->pAbc8Nwk == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Sweep(): There is no mapped network to sweep.\n" ); - return 1; - } - pNtlTemp = Ntl_ManInsertNtk( pAbc->pAbc8Ntl, pAbc->pAbc8Nwk ); - if ( pNtlTemp == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Sweep(): Inserting mapped network has failed.\n" ); - return 1; - } - Abc_FrameClearDesign(); - pAbc->pAbc8Ntl = pNtlTemp; - } - - // sweep the current design - Counter = Ntl_ManSweep( pAbc->pAbc8Ntl, fVerbose ); - if ( Counter == 0 && fVerbose ) - Abc_Print( -1, "The netlist is unchanged by sweep.\n" ); - - // if mapped, create new AIG and new mapped network - if ( fMapped ) - { - pAbc->pAbc8Aig = Ntl_ManExtract( pAbc->pAbc8Ntl ); - if ( pAbc->pAbc8Aig == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Sweep(): AIG extraction has failed.\n" ); - return 1; - } - pAbc->pAbc8Nwk = Ntl_ManExtractNwk( pAbc->pAbc8Ntl, pAbc->pAbc8Aig, NULL ); - if ( pAbc->pAbc8Nwk == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Sweep(): Failed to extract the mapped network.\n" ); - return 1; - } - } - else // remove old AIG/mapped and create new AIG - { - pNtlTemp = pAbc->pAbc8Ntl; pAbc->pAbc8Ntl = NULL; - Abc_FrameClearDesign(); - pAbc->pAbc8Ntl = pNtlTemp; - // extract new AIG - pAbc->pAbc8Aig = Ntl_ManExtract( pAbc->pAbc8Ntl ); - if ( pAbc->pAbc8Aig == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Sweep(): AIG extraction has failed.\n" ); - return 1; - } - } - return 0; - -usage: - Abc_Print( -2, "usage: *sw [-mvh]\n" ); - Abc_Print( -2, "\t performs structural sweep of the netlist\n" ); - Abc_Print( -2, "\t removes dangling nodes, registers, and white-boxes\n" ); - Abc_Print( -2, "\t-m : inserts mapped network into netlist and sweeps it [default = %s]\n", fMapped? "yes": "no" ); - Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8Zero( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - Ntl_Man_t * pNtlNew; - int fVerbose; - int c; - - // set defaults - fVerbose = 0; - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF ) - { - switch ( c ) - { - case 'v': - fVerbose ^= 1; - break; - case 'h': - goto usage; - default: - goto usage; - } - } - if ( pAbc->pAbc8Ntl == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Zero(): There is no design to convert.\n" ); - return 1; - } - - // transform the registers - pNtlNew = pAbc->pAbc8Ntl; - pAbc->pAbc8Ntl = NULL; - Ntl_ManTransformInitValues( pNtlNew ); - - // replace the design - Abc_FrameClearDesign(); - pAbc->pAbc8Ntl = pNtlNew; - return 0; - -usage: - Abc_Print( -2, "usage: *zero [-h]\n" ); - Abc_Print( -2, "\t converts registers to have constant-0 initial value\n" ); - Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8Cec( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - Aig_Man_t * pAig1, * pAig2; - Ntl_Man_t * pTemp1, * pTemp2; - char ** pArgvNew; - int nArgcNew; - int c; - int fVerbose; - int nConfLimit; - int fSmart; - int nPartSize; - extern int Fra_FraigCecTop( Aig_Man_t * pMan1, Aig_Man_t * pMan2, int nConfLimit, int nPartSize, int fSmart, int fVerbose ); - - // set defaults - nConfLimit = 100000; - nPartSize = 100; - fSmart = 0; - fVerbose = 0; - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "CPsvh" ) ) != EOF ) - { - switch ( c ) - { - case 'C': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); - goto usage; - } - nConfLimit = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( nConfLimit < 0 ) - goto usage; - break; - case 'P': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); - goto usage; - } - nPartSize = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( nPartSize < 0 ) - goto usage; - break; - case 's': - fSmart ^= 1; - break; - case 'v': - fVerbose ^= 1; - break; - default: - goto usage; - } - } - - pArgvNew = argv + globalUtilOptind; - nArgcNew = argc - globalUtilOptind; - if ( nArgcNew != 0 && nArgcNew != 2 ) - { - Abc_Print( -1, "Currently can only compare current mapped network against the spec, or designs derived from two files.\n" ); - return 0; - } - if ( nArgcNew == 2 ) - { - Ntl_ManPrepareCec( pArgvNew[0], pArgvNew[1], &pAig1, &pAig2 ); - if ( !pAig1 || !pAig2 ) - return 1; - Fra_FraigCecTop( pAig1, pAig2, nConfLimit, nPartSize, fSmart, fVerbose ); - Aig_ManStop( pAig1 ); - Aig_ManStop( pAig2 ); - return 0; - } - - if ( pAbc->pAbc8Ntl == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Cec(): There is no design to verify.\n" ); - return 1; - } - if ( pAbc->pAbc8Nwk == NULL ) - { - Abc_Print( -1, "Abc_CommandAbc8Cec(): There is no mapped network to verify.\n" ); - return 1; - } -// Abc_Print( -1, "Currently *cec works only for two designs given on command line.\n" ); - - // insert the mapped network - pTemp1 = Ntl_ManDup( pAbc->pAbc8Ntl ); - pTemp2 = Ntl_ManInsertNtk( pAbc->pAbc8Ntl, pAbc->pAbc8Nwk ); - if ( pTemp2 == NULL ) - { - Ntl_ManFree( pTemp1 ); - Abc_Print( -1, "Abc_CommandAbc8Cec(): Inserting the design has failed.\n" ); - return 1; - } - Ntl_ManPrepareCecMans( pTemp1, pTemp2, &pAig1, &pAig2 ); - Ntl_ManFree( pTemp1 ); - Ntl_ManFree( pTemp2 ); - if ( !pAig1 || !pAig2 ) - return 1; - Fra_FraigCecTop( pAig1, pAig2, nConfLimit, nPartSize, fSmart, fVerbose ); - Aig_ManStop( pAig1 ); - Aig_ManStop( pAig2 ); - return 0; - -usage: - Abc_Print( -2, "usage: *cec [-C num] [-P num] [-svh] <file1> <file2>\n" ); - Abc_Print( -2, "\t performs combinational equivalence checking\n" ); - Abc_Print( -2, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfLimit ); - Abc_Print( -2, "\t-P num : the partition size for partitioned CEC [default = %d]\n", nPartSize ); - Abc_Print( -2, "\t-s : toggle smart and natural output partitioning [default = %s]\n", fSmart? "smart": "natural" ); - Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - Abc_Print( -2, "\tfile1 : (optional) the file with the first network\n"); - Abc_Print( -2, "\tfile2 : (optional) the file with the second network\n"); - Abc_Print( -2, "\t if no files are given, uses the current network and its spec\n"); - Abc_Print( -2, "\t if two files are given, compares designs derived from files\n"); - return 1; -} - -/**Function************************************************************* - - Synopsis [] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Abc_CommandAbc8DSec( Abc_Frame_t * pAbc, int argc, char ** argv ) -{ - Fra_Sec_t SecPar, * pSecPar = &SecPar; - Aig_Man_t * pAig; - char ** pArgvNew; - int nArgcNew; - int c; - - extern void Fra_SecSetDefaultParams( Fra_Sec_t * pSecPar ); - extern int Fra_FraigSec( Aig_Man_t * p, Fra_Sec_t * pSecPar, Aig_Man_t ** ppResult ); - - // set defaults - Fra_SecSetDefaultParams( pSecPar ); - pSecPar->nFramesMax = 4; - pSecPar->fPhaseAbstract = 0; - pSecPar->fRetimeFirst = 0; - pSecPar->fRetimeRegs = 0; - Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "Farmfwvh" ) ) != EOF ) - { - switch ( c ) - { - case 'F': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); - goto usage; - } - pSecPar->nFramesMax = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pSecPar->nFramesMax < 0 ) - goto usage; - break; - case 'a': - pSecPar->fPhaseAbstract ^= 1; - break; - case 'r': - pSecPar->fRetimeFirst ^= 1; - break; - case 'm': - pSecPar->fRetimeRegs ^= 1; - break; - case 'f': - pSecPar->fFraiging ^= 1; - break; - case 'w': - pSecPar->fVeryVerbose ^= 1; - break; - case 'v': - pSecPar->fVerbose ^= 1; - break; - default: - goto usage; - } - } - - pArgvNew = argv + globalUtilOptind; - nArgcNew = argc - globalUtilOptind; - if ( nArgcNew != 2 ) - { - Abc_Print( -1, "Only works for two designs written from files specified on the command line.\n" ); - return 1; - } - - pAig = Ntl_ManPrepareSec( pArgvNew[0], pArgvNew[1] ); - if ( pAig == NULL ) - return 0; - Fra_FraigSec( pAig, pSecPar, NULL ); - Aig_ManStop( pAig ); - return 0; - -usage: - Abc_Print( -2, "usage: *dsec [-F num] [-armfwvh] <file1> <file2>\n" ); - Abc_Print( -2, "\t performs sequential equivalence checking for two designs\n" ); - Abc_Print( -2, "\t-F num : the limit on the depth of induction [default = %d]\n", pSecPar->nFramesMax ); - Abc_Print( -2, "\t-a : toggles the use of phase abstraction [default = %s]\n", pSecPar->fPhaseAbstract? "yes": "no" ); - Abc_Print( -2, "\t-r : toggles forward retiming at the beginning [default = %s]\n", pSecPar->fRetimeFirst? "yes": "no" ); - Abc_Print( -2, "\t-m : toggles min-register retiming [default = %s]\n", pSecPar->fRetimeRegs? "yes": "no" ); - Abc_Print( -2, "\t-f : toggles the internal use of fraiging [default = %s]\n", pSecPar->fFraiging? "yes": "no" ); - Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", pSecPar->fVerbose? "yes": "no" ); - Abc_Print( -2, "\t-w : toggles additional verbose output [default = %s]\n", pSecPar->fVeryVerbose? "yes": "no" ); - Abc_Print( -2, "\t-h : print the command usage\n"); - Abc_Print( -2, "\tfile1 : the file with the first design\n"); - Abc_Print( -2, "\tfile2 : the file with the second design\n"); -// Abc_Print( -2, "\t if no files are given, uses the current network and its spec\n"); -// Abc_Print( -2, "\t if one file is given, uses the current network and the file\n"); - return 1; -} - - /**Function************************************************************* Synopsis [] @@ -24791,7 +21607,7 @@ int Abc_CommandAbc9Put( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_NtkForEachCi( pNtk, pObj, i ) { if (i < Vec_PtrSize(pAbc->pGia->vNamesIn)) { Nm_ManDeleteIdName(pNtk->pManName, pObj->Id); - Abc_ObjAssignName( pObj, Vec_PtrEntry(pAbc->pGia->vNamesIn, i), NULL ); + Abc_ObjAssignName( pObj, (char *)Vec_PtrEntry(pAbc->pGia->vNamesIn, i), NULL ); } } } @@ -28188,14 +25004,14 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv ) int c; extern void Gia_ManSetIfParsDefault( If_Par_t * pPars ); extern int Gia_MappingIf( Gia_Man_t * p, If_Par_t * pPars ); - if ( pAbc->pAbc8Lib == NULL ) - { - Abc_Print( -1, "LUT library is not given. Using default LUT library.\n" ); - pAbc->pAbc8Lib = If_SetSimpleLutLib( 6 ); - } // set defaults Gia_ManSetIfParsDefault( pPars ); - pPars->pLutLib = pAbc->pAbc8Lib; +// if ( pAbc->pAbc8Lib == NULL ) +// { +// Abc_Print( -1, "LUT library is not given. Using default LUT library.\n" ); +// pAbc->pAbc8Lib = If_SetSimpleLutLib( 6 ); +// } +// pPars->pLutLib = pAbc->pAbc8Lib; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "KCFADEqaflepmrsdbvh" ) ) != EOF ) { |