Commit 50e324ce by Alan Mishchenko

Adding switch &mfs -b to preserve white boxes during optimization.

parent 659d2889
...@@ -239,7 +239,7 @@ Sfm_Ntk_t * Gia_ManExtractMfs( Gia_Man_t * p ) ...@@ -239,7 +239,7 @@ Sfm_Ntk_t * Gia_ManExtractMfs( Gia_Man_t * p )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
Gia_Man_t * Gia_ManInsertMfs( Gia_Man_t * p, Sfm_Ntk_t * pNtk ) Gia_Man_t * Gia_ManInsertMfs( Gia_Man_t * p, Sfm_Ntk_t * pNtk, int fAllBoxes )
{ {
extern int Gia_ManFromIfLogicCreateLut( Gia_Man_t * pNew, word * pRes, Vec_Int_t * vLeaves, Vec_Int_t * vCover, Vec_Int_t * vMapping, Vec_Int_t * vMapping2 ); extern int Gia_ManFromIfLogicCreateLut( Gia_Man_t * pNew, word * pRes, Vec_Int_t * vLeaves, Vec_Int_t * vCover, Vec_Int_t * vMapping, Vec_Int_t * vMapping2 );
Gia_Man_t * pNew; Gia_Obj_t * pObj; Gia_Man_t * pNew; Gia_Obj_t * pObj;
...@@ -294,7 +294,7 @@ Gia_Man_t * Gia_ManInsertMfs( Gia_Man_t * p, Sfm_Ntk_t * pNtk ) ...@@ -294,7 +294,7 @@ Gia_Man_t * Gia_ManInsertMfs( Gia_Man_t * p, Sfm_Ntk_t * pNtk )
// collect nodes in the given order // collect nodes in the given order
vBoxesLeft = Vec_IntAlloc( nBoxes ); vBoxesLeft = Vec_IntAlloc( nBoxes );
vMfsTopo = Sfm_NtkDfs( pNtk, vGroups, vGroupMap, vBoxesLeft ); vMfsTopo = Sfm_NtkDfs( pNtk, vGroups, vGroupMap, vBoxesLeft, fAllBoxes );
assert( Vec_IntSize(vBoxesLeft) <= nBoxes ); assert( Vec_IntSize(vBoxesLeft) <= nBoxes );
assert( Vec_IntSize(vMfsTopo) > 0 ); assert( Vec_IntSize(vMfsTopo) > 0 );
...@@ -458,7 +458,7 @@ Gia_Man_t * Gia_ManPerformMfs( Gia_Man_t * p, Sfm_Par_t * pPars ) ...@@ -458,7 +458,7 @@ Gia_Man_t * Gia_ManPerformMfs( Gia_Man_t * p, Sfm_Par_t * pPars )
} }
else else
{ {
pNew = Gia_ManInsertMfs( p, pNtk ); pNew = Gia_ManInsertMfs( p, pNtk, pPars->fAllBoxes );
if( pPars->fVerbose ) if( pPars->fVerbose )
Abc_Print( 1, "The network has %d nodes changed by \"&mfs\".\n", nNodes ); Abc_Print( 1, "The network has %d nodes changed by \"&mfs\".\n", nNodes );
// check integrity // check integrity
......
...@@ -40612,7 +40612,7 @@ int Abc_CommandAbc9Mfs( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -40612,7 +40612,7 @@ int Abc_CommandAbc9Mfs( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars->nDepthMax = 100; pPars->nDepthMax = 100;
pPars->nWinSizeMax = 2000; pPars->nWinSizeMax = 2000;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "WFDMLCNdaevwh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "WFDMLCNdaebvwh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -40702,6 +40702,9 @@ int Abc_CommandAbc9Mfs( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -40702,6 +40702,9 @@ int Abc_CommandAbc9Mfs( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'e': case 'e':
pPars->fMoreEffort ^= 1; pPars->fMoreEffort ^= 1;
break; break;
case 'b':
pPars->fAllBoxes ^= 1;
break;
case 'v': case 'v':
pPars->fVerbose ^= 1; pPars->fVerbose ^= 1;
break; break;
...@@ -40734,7 +40737,7 @@ int Abc_CommandAbc9Mfs( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -40734,7 +40737,7 @@ int Abc_CommandAbc9Mfs( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0; return 0;
usage: usage:
Abc_Print( -2, "usage: &mfs [-WFDMLCN <num>] [-daevwh]\n" ); Abc_Print( -2, "usage: &mfs [-WFDMLCN <num>] [-daebvwh]\n" );
Abc_Print( -2, "\t performs don't-care-based optimization of logic networks\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->nTfoLevMax ); Abc_Print( -2, "\t-W <num> : the number of levels in the TFO cone (0 <= num) [default = %d]\n", pPars->nTfoLevMax );
Abc_Print( -2, "\t-F <num> : the max number of fanouts to skip (1 <= num) [default = %d]\n", pPars->nFanoutMax ); Abc_Print( -2, "\t-F <num> : the max number of fanouts to skip (1 <= num) [default = %d]\n", pPars->nFanoutMax );
...@@ -40746,6 +40749,7 @@ usage: ...@@ -40746,6 +40749,7 @@ usage:
Abc_Print( -2, "\t-d : toggle performing redundancy removal [default = %s]\n", pPars->fRrOnly? "yes": "no" ); Abc_Print( -2, "\t-d : toggle performing redundancy removal [default = %s]\n", pPars->fRrOnly? "yes": "no" );
Abc_Print( -2, "\t-a : toggle minimizing area or area+edges [default = %s]\n", pPars->fArea? "area": "area+edges" ); 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-e : toggle high-effort resubstitution [default = %s]\n", pPars->fMoreEffort? "yes": "no" );
Abc_Print( -2, "\t-b : toggle preserving all while boxes [default = %s]\n", pPars->fAllBoxes? "yes": "no" );
Abc_Print( -2, "\t-v : toggle printing optimization summary [default = %s]\n", pPars->fVerbose? "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-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"); Abc_Print( -2, "\t-h : print the command usage\n");
...@@ -67,6 +67,7 @@ struct Sfm_Par_t_ ...@@ -67,6 +67,7 @@ struct Sfm_Par_t_
int fZeroCost; // enable zero-cost replacement int fZeroCost; // enable zero-cost replacement
int fUseSim; // enable simulation int fUseSim; // enable simulation
int fPrintDecs; // enable printing decompositions int fPrintDecs; // enable printing decompositions
int fAllBoxes; // enable preserving all boxes
int fLibVerbose; // enable library stats int fLibVerbose; // enable library stats
int fDelayVerbose; // enable delay stats int fDelayVerbose; // enable delay stats
int fVerbose; // enable basic stats int fVerbose; // enable basic stats
...@@ -93,7 +94,7 @@ extern word * Sfm_NodeReadTruth( Sfm_Ntk_t * p, int i ); ...@@ -93,7 +94,7 @@ extern word * Sfm_NodeReadTruth( Sfm_Ntk_t * p, int i );
extern int Sfm_NodeReadFixed( Sfm_Ntk_t * p, int i ); extern int Sfm_NodeReadFixed( Sfm_Ntk_t * p, int i );
extern int Sfm_NodeReadUsed( Sfm_Ntk_t * p, int i ); extern int Sfm_NodeReadUsed( Sfm_Ntk_t * p, int i );
/*=== sfmWin.c ==========================================================*/ /*=== sfmWin.c ==========================================================*/
extern Vec_Int_t * Sfm_NtkDfs( Sfm_Ntk_t * p, Vec_Wec_t * vGroups, Vec_Int_t * vGroupMap, Vec_Int_t * vBoxesLeft ); extern Vec_Int_t * Sfm_NtkDfs( Sfm_Ntk_t * p, Vec_Wec_t * vGroups, Vec_Int_t * vGroupMap, Vec_Int_t * vBoxesLeft, int fAllBoxes );
ABC_NAMESPACE_HEADER_END ABC_NAMESPACE_HEADER_END
......
...@@ -54,6 +54,7 @@ void Sfm_ParSetDefault( Sfm_Par_t * pPars ) ...@@ -54,6 +54,7 @@ void Sfm_ParSetDefault( Sfm_Par_t * pPars )
pPars->fRrOnly = 0; // perform redundancy removal pPars->fRrOnly = 0; // perform redundancy removal
pPars->fArea = 0; // performs optimization for area pPars->fArea = 0; // performs optimization for area
pPars->fMoreEffort = 0; // performs high-affort minimization pPars->fMoreEffort = 0; // performs high-affort minimization
pPars->fAllBoxes = 0; // enable preserving all boxes
pPars->fVerbose = 0; // enable basic stats pPars->fVerbose = 0; // enable basic stats
pPars->fVeryVerbose = 0; // enable detailed stats pPars->fVeryVerbose = 0; // enable detailed stats
} }
......
...@@ -163,13 +163,19 @@ void Sfm_NtkDfs_rec( Sfm_Ntk_t * p, int iNode, Vec_Int_t * vNodes, Vec_Wec_t * v ...@@ -163,13 +163,19 @@ void Sfm_NtkDfs_rec( Sfm_Ntk_t * p, int iNode, Vec_Int_t * vNodes, Vec_Wec_t * v
Vec_IntPush( vNodes, iNode ); Vec_IntPush( vNodes, iNode );
} }
} }
Vec_Int_t * Sfm_NtkDfs( Sfm_Ntk_t * p, Vec_Wec_t * vGroups, Vec_Int_t * vGroupMap, Vec_Int_t * vBoxesLeft ) Vec_Int_t * Sfm_NtkDfs( Sfm_Ntk_t * p, Vec_Wec_t * vGroups, Vec_Int_t * vGroupMap, Vec_Int_t * vBoxesLeft, int fAllBoxes )
{ {
Vec_Int_t * vNodes; Vec_Int_t * vNodes;
int i; int i;
Vec_IntClear( vBoxesLeft ); Vec_IntClear( vBoxesLeft );
vNodes = Vec_IntAlloc( p->nObjs ); vNodes = Vec_IntAlloc( p->nObjs );
Sfm_NtkIncrementTravId( p ); Sfm_NtkIncrementTravId( p );
if ( fAllBoxes )
{
Vec_Int_t * vGroup;
Vec_WecForEachLevel( vGroups, vGroup, i )
Sfm_NtkDfs_rec( p, Vec_IntEntry(vGroup, 0), vNodes, vGroups, vGroupMap, vBoxesLeft );
}
Sfm_NtkForEachPo( p, i ) Sfm_NtkForEachPo( p, i )
Sfm_NtkDfs_rec( p, Sfm_ObjFanin(p, i, 0), vNodes, vGroups, vGroupMap, vBoxesLeft ); Sfm_NtkDfs_rec( p, Sfm_ObjFanin(p, i, 0), vNodes, vGroups, vGroupMap, vBoxesLeft );
return vNodes; return vNodes;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment