diff options
Diffstat (limited to 'src/base/abci')
-rw-r--r-- | src/base/abci/abc.c | 146 | ||||
-rw-r--r-- | src/base/abci/abcPrint.c | 44 |
2 files changed, 159 insertions, 31 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 556828cb..cf574ecb 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -293,6 +293,8 @@ static int Abc_CommandAbc9Equiv ( Abc_Frame_t * pAbc, int argc, char ** arg static int Abc_CommandAbc9Semi ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Times ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Frames ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandAbc9Retime ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandAbc9Enable ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Miter ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Scl ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Sat ( Abc_Frame_t * pAbc, int argc, char ** argv ); @@ -604,6 +606,8 @@ void Abc_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "AIG", "&semi", Abc_CommandAbc9Semi, 0 ); Cmd_CommandAdd( pAbc, "AIG", "×", Abc_CommandAbc9Times, 0 ); Cmd_CommandAdd( pAbc, "AIG", "&frames", Abc_CommandAbc9Frames, 0 ); + Cmd_CommandAdd( pAbc, "AIG", "&retime", Abc_CommandAbc9Retime, 0 ); + Cmd_CommandAdd( pAbc, "AIG", "&enable", Abc_CommandAbc9Enable, 0 ); Cmd_CommandAdd( pAbc, "AIG", "&miter", Abc_CommandAbc9Miter, 0 ); Cmd_CommandAdd( pAbc, "AIG", "&scl", Abc_CommandAbc9Scl, 0 ); Cmd_CommandAdd( pAbc, "AIG", "&sat", Abc_CommandAbc9Sat, 0 ); @@ -22899,7 +22903,7 @@ int Abc_CommandAbc9Frames( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pAbc->pAig == NULL ) { - printf( "Abc_CommandAbc9Times(): There is no AIG.\n" ); + printf( "Abc_CommandAbc9Frames(): There is no AIG.\n" ); return 1; } if ( nCofFanLit ) @@ -22931,6 +22935,121 @@ usage: SeeAlso [] ***********************************************************************/ +int Abc_CommandAbc9Retime( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + Gia_Man_t * pTemp; + int c; + int nMaxIters = 100; + int fVerbose = 0; + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "Nvh" ) ) != EOF ) + { + switch ( c ) + { + case 'N': + if ( globalUtilOptind >= argc ) + { + fprintf( stdout, "Command line switch \"-N\" should be followed by an integer.\n" ); + goto usage; + } + nMaxIters = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nMaxIters < 0 ) + goto usage; + break; + case 'v': + fVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + if ( pAbc->pAig == NULL ) + { + printf( "Abc_CommandAbc9Retime(): There is no AIG.\n" ); + return 1; + } + pAbc->pAig = Gia_ManRetimeForward( pTemp = pAbc->pAig, nMaxIters, fVerbose ); + Gia_ManStop( pTemp ); + return 0; + +usage: + fprintf( stdout, "usage: &retime [-N <num>] [-vh]\n" ); + fprintf( stdout, "\t performs most-forward retiming\n" ); + fprintf( stdout, "\t-N num : the number of incremental iterations [default = %d]\n", nMaxIters ); + fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + fprintf( stdout, "\t-h : print the command usage\n"); + return 1; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandAbc9Enable( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + Gia_Man_t * pTemp; + int c; + int fRemove = 0; + int fVerbose = 0; + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "rvh" ) ) != EOF ) + { + switch ( c ) + { + case 'r': + fRemove ^= 1; + break; + case 'v': + fVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + if ( pAbc->pAig == NULL ) + { + printf( "Abc_CommandAbc9Enable(): There is no AIG.\n" ); + return 1; + } + if ( fRemove ) + pAbc->pAig = Gia_ManRemoveEnables( pTemp = pAbc->pAig ); + else + pAbc->pAig = Gia_ManDupSelf( pTemp = pAbc->pAig ); + Gia_ManStop( pTemp ); + return 0; + +usage: + fprintf( stdout, "usage: &enable [-rvh]\n" ); + fprintf( stdout, "\t adds or removes flop enable signals\n" ); + fprintf( stdout, "\t-r : toggle adding vs. removing enables [default = %s]\n", fRemove? "remove": "add" ); + fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + fprintf( stdout, "\t-h : print the command usage\n"); + return 1; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ int Abc_CommandAbc9Miter( Abc_Frame_t * pAbc, int argc, char ** argv ) { FILE * pFile; @@ -23047,7 +23166,10 @@ usage: int Abc_CommandAbc9Scl( Abc_Frame_t * pAbc, int argc, char ** argv ) { Gia_Man_t * pTemp; - int c, fConst = 1, fEquiv = 1, fVerbose = 1; + int c; + int fConst = 1; + int fEquiv = 1; + int fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "cevh" ) ) != EOF ) { @@ -23071,9 +23193,6 @@ int Abc_CommandAbc9Scl( Abc_Frame_t * pAbc, int argc, char ** argv ) printf( "Abc_CommandAbc9Scl(): There is no AIG.\n" ); return 1; } - printf( "Implementation of this command is not finished.\n" ); - return 0; - pAbc->pAig = Gia_ManSeqStructSweep( pTemp = pAbc->pAig, fConst, fEquiv, fVerbose ); Gia_ManStop( pTemp ); return 0; @@ -23953,14 +24072,18 @@ int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv ) { Gia_Man_t * pTemp = NULL; int c, fVerbose = 0; + int fSwitch = 0; extern void Gia_SatSolveTest( Gia_Man_t * p ); extern void Cbs_ManSolveTest( Gia_Man_t * pGia ); Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "svh" ) ) != EOF ) { switch ( c ) { + case 's': + fSwitch ^= 1; + break; case 'v': fVerbose ^= 1; break; @@ -23982,14 +24105,19 @@ int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv ) // Gia_SatSolveTest( pAbc->pAig ); // For_ManExperiment( pAbc->pAig, 20, 1, 1 ); // Gia_ManUnrollSpecial( pAbc->pAig, 5, 100, 1 ); -// pAbc->pAig = Gia_ManDupSelf( pTemp = pAbc->pAig ); -// Gia_ManStop( pTemp ); + + if ( fSwitch ) + pAbc->pAig = Gia_ManDupSelf( pTemp = pAbc->pAig ); + else + pAbc->pAig = Gia_ManRemoveEnables( pTemp = pAbc->pAig ); + Gia_ManStop( pTemp ); // Cbs_ManSolveTest( pAbc->pAig ); return 0; usage: - fprintf( stdout, "usage: &test [-vh]\n" ); + fprintf( stdout, "usage: &test [-svh]\n" ); fprintf( stdout, "\t testing various procedures\n" ); + fprintf( stdout, "\t-s : toggle enable (yes) vs. disable (no) [default = %s]\n", fSwitch? "yes": "no" ); fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); fprintf( stdout, "\t-h : print the command usage\n"); return 1; diff --git a/src/base/abci/abcPrint.c b/src/base/abci/abcPrint.c index 50b0c749..b869f067 100644 --- a/src/base/abci/abcPrint.c +++ b/src/base/abci/abcPrint.c @@ -174,20 +174,20 @@ void Abc_NtkPrintStats( FILE * pFile, Abc_Ntk_t * pNtk, int fFactored, int fSave fprintf( pFile, "%-13s:", pNtk->pName ); if ( Abc_NtkAssertNum(pNtk) ) - fprintf( pFile, " i/o/a = %5d/%5d/%5d", Abc_NtkPiNum(pNtk), Abc_NtkPoNum(pNtk), Abc_NtkAssertNum(pNtk) ); + fprintf( pFile, " i/o/a =%5d/%5d/%5d", Abc_NtkPiNum(pNtk), Abc_NtkPoNum(pNtk), Abc_NtkAssertNum(pNtk) ); else - fprintf( pFile, " i/o = %5d/%5d", Abc_NtkPiNum(pNtk), Abc_NtkPoNum(pNtk) ); - fprintf( pFile, " lat = %4d", Abc_NtkLatchNum(pNtk) ); + fprintf( pFile, " i/o =%5d/%5d", Abc_NtkPiNum(pNtk), Abc_NtkPoNum(pNtk) ); + fprintf( pFile, " lat =%5d", Abc_NtkLatchNum(pNtk) ); if ( Abc_NtkIsNetlist(pNtk) ) { - fprintf( pFile, " net = %5d", Abc_NtkNetNum(pNtk) ); - fprintf( pFile, " nd = %5d", Abc_NtkNodeNum(pNtk) ); - fprintf( pFile, " wbox = %3d", Abc_NtkWhiteboxNum(pNtk) ); - fprintf( pFile, " bbox = %3d", Abc_NtkBlackboxNum(pNtk) ); + fprintf( pFile, " net =%5d", Abc_NtkNetNum(pNtk) ); + fprintf( pFile, " nd =%5d", Abc_NtkNodeNum(pNtk) ); + fprintf( pFile, " wbox =%3d", Abc_NtkWhiteboxNum(pNtk) ); + fprintf( pFile, " bbox =%3d", Abc_NtkBlackboxNum(pNtk) ); } else if ( Abc_NtkIsStrash(pNtk) ) { - fprintf( pFile, " and = %5d", Abc_NtkNodeNum(pNtk) ); + fprintf( pFile, " and =%7d", Abc_NtkNodeNum(pNtk) ); if ( (Num = Abc_NtkGetChoiceNum(pNtk)) ) fprintf( pFile, " (choice = %d)", Num ); if ( fPrintMuxes ) @@ -201,8 +201,8 @@ void Abc_NtkPrintStats( FILE * pFile, Abc_Ntk_t * pNtk, int fFactored, int fSave } else { - fprintf( pFile, " nd = %5d", Abc_NtkNodeNum(pNtk) ); - fprintf( pFile, " edge = %6d", Abc_NtkGetTotalFanins(pNtk) ); + fprintf( pFile, " nd =%6d", Abc_NtkNodeNum(pNtk) ); + fprintf( pFile, " edge =%7d", Abc_NtkGetTotalFanins(pNtk) ); } if ( Abc_NtkIsStrash(pNtk) || Abc_NtkIsNetlist(pNtk) ) @@ -211,19 +211,19 @@ void Abc_NtkPrintStats( FILE * pFile, Abc_Ntk_t * pNtk, int fFactored, int fSave else if ( Abc_NtkHasSop(pNtk) ) { - fprintf( pFile, " cube = %5d", Abc_NtkGetCubeNum(pNtk) ); + fprintf( pFile, " cube =%6d", Abc_NtkGetCubeNum(pNtk) ); // fprintf( pFile, " lit(sop) = %5d", Abc_NtkGetLitNum(pNtk) ); if ( fFactored ) - fprintf( pFile, " lit(fac) = %5d", Abc_NtkGetLitFactNum(pNtk) ); + fprintf( pFile, " lit(fac) =%6d", Abc_NtkGetLitFactNum(pNtk) ); } else if ( Abc_NtkHasAig(pNtk) ) - fprintf( pFile, " aig = %5d", Abc_NtkGetAigNodeNum(pNtk) ); + fprintf( pFile, " aig =%6d", Abc_NtkGetAigNodeNum(pNtk) ); else if ( Abc_NtkHasBdd(pNtk) ) - fprintf( pFile, " bdd = %5d", Abc_NtkGetBddNodeNum(pNtk) ); + fprintf( pFile, " bdd =%6d", Abc_NtkGetBddNodeNum(pNtk) ); else if ( Abc_NtkHasMapping(pNtk) ) { - fprintf( pFile, " area = %5.2f", Abc_NtkGetMappedArea(pNtk) ); - fprintf( pFile, " delay = %5.2f", Abc_NtkDelayTrace(pNtk) ); + fprintf( pFile, " area =%5.2f", Abc_NtkGetMappedArea(pNtk) ); + fprintf( pFile, " delay =%5.2f", Abc_NtkDelayTrace(pNtk) ); } else if ( !Abc_NtkHasBlackbox(pNtk) ) { @@ -233,28 +233,28 @@ void Abc_NtkPrintStats( FILE * pFile, Abc_Ntk_t * pNtk, int fFactored, int fSave if ( Abc_NtkIsStrash(pNtk) ) { extern int Abc_NtkGetMultiRefNum( Abc_Ntk_t * pNtk ); - fprintf( pFile, " lev = %3d", Abc_AigLevel(pNtk) ); + fprintf( pFile, " lev =%3d", Abc_AigLevel(pNtk) ); // fprintf( pFile, " ff = %5d", Abc_NtkNodeNum(pNtk) + 2 * (Abc_NtkCoNum(pNtk)+Abc_NtkGetMultiRefNum(pNtk)) ); // fprintf( pFile, " var = %5d", Abc_NtkCiNum(pNtk) + Abc_NtkCoNum(pNtk)+Abc_NtkGetMultiRefNum(pNtk) ); } else - fprintf( pFile, " lev = %3d", Abc_NtkLevel(pNtk) ); + fprintf( pFile, " lev =%3d", Abc_NtkLevel(pNtk) ); if ( fUseLutLib && Abc_FrameReadLibLut() ) - fprintf( pFile, " delay = %5.2f", Abc_NtkDelayTraceLut(pNtk, 1) ); + fprintf( pFile, " delay =%5.2f", Abc_NtkDelayTraceLut(pNtk, 1) ); if ( fPower ) - fprintf( pFile, " power = %7.2f", Abc_NtkMfsTotalSwitching(pNtk) ); + fprintf( pFile, " power =%7.2f", Abc_NtkMfsTotalSwitching(pNtk) ); if ( fGlitch ) { extern float Abc_NtkMfsTotalGlitching( Abc_Ntk_t * pNtk ); if ( Abc_NtkIsLogic(pNtk) && Abc_NtkGetFaninMax(pNtk) <= 6 ) - fprintf( pFile, " glitch = %7.2f %%", Abc_NtkMfsTotalGlitching(pNtk) ); + fprintf( pFile, " glitch =%7.2f %%", Abc_NtkMfsTotalGlitching(pNtk) ); else printf( "\nCurrently computes glitching only for K-LUT networks with K <= 6." ); } fprintf( pFile, "\n" ); { - extern int Abc_NtkPrintSubraphSizes( Abc_Ntk_t * pNtk ); +// extern int Abc_NtkPrintSubraphSizes( Abc_Ntk_t * pNtk ); // Abc_NtkPrintSubraphSizes( pNtk ); } |