diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2005-11-30 08:01:00 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2005-11-30 08:01:00 -0800 |
commit | 53c4fffa04d471827119bdebd7ab0426f1c4555a (patch) | |
tree | ef1d7a64a30953d5f4a19fead7cea332cd979612 /src/base/abci | |
parent | 5e0f86a2c9bdc773251db2b741b7b051cc4a147a (diff) | |
download | abc-53c4fffa04d471827119bdebd7ab0426f1c4555a.tar.gz abc-53c4fffa04d471827119bdebd7ab0426f1c4555a.tar.bz2 abc-53c4fffa04d471827119bdebd7ab0426f1c4555a.zip |
Version abc51130
Diffstat (limited to 'src/base/abci')
-rw-r--r-- | src/base/abci/abc.c | 72 | ||||
-rw-r--r-- | src/base/abci/abcPrint.c | 51 | ||||
-rw-r--r-- | src/base/abci/abcSweep.c | 34 |
3 files changed, 143 insertions, 14 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 91adbabc..9abb75e8 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -102,6 +102,7 @@ static int Abc_CommandRetime ( Abc_Frame_t * pAbc, int argc, char ** argv static int Abc_CommandSeqFpga ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSeqMap ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSeqSweep ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandSeqCleanup ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandCec ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSec ( Abc_Frame_t * pAbc, int argc, char ** argv ); @@ -195,7 +196,8 @@ void Abc_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "Sequential", "retime", Abc_CommandRetime, 1 ); Cmd_CommandAdd( pAbc, "Sequential", "sfpga", Abc_CommandSeqFpga, 1 ); Cmd_CommandAdd( pAbc, "Sequential", "smap", Abc_CommandSeqMap, 1 ); - Cmd_CommandAdd( pAbc, "Sequential", "seq_sweep", Abc_CommandSeqSweep, 1 ); + Cmd_CommandAdd( pAbc, "Sequential", "ssweep", Abc_CommandSeqSweep, 1 ); + Cmd_CommandAdd( pAbc, "Sequential", "scleanup", Abc_CommandSeqCleanup, 1 ); Cmd_CommandAdd( pAbc, "Verification", "cec", Abc_CommandCec, 0 ); Cmd_CommandAdd( pAbc, "Verification", "sec", Abc_CommandSec, 0 ); @@ -1299,7 +1301,7 @@ int Abc_CommandShowNtk( Abc_Frame_t * pAbc, int argc, char ** argv ) { switch ( c ) { - case 'n': + case 'g': fGateNames ^= 1; break; default: @@ -1716,7 +1718,7 @@ int Abc_CommandCleanup( Abc_Frame_t * pAbc, int argc, char ** argv ) return 1; } // modify the current network - Abc_NtkCleanup( pNtk, 0 ); + Abc_NtkCleanup( pNtk, 1 ); return 0; usage: @@ -5132,7 +5134,7 @@ int Abc_CommandRetime( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtkRes == NULL ) { fprintf( pErr, "Retiming has failed.\n" ); - return 1; + return 0; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); @@ -5208,12 +5210,14 @@ int Abc_CommandSeqFpga( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( Abc_NtkHasAig(pNtk) ) { +/* // quit if there are choice nodes if ( Abc_NtkGetChoiceNum(pNtk) ) { fprintf( pErr, "Currently cannot map/retime networks with choice nodes.\n" ); return 0; } +*/ if ( Abc_NtkIsStrash(pNtk) ) pNtkNew = Abc_NtkAigToSeq(pNtk); else @@ -5330,12 +5334,14 @@ int Abc_CommandSeqMap( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( Abc_NtkHasAig(pNtk) ) { +/* // quit if there are choice nodes if ( Abc_NtkGetChoiceNum(pNtk) ) { fprintf( pErr, "Currently cannot map/retime networks with choice nodes.\n" ); return 0; } +*/ if ( Abc_NtkIsStrash(pNtk) ) pNtkNew = Abc_NtkAigToSeq(pNtk); else @@ -5377,7 +5383,7 @@ int Abc_CommandSeqMap( Abc_Frame_t * pAbc, int argc, char ** argv ) { fprintf( pErr, "Sequential FPGA mapping has failed.\n" ); Abc_NtkDelete( pNtkNew ); - return 1; + return 0; } Abc_NtkDelete( pNtkNew ); @@ -5497,7 +5503,7 @@ int Abc_CommandSeqSweep( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: seq_sweep [-F num] [-eivh]\n" ); + fprintf( pErr, "usage: ssweep [-F num] [-eivh]\n" ); fprintf( pErr, "\t performs sequential sweep using van Eijk's method\n" ); fprintf( pErr, "\t-F num : number of time frames in the base case [default = %d]\n", nFrames ); fprintf( pErr, "\t-e : toggle writing EXDC network [default = %s]\n", fExdc? "yes": "no" ); @@ -5507,6 +5513,60 @@ usage: return 1; } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandSeqCleanup( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + FILE * pOut, * pErr; + Abc_Ntk_t * pNtk; + int c; + + pNtk = Abc_FrameReadNet(pAbc); + pOut = Abc_FrameReadOut(pAbc); + pErr = Abc_FrameReadErr(pAbc); + + // set defaults + util_getopt_reset(); + while ( ( c = util_getopt( argc, argv, "h" ) ) != EOF ) + { + switch ( c ) + { + case 'h': + goto usage; + default: + goto usage; + } + } + if ( pNtk == NULL ) + { + fprintf( pErr, "Empty network.\n" ); + return 1; + } + if ( !Abc_NtkIsSeq(pNtk) ) + { + fprintf( pErr, "Only works for sequential AIGs.\n" ); + return 1; + } + // modify the current network + Seq_NtkCleanup( pNtk, 1 ); + return 0; + +usage: + fprintf( pErr, "usage: scleanup [-h]\n" ); + fprintf( pErr, "\t performs sequential cleanup\n" ); + fprintf( pErr, "\t-h : print the command usage\n"); + return 1; +} + /**Function************************************************************* diff --git a/src/base/abci/abcPrint.c b/src/base/abci/abcPrint.c index 4b4c01ae..dc79208e 100644 --- a/src/base/abci/abcPrint.c +++ b/src/base/abci/abcPrint.c @@ -96,6 +96,57 @@ void Abc_NtkPrintStats( FILE * pFile, Abc_Ntk_t * pNtk, int fFactored ) fprintf( pFile, " lev = %3d", Abc_NtkGetLevelNum(pNtk) ); fprintf( pFile, "\n" ); + // print the statistic into a file +/* + { + FILE * pTable; + pTable = fopen( "stats.txt", "a+" ); + fprintf( pTable, "%s ", pNtk->pName ); + fprintf( pTable, "%4d ", Abc_NtkPiNum(pNtk) ); + fprintf( pTable, "%4d ", Abc_NtkPoNum(pNtk) ); +// fprintf( pTable, "%4d ", Abc_NtkLatchNum(pNtk) ); + fprintf( pTable, "%6d ", Abc_NtkNodeNum(pNtk) ); + fprintf( pTable, "%6d ", Abc_AigGetLevelNum(pNtk) ); + fprintf( pTable, "\n" ); + fclose( pTable ); + } +*/ +/* + // print the statistic into a file + { + FILE * pTable; + pTable = fopen( "stats.txt", "a+" ); + fprintf( pTable, "%s ", pNtk->pSpec ); + fprintf( pTable, "%.0f ", Abc_NtkGetMappedArea(pNtk) ); + fprintf( pTable, "%.2f ", Abc_NtkDelayTrace(pNtk) ); + fprintf( pTable, "\n" ); + fclose( pTable ); + } +*/ + +/* + // print the statistic into a file + { + FILE * pTable; + pTable = fopen( "stats.txt", "a+" ); + fprintf( pTable, "%s ", pNtk->pName ); + fprintf( pTable, "%d ", Abc_NtkNodeNum(pNtk) ); + fprintf( pTable, "%d ", Abc_AigGetLevelNum(pNtk) ); + fprintf( pTable, "\n" ); + fclose( pTable ); + } +*/ +/* + // print the statistic into a file + { + FILE * pTable; + pTable = fopen( "stats.txt", "a+" ); + fprintf( pTable, "%s ", pNtk->pName ); + fprintf( pTable, "%d ", Abc_NtkLatchNum(pNtk) ); + fprintf( pTable, "\n" ); + fclose( pTable ); + } +*/ } /**Function************************************************************* diff --git a/src/base/abci/abcSweep.c b/src/base/abci/abcSweep.c index 1841ba8c..228e27eb 100644 --- a/src/base/abci/abcSweep.c +++ b/src/base/abci/abcSweep.c @@ -447,17 +447,40 @@ int Abc_NodeDroppingCost( Abc_Obj_t * pNode ) int Abc_NtkCleanup( Abc_Ntk_t * pNtk, int fVerbose ) { Vec_Ptr_t * vNodes; - Abc_Obj_t * pNode; - int i, Counter; + int Counter; assert( !Abc_NtkHasAig(pNtk) ); // mark the nodes reachable from the POs vNodes = Abc_NtkDfs( pNtk, 0 ); + Counter = Abc_NtkReduceNodes( pNtk, vNodes ); + if ( fVerbose ) + printf( "Cleanup removed %d dangling nodes.\n", Counter ); + Vec_PtrFree( vNodes ); + return Counter; +} + +/**Function************************************************************* + + Synopsis [Preserves the nodes collected in the array.] + + Description [Returns the number of nodes removed.] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_NtkReduceNodes( Abc_Ntk_t * pNtk, Vec_Ptr_t * vNodes ) +{ + Abc_Obj_t * pNode; + int i, Counter; + assert( !Abc_NtkIsStrash(pNtk) ); + // mark the nodes reachable from the POs for ( i = 0; i < vNodes->nSize; i++ ) { pNode = vNodes->pArray[i]; + assert( Abc_ObjIsNode(pNode) ); pNode->fMarkA = 1; } - Vec_PtrFree( vNodes ); // if it is an AIG, also mark the constant 1 node if ( Abc_NtkConst1(pNtk) ) Abc_NtkConst1(pNtk)->fMarkA = 1; @@ -472,14 +495,9 @@ int Abc_NtkCleanup( Abc_Ntk_t * pNtk, int fVerbose ) // unmark the remaining nodes Abc_NtkForEachNode( pNtk, pNode, i ) pNode->fMarkA = 0; - if ( fVerbose ) - printf( "Cleanup removed %d dangling nodes.\n", Counter ); // check if ( !Abc_NtkCheck( pNtk ) ) - { printf( "Abc_NtkCleanup: The network check has failed.\n" ); - return -1; - } return Counter; } |