Commit 338845a2 by Alan Mishchenko

New MFS package.

parent 3c978925
...@@ -118,7 +118,7 @@ int Sfm_NodeResubSolve( Sfm_Ntk_t * p, int iNode, int f, int fRemoveOnly ) ...@@ -118,7 +118,7 @@ int Sfm_NodeResubSolve( Sfm_Ntk_t * p, int iNode, int f, int fRemoveOnly )
// report init stats // report init stats
if ( p->pPars->fVeryVerbose ) if ( p->pPars->fVeryVerbose )
printf( "%5d : Lev =%3d. Leaf =%3d. Node =%3d. Div=%3d. Fanin =%4d (%d/%d). MFFC = %d\n", printf( "%5d : Lev =%3d. Leaf =%3d. Node =%3d. Div=%3d. Fanin =%4d (%d/%d). MFFC = %d\n",
iNode, Sfm_ObjLevel(p, iNode), Vec_IntSize(p->vLeaves), Vec_IntSize(p->vNodes), Vec_IntSize(p->vDivs), iNode, Sfm_ObjLevel(p, iNode), 0, Vec_IntSize(p->vNodes), Vec_IntSize(p->vDivs),
Sfm_ObjFanin(p, iNode, f), f, Sfm_ObjFaninNum(p, iNode), Sfm_ObjMffcSize(p, Sfm_ObjFanin(p, iNode, f)) ); Sfm_ObjFanin(p, iNode, f), f, Sfm_ObjFaninNum(p, iNode), Sfm_ObjMffcSize(p, Sfm_ObjFanin(p, iNode, f)) );
// clean simulation info // clean simulation info
p->nCexes = 0; p->nCexes = 0;
......
...@@ -77,10 +77,7 @@ struct Sfm_Ntk_t_ ...@@ -77,10 +77,7 @@ struct Sfm_Ntk_t_
int nTravIds2; // traversal IDs int nTravIds2; // traversal IDs
// window // window
int iPivotNode; // window pivot int iPivotNode; // window pivot
Vec_Int_t * vLeaves; // leaves
Vec_Int_t * vLeaves2; // leaves
Vec_Int_t * vNodes; // internal Vec_Int_t * vNodes; // internal
Vec_Int_t * vNodes2; // internal
Vec_Int_t * vDivs; // divisors Vec_Int_t * vDivs; // divisors
Vec_Int_t * vRoots; // roots Vec_Int_t * vRoots; // roots
Vec_Int_t * vTfo; // TFO (excluding iNode) Vec_Int_t * vTfo; // TFO (excluding iNode)
......
...@@ -163,10 +163,7 @@ Sfm_Ntk_t * Sfm_NtkConstruct( Vec_Wec_t * vFanins, int nPis, int nPos, Vec_Str_t ...@@ -163,10 +163,7 @@ Sfm_Ntk_t * Sfm_NtkConstruct( Vec_Wec_t * vFanins, int nPis, int nPos, Vec_Str_t
} }
void Sfm_NtkPrepare( Sfm_Ntk_t * p ) void Sfm_NtkPrepare( Sfm_Ntk_t * p )
{ {
p->vLeaves = Vec_IntAlloc( 1000 );
p->vLeaves2 = Vec_IntAlloc( 1000 );
p->vNodes = Vec_IntAlloc( 1000 ); p->vNodes = Vec_IntAlloc( 1000 );
p->vNodes2 = Vec_IntAlloc( 1000 );
p->vDivs = Vec_IntAlloc( 100 ); p->vDivs = Vec_IntAlloc( 100 );
p->vRoots = Vec_IntAlloc( 1000 ); p->vRoots = Vec_IntAlloc( 1000 );
p->vTfo = Vec_IntAlloc( 1000 ); p->vTfo = Vec_IntAlloc( 1000 );
...@@ -198,10 +195,7 @@ void Sfm_NtkFree( Sfm_Ntk_t * p ) ...@@ -198,10 +195,7 @@ void Sfm_NtkFree( Sfm_Ntk_t * p )
Vec_WecFree( p->vCnfs ); Vec_WecFree( p->vCnfs );
Vec_IntFree( p->vCover ); Vec_IntFree( p->vCover );
// other data // other data
Vec_IntFreeP( &p->vLeaves );
Vec_IntFreeP( &p->vLeaves2 );
Vec_IntFreeP( &p->vNodes ); Vec_IntFreeP( &p->vNodes );
Vec_IntFreeP( &p->vNodes2 );
Vec_IntFreeP( &p->vDivs ); Vec_IntFreeP( &p->vDivs );
Vec_IntFreeP( &p->vRoots ); Vec_IntFreeP( &p->vRoots );
Vec_IntFreeP( &p->vTfo ); Vec_IntFreeP( &p->vTfo );
......
...@@ -266,41 +266,34 @@ static inline int Sfm_ObjIsUseful( Sfm_Ntk_t * p, int iNode ) ...@@ -266,41 +266,34 @@ static inline int Sfm_ObjIsUseful( Sfm_Ntk_t * p, int iNode )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
int Sfm_NtkCollectTfi_rec( Sfm_Ntk_t * p, int iNode, Vec_Int_t * vLeaves, Vec_Int_t * vNodes ) int Sfm_NtkCollectTfi_rec( Sfm_Ntk_t * p, int iNode, Vec_Int_t * vNodes )
{ {
int i, iFanin; int i, iFanin;
if ( Sfm_ObjIsTravIdCurrent( p, iNode ) ) if ( Sfm_ObjIsTravIdCurrent( p, iNode ) )
return 0; return 0;
Sfm_ObjSetTravIdCurrent( p, iNode ); Sfm_ObjSetTravIdCurrent( p, iNode );
if ( Sfm_ObjIsPi( p, iNode ) )
{
Vec_IntPush( vLeaves, iNode );
return 0;
}
Sfm_ObjForEachFanin( p, iNode, iFanin, i ) Sfm_ObjForEachFanin( p, iNode, iFanin, i )
if ( Sfm_NtkCollectTfi_rec( p, iFanin, vLeaves, vNodes ) ) if ( Sfm_NtkCollectTfi_rec( p, iFanin, vNodes ) )
return 1; return 1;
Vec_IntPush( vNodes, iNode ); Vec_IntPush( vNodes, iNode );
return p->pPars->nWinSizeMax && (Vec_IntSize(vNodes) > p->pPars->nWinSizeMax); return p->pPars->nWinSizeMax && (Vec_IntSize(vNodes) > p->pPars->nWinSizeMax);
} }
int Sfm_NtkCreateWindow( Sfm_Ntk_t * p, int iNode, int fVerbose ) int Sfm_NtkCreateWindow( Sfm_Ntk_t * p, int iNode, int fVerbose )
{ {
int i, k, iTemp, nDivStart; int i, k, iTemp;
abctime clkDiv, clkWin = Abc_Clock(); abctime clkDiv, clkWin = Abc_Clock();
assert( Sfm_ObjIsNode( p, iNode ) ); assert( Sfm_ObjIsNode( p, iNode ) );
p->iPivotNode = iNode; p->iPivotNode = iNode;
Vec_IntClear( p->vLeaves ); // leaves
Vec_IntClear( p->vLeaves2 );// leaves
Vec_IntClear( p->vNodes ); // internal Vec_IntClear( p->vNodes ); // internal
Vec_IntClear( p->vNodes2 ); // internal
Vec_IntClear( p->vDivs ); // divisors Vec_IntClear( p->vDivs ); // divisors
Vec_IntClear( p->vRoots ); // roots Vec_IntClear( p->vRoots ); // roots
Vec_IntClear( p->vTfo ); // roots Vec_IntClear( p->vTfo ); // roots
Vec_IntClear( p->vOrder ); // variable order
// collect transitive fanin // collect transitive fanin
Sfm_NtkIncrementTravId( p ); Sfm_NtkIncrementTravId( p );
if ( Sfm_NtkCollectTfi_rec( p, iNode, p->vLeaves, p->vNodes ) ) if ( Sfm_NtkCollectTfi_rec( p, iNode, p->vNodes ) )
{ {
p->nMaxDivs++; p->nMaxDivs++;
p->timeWin += Abc_Clock() - clkWin; p->timeWin += Abc_Clock() - clkWin;
...@@ -310,13 +303,9 @@ int Sfm_NtkCreateWindow( Sfm_Ntk_t * p, int iNode, int fVerbose ) ...@@ -310,13 +303,9 @@ int Sfm_NtkCreateWindow( Sfm_Ntk_t * p, int iNode, int fVerbose )
// create divisors // create divisors
clkDiv = Abc_Clock(); clkDiv = Abc_Clock();
Vec_IntClear( p->vDivs ); Vec_IntClear( p->vDivs );
Vec_IntForEachEntry( p->vLeaves, iTemp, i ) Vec_IntAppend( p->vDivs, p->vNodes );
Vec_IntPush( p->vDivs, iTemp );
Vec_IntForEachEntry( p->vNodes, iTemp, i )
Vec_IntPush( p->vDivs, iTemp );
Vec_IntPop( p->vDivs ); Vec_IntPop( p->vDivs );
// add non-topological divisors // add non-topological divisors
nDivStart = Vec_IntSize(p->vDivs);
if ( Vec_IntSize(p->vDivs) < p->pPars->nWinSizeMax + 0 ) if ( Vec_IntSize(p->vDivs) < p->pPars->nWinSizeMax + 0 )
{ {
Sfm_NtkIncrementTravId2( p ); Sfm_NtkIncrementTravId2( p );
...@@ -364,39 +353,34 @@ int Sfm_NtkCreateWindow( Sfm_Ntk_t * p, int iNode, int fVerbose ) ...@@ -364,39 +353,34 @@ int Sfm_NtkCreateWindow( Sfm_Ntk_t * p, int iNode, int fVerbose )
// compute new leaves and nodes // compute new leaves and nodes
Sfm_NtkIncrementTravId( p ); Sfm_NtkIncrementTravId( p );
Vec_IntForEachEntry( p->vRoots, iTemp, i ) Vec_IntForEachEntry( p->vRoots, iTemp, i )
if ( Sfm_NtkCollectTfi_rec( p, iTemp, p->vLeaves2, p->vNodes2 ) ) if ( Sfm_NtkCollectTfi_rec( p, iTemp, p->vOrder ) )
break;
if ( i == Vec_IntSize(p->vRoots) )
{ {
// printf( "%d -> %d %d -> %d\n", Vec_IntSize(p->vLeaves), Vec_IntSize(p->vLeaves2), Vec_IntSize(p->vNodes), Vec_IntSize(p->vNodes2) ); Vec_IntClear( p->vRoots );
// swap leaves and nodes Vec_IntClear( p->vTfo );
ABC_SWAP( Vec_Int_t *, p->vLeaves, p->vLeaves2 ); Vec_IntClear( p->vOrder );
ABC_SWAP( Vec_Int_t *, p->vNodes, p->vNodes2 ); break;
} }
else if ( Vec_IntSize(p->vRoots) > 0 )
Vec_IntForEachEntry( p->vDivs, iTemp, i )
if ( Sfm_NtkCollectTfi_rec( p, iTemp, p->vOrder ) )
{ {
Vec_IntClear( p->vRoots ); Vec_IntClear( p->vRoots );
Vec_IntClear( p->vTfo ); Vec_IntClear( p->vTfo );
Vec_IntClear( p->vOrder );
break;
} }
// printf( "Roots = %d. TFO = %d.\n", Vec_IntSize(p->vRoots), Vec_IntSize(p->vTfo) );
} }
// create ordering of the nodes, leaves and divisors that are not among nodes/leaves if ( Vec_IntSize(p->vOrder) == 0 )
Vec_IntClear( p->vOrder );
Sfm_NtkIncrementTravId2( p );
Vec_IntForEachEntryReverse( p->vNodes, iTemp, i )
{
Sfm_ObjSetTravIdCurrent2( p, iTemp );
Vec_IntPush( p->vOrder, iTemp );
}
Vec_IntForEachEntry( p->vLeaves, iTemp, i )
{ {
Sfm_ObjSetTravIdCurrent2( p, iTemp ); int Temp = p->pPars->nWinSizeMax;
Vec_IntPush( p->vOrder, iTemp ); p->pPars->nWinSizeMax = 0;
} Sfm_NtkIncrementTravId( p );
Sfm_NtkCollectTfi_rec( p, iNode, p->vOrder );
Vec_IntForEachEntry( p->vDivs, iTemp, i ) Vec_IntForEachEntry( p->vDivs, iTemp, i )
if ( !Sfm_ObjIsTravIdCurrent2(p, iTemp) ) Sfm_NtkCollectTfi_rec( p, iTemp, p->vOrder );
Vec_IntPush( p->vOrder, iTemp ); p->pPars->nWinSizeMax = Temp;
}
// statistics // statistics
p->timeWin += Abc_Clock() - clkWin - clkDiv; p->timeWin += Abc_Clock() - clkWin - clkDiv;
...@@ -405,7 +389,7 @@ int Sfm_NtkCreateWindow( Sfm_Ntk_t * p, int iNode, int fVerbose ) ...@@ -405,7 +389,7 @@ int Sfm_NtkCreateWindow( Sfm_Ntk_t * p, int iNode, int fVerbose )
// print stats about the window // print stats about the window
printf( "%6d : ", iNode ); printf( "%6d : ", iNode );
printf( "Leaves = %5d. ", Vec_IntSize(p->vLeaves) ); printf( "Leaves = %5d. ", 0 );
printf( "Nodes = %5d. ", Vec_IntSize(p->vNodes) ); printf( "Nodes = %5d. ", Vec_IntSize(p->vNodes) );
printf( "Roots = %5d. ", Vec_IntSize(p->vRoots) ); printf( "Roots = %5d. ", Vec_IntSize(p->vRoots) );
printf( "Divs = %5d. ", Vec_IntSize(p->vDivs) ); printf( "Divs = %5d. ", Vec_IntSize(p->vDivs) );
......
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