Commit 40d8cdab by Alan Mishchenko

New MFS package.

parent 9268c100
...@@ -220,6 +220,7 @@ p->timeInt += clock() - clk; ...@@ -220,6 +220,7 @@ p->timeInt += clock() - clk;
if ( fOnlyRemove ) if ( fOnlyRemove )
return 0; return 0;
// return 0;
if ( fVeryVerbose ) if ( fVeryVerbose )
{ {
......
...@@ -71,6 +71,7 @@ void Sfm_ParSetDefault( Sfm_Par_t * pPars ) ...@@ -71,6 +71,7 @@ void Sfm_ParSetDefault( Sfm_Par_t * pPars )
***********************************************************************/ ***********************************************************************/
void Sfm_NtkPrintStats( Sfm_Ntk_t * p ) void Sfm_NtkPrintStats( Sfm_Ntk_t * p )
{ {
p->timeOther = p->timeTotal - p->timeWin - p->timeDiv - p->timeCnf - p->timeSat;
printf( "Nodes = %d. Try = %d. Resub = %d. Div = %d. SAT calls = %d. Timeouts = %d.\n", printf( "Nodes = %d. Try = %d. Resub = %d. Div = %d. SAT calls = %d. Timeouts = %d.\n",
Sfm_NtkNodeNum(p), p->nNodesTried, p->nRemoves + p->nResubs, p->nTotalDivs, p->nSatCalls, p->nTimeOuts ); Sfm_NtkNodeNum(p), p->nNodesTried, p->nRemoves + p->nResubs, p->nTotalDivs, p->nSatCalls, p->nTimeOuts );
...@@ -88,6 +89,7 @@ void Sfm_NtkPrintStats( Sfm_Ntk_t * p ) ...@@ -88,6 +89,7 @@ void Sfm_NtkPrintStats( Sfm_Ntk_t * p )
ABC_PRTP( "Div", p->timeDiv , p->timeTotal ); ABC_PRTP( "Div", p->timeDiv , p->timeTotal );
ABC_PRTP( "Cnf", p->timeCnf , p->timeTotal ); ABC_PRTP( "Cnf", p->timeCnf , p->timeTotal );
ABC_PRTP( "Sat", p->timeSat , p->timeTotal ); ABC_PRTP( "Sat", p->timeSat , p->timeTotal );
ABC_PRTP( "Oth", p->timeOther, p->timeTotal );
ABC_PRTP( "ALL", p->timeTotal, p->timeTotal ); ABC_PRTP( "ALL", p->timeTotal, p->timeTotal );
} }
...@@ -145,6 +147,8 @@ p->timeSat += clock() - clk; ...@@ -145,6 +147,8 @@ p->timeSat += clock() - clk;
goto finish; goto finish;
if ( fRemoveOnly || Vec_IntSize(p->vDivs) == 0 ) if ( fRemoveOnly || Vec_IntSize(p->vDivs) == 0 )
return 0; return 0;
// return 0;
if ( fVeryVerbose ) if ( fVeryVerbose )
{ {
for ( i = 0; i < 9; i++ ) for ( i = 0; i < 9; i++ )
...@@ -209,10 +213,10 @@ finish: ...@@ -209,10 +213,10 @@ finish:
int Sfm_NodeResub( Sfm_Ntk_t * p, int iNode ) int Sfm_NodeResub( Sfm_Ntk_t * p, int iNode )
{ {
int i, iFanin; int i, iFanin;
p->nNodesTried++;
// prepare SAT solver // prepare SAT solver
if ( !Sfm_NtkCreateWindow( p, iNode, p->pPars->fVeryVerbose ) ) if ( !Sfm_NtkCreateWindow( p, iNode, p->pPars->fVeryVerbose ) )
return 0; return 0;
p->nNodesTried++;
Sfm_NtkWindowToSolver( p ); Sfm_NtkWindowToSolver( p );
Sfm_NtkPrepareDivisors( p, iNode ); Sfm_NtkPrepareDivisors( p, iNode );
// try replacing area critical fanins // try replacing area critical fanins
...@@ -271,7 +275,8 @@ int Sfm_NtkPerform( Sfm_Ntk_t * p, Sfm_Par_t * pPars ) ...@@ -271,7 +275,8 @@ int Sfm_NtkPerform( Sfm_Ntk_t * p, Sfm_Par_t * pPars )
continue; continue;
if ( Sfm_ObjFaninNum(p, i) < 2 || Sfm_ObjFaninNum(p, i) > 6 ) if ( Sfm_ObjFaninNum(p, i) < 2 || Sfm_ObjFaninNum(p, i) > 6 )
continue; continue;
Counter += Sfm_NodeResub( p, i ); while ( Sfm_NodeResub(p, i) )
Counter++;
} }
p->nTotalNodesEnd = Vec_WecSizeUsed(&p->vFanins) - Sfm_NtkPoNum(p); p->nTotalNodesEnd = Vec_WecSizeUsed(&p->vFanins) - Sfm_NtkPoNum(p);
p->nTotalEdgesEnd = Vec_WecSizeSize(&p->vFanins); p->nTotalEdgesEnd = Vec_WecSizeSize(&p->vFanins);
......
...@@ -116,6 +116,7 @@ struct Sfm_Ntk_t_ ...@@ -116,6 +116,7 @@ struct Sfm_Ntk_t_
clock_t timeDiv; clock_t timeDiv;
clock_t timeCnf; clock_t timeCnf;
clock_t timeSat; clock_t timeSat;
clock_t timeOther;
clock_t timeTotal; clock_t timeTotal;
}; };
......
...@@ -182,11 +182,12 @@ int Sfm_NtkCheckFanouts( Sfm_Ntk_t * p, int iNode ) ...@@ -182,11 +182,12 @@ int Sfm_NtkCheckFanouts( Sfm_Ntk_t * p, int iNode )
void Sfm_NtkAddDivisors( Sfm_Ntk_t * p, int iNode, int nLevelMax ) void Sfm_NtkAddDivisors( Sfm_Ntk_t * p, int iNode, int nLevelMax )
{ {
int i, iFanout; int i, iFanout;
if ( Sfm_ObjFanoutNum(p, iNode) > p->pPars->nFanoutMax )
return;
Sfm_ObjForEachFanout( p, iNode, iFanout, i ) Sfm_ObjForEachFanout( p, iNode, iFanout, i )
{ {
// skip TFI nodes, PO nodes, and nodes with high fanout or nodes with high logic level // skip TFI nodes, PO nodes, or nodes with high logic level
if ( Sfm_ObjIsTravIdCurrent(p, iFanout) || Sfm_ObjIsPo(p, iFanout) || if ( Sfm_ObjIsTravIdCurrent(p, iFanout) || Sfm_ObjIsPo(p, iFanout) ||
Sfm_ObjFanoutNum(p, iFanout) >= p->pPars->nFanoutMax ||
(p->pPars->fFixLevel && Sfm_ObjLevel(p, iFanout) >= nLevelMax) ) (p->pPars->fFixLevel && Sfm_ObjLevel(p, iFanout) >= nLevelMax) )
continue; continue;
// handle single-input nodes // handle single-input nodes
...@@ -216,20 +217,22 @@ void Sfm_NtkAddDivisors( Sfm_Ntk_t * p, int iNode, int nLevelMax ) ...@@ -216,20 +217,22 @@ void Sfm_NtkAddDivisors( Sfm_Ntk_t * p, int iNode, int nLevelMax )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
void Sfm_NtkCollectTfi_rec( Sfm_Ntk_t * p, int iNode ) int Sfm_NtkCollectTfi_rec( Sfm_Ntk_t * p, int iNode, int nWinSizeMax )
{ {
int i, iFanin; int i, iFanin;
if ( Sfm_ObjIsTravIdCurrent( p, iNode ) ) if ( Sfm_ObjIsTravIdCurrent( p, iNode ) )
return; return 0;
Sfm_ObjSetTravIdCurrent( p, iNode ); Sfm_ObjSetTravIdCurrent( p, iNode );
if ( Sfm_ObjIsPi( p, iNode ) ) if ( Sfm_ObjIsPi( p, iNode ) )
{ {
Vec_IntPush( p->vLeaves, iNode ); Vec_IntPush( p->vLeaves, iNode );
return; return 0;
} }
Sfm_ObjForEachFanin( p, iNode, iFanin, i ) Sfm_ObjForEachFanin( p, iNode, iFanin, i )
Sfm_NtkCollectTfi_rec( p, iFanin ); if ( Sfm_NtkCollectTfi_rec( p, iFanin, nWinSizeMax ) )
return 1;
Vec_IntPush( p->vNodes, iNode ); Vec_IntPush( p->vNodes, iNode );
return nWinSizeMax && (Vec_IntSize(p->vNodes) > nWinSizeMax);
} }
int Sfm_NtkCreateWindow( Sfm_Ntk_t * p, int iNode, int fVerbose ) int Sfm_NtkCreateWindow( Sfm_Ntk_t * p, int iNode, int fVerbose )
{ {
...@@ -243,9 +246,11 @@ int Sfm_NtkCreateWindow( Sfm_Ntk_t * p, int iNode, int fVerbose ) ...@@ -243,9 +246,11 @@ int Sfm_NtkCreateWindow( Sfm_Ntk_t * p, int iNode, int fVerbose )
Vec_IntClear( p->vTfo ); // roots Vec_IntClear( p->vTfo ); // roots
// collect transitive fanin // collect transitive fanin
Sfm_NtkIncrementTravId( p ); Sfm_NtkIncrementTravId( p );
Sfm_NtkCollectTfi_rec( p, iNode ); if ( Sfm_NtkCollectTfi_rec( p, iNode, p->pPars->nWinSizeMax ) )
if ( Vec_IntSize(p->vLeaves) + Vec_IntSize(p->vNodes) > p->pPars->nWinSizeMax ) {
p->timeWin += clock() - clk;
return 0; return 0;
}
// collect TFO (currently use only one level of TFO) // collect TFO (currently use only one level of TFO)
if ( Sfm_NtkCheckFanouts(p, iNode) ) if ( Sfm_NtkCheckFanouts(p, iNode) )
{ {
......
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