Commit 5608d947 by Alan Mishchenko

Preparing new implementation of SOP/DSD balancing in 'if' mapper.

parent 424b86a5
...@@ -691,7 +691,7 @@ Gia_Man_t * Gia_ManFromIfAig( If_Man_t * pIfMan ) ...@@ -691,7 +691,7 @@ Gia_Man_t * Gia_ManFromIfAig( If_Man_t * pIfMan )
Vec_Int_t * vCover; Vec_Int_t * vCover;
int i, k; int i, k;
assert( pIfMan->pPars->pLutStruct == NULL ); assert( pIfMan->pPars->pLutStruct == NULL );
assert( pIfMan->pPars->fDelayOpt || pIfMan->pPars->fUserRecLib ); assert( pIfMan->pPars->fDelayOpt || pIfMan->pPars->fDsdBalance || pIfMan->pPars->fUserRecLib );
// create new manager // create new manager
pNew = Gia_ManStart( If_ManObjNum(pIfMan) ); pNew = Gia_ManStart( If_ManObjNum(pIfMan) );
Gia_ManHashAlloc( pNew ); Gia_ManHashAlloc( pNew );
...@@ -713,6 +713,8 @@ Gia_Man_t * Gia_ManFromIfAig( If_Man_t * pIfMan ) ...@@ -713,6 +713,8 @@ Gia_Man_t * Gia_ManFromIfAig( If_Man_t * pIfMan )
// get the functionality // get the functionality
if ( pIfMan->pPars->fDelayOpt ) if ( pIfMan->pPars->fDelayOpt )
pIfObj->iCopy = Gia_ManNodeIfSopToGia( pNew, pIfMan, pCutBest, vLeaves, fHash ); pIfObj->iCopy = Gia_ManNodeIfSopToGia( pNew, pIfMan, pCutBest, vLeaves, fHash );
else if ( pIfMan->pPars->fDsdBalance )
pIfObj->iCopy = If_DsdCutBalance( pNew, pIfMan, pCutBest, vLeaves, fHash );
else if ( pIfMan->pPars->fUserRecLib ) else if ( pIfMan->pPars->fUserRecLib )
pIfObj->iCopy = Abc_RecToGia3( pNew, pIfMan, pCutBest, vLeaves, fHash ); pIfObj->iCopy = Abc_RecToGia3( pNew, pIfMan, pCutBest, vLeaves, fHash );
else assert( 0 ); else assert( 0 );
...@@ -1292,7 +1294,7 @@ Gia_Man_t * Gia_ManFromIfLogic( If_Man_t * pIfMan ) ...@@ -1292,7 +1294,7 @@ Gia_Man_t * Gia_ManFromIfLogic( If_Man_t * pIfMan )
{ {
pCutBest = If_ObjCutBest( pIfObj ); pCutBest = If_ObjCutBest( pIfObj );
// perform sorting of cut leaves by delay, so that the slowest pin drives the fastest input of the LUT // perform sorting of cut leaves by delay, so that the slowest pin drives the fastest input of the LUT
if ( !pIfMan->pPars->fUseTtPerm && !pIfMan->pPars->fDelayOpt && !pIfMan->pPars->pLutStruct && !pIfMan->pPars->fUserRecLib && !pIfMan->pPars->nGateSize && !pIfMan->pPars->fEnableCheck75 && !pIfMan->pPars->fEnableCheck75u && !pIfMan->pPars->fEnableCheck07 ) if ( !pIfMan->pPars->fUseTtPerm && !pIfMan->pPars->fDelayOpt && !pIfMan->pPars->fDsdBalance && !pIfMan->pPars->pLutStruct && !pIfMan->pPars->fUserRecLib && !pIfMan->pPars->nGateSize && !pIfMan->pPars->fEnableCheck75 && !pIfMan->pPars->fEnableCheck75u && !pIfMan->pPars->fEnableCheck07 )
If_CutRotatePins( pIfMan, pCutBest ); If_CutRotatePins( pIfMan, pCutBest );
// collect leaves of the best cut // collect leaves of the best cut
Vec_IntClear( vLeaves ); Vec_IntClear( vLeaves );
...@@ -1534,7 +1536,7 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp, int fNormalized ) ...@@ -1534,7 +1536,7 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp, int fNormalized )
If_Man_t * pIfMan; If_Man_t * pIfMan;
If_Par_t * pPars = (If_Par_t *)pp; If_Par_t * pPars = (If_Par_t *)pp;
// disable cut minimization when GIA strucure is needed // disable cut minimization when GIA strucure is needed
if ( !pPars->fDelayOpt && !pPars->fUserRecLib && !pPars->fDeriveLuts && !pPars->fUseDsd && !pPars->fUseTtPerm ) if ( !pPars->fDelayOpt && !pPars->fDsdBalance && !pPars->fUserRecLib && !pPars->fDeriveLuts && !pPars->fUseDsd && !pPars->fUseTtPerm )
pPars->fCutMin = 0; pPars->fCutMin = 0;
// reconstruct GIA according to the hierarchy manager // reconstruct GIA according to the hierarchy manager
...@@ -1593,7 +1595,7 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp, int fNormalized ) ...@@ -1593,7 +1595,7 @@ Gia_Man_t * Gia_ManPerformMapping( Gia_Man_t * p, void * pp, int fNormalized )
return NULL; return NULL;
} }
// transform the result of mapping into the new network // transform the result of mapping into the new network
if ( pIfMan->pPars->fDelayOpt || pIfMan->pPars->fUserRecLib ) if ( pIfMan->pPars->fDelayOpt || pIfMan->pPars->fDsdBalance || pIfMan->pPars->fUserRecLib )
pNew = Gia_ManFromIfAig( pIfMan ); pNew = Gia_ManFromIfAig( pIfMan );
else else
pNew = Gia_ManFromIfLogic( pIfMan ); pNew = Gia_ManFromIfLogic( pIfMan );
......
...@@ -14762,7 +14762,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -14762,7 +14762,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
fLutMux = 0; fLutMux = 0;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "KCFAGNDEWSTqaflepmrsdbugyojikncvh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "KCFAGNDEWSTqaflepmrsdbugxyojikncvh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -14931,6 +14931,9 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -14931,6 +14931,9 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'g': case 'g':
pPars->fDelayOpt ^= 1; pPars->fDelayOpt ^= 1;
break; break;
case 'x':
pPars->fDsdBalance ^= 1;
break;
case 'y': case 'y':
pPars->fUserRecLib ^= 1; pPars->fUserRecLib ^= 1;
break; break;
...@@ -15093,8 +15096,8 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -15093,8 +15096,8 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars->fUsePerm = 1; pPars->fUsePerm = 1;
pPars->pLutLib = NULL; pPars->pLutLib = NULL;
} }
// modify for global delay optimization // modify for delay optimization
if ( pPars->fDelayOpt ) if ( pPars->fDelayOpt || pPars->fDsdBalance )
{ {
pPars->fTruth = 1; pPars->fTruth = 1;
pPars->fCutMin = 1; pPars->fCutMin = 1;
...@@ -15102,7 +15105,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -15102,7 +15105,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars->fUsePerm = 1; pPars->fUsePerm = 1;
pPars->pLutLib = NULL; pPars->pLutLib = NULL;
} }
// modify for global delay optimization // modify for delay optimization
if ( pPars->nGateSize > 0 ) if ( pPars->nGateSize > 0 )
{ {
pPars->fTruth = 1; pPars->fTruth = 1;
...@@ -15216,7 +15219,7 @@ usage: ...@@ -15216,7 +15219,7 @@ usage:
sprintf(LutSize, "library" ); sprintf(LutSize, "library" );
else else
sprintf(LutSize, "%d", pPars->nLutSize ); sprintf(LutSize, "%d", pPars->nLutSize );
Abc_Print( -2, "usage: if [-KCFANGT num] [-DEW float] [-S str] [-qarlepmsdbugyojikncvh]\n" ); Abc_Print( -2, "usage: if [-KCFANGT num] [-DEW float] [-S str] [-qarlepmsdbugxyojikncvh]\n" );
Abc_Print( -2, "\t performs FPGA technology mapping of the network\n" ); Abc_Print( -2, "\t performs FPGA technology mapping of the network\n" );
Abc_Print( -2, "\t-K num : the number of LUT inputs (2 < num < %d) [default = %s]\n", IF_MAX_LUTSIZE+1, LutSize ); Abc_Print( -2, "\t-K num : the number of LUT inputs (2 < num < %d) [default = %s]\n", IF_MAX_LUTSIZE+1, LutSize );
Abc_Print( -2, "\t-C num : the max number of priority cuts (0 < num < 2^12) [default = %d]\n", pPars->nCutsMax ); Abc_Print( -2, "\t-C num : the max number of priority cuts (0 < num < 2^12) [default = %d]\n", pPars->nCutsMax );
...@@ -15242,6 +15245,7 @@ usage: ...@@ -15242,6 +15245,7 @@ usage:
Abc_Print( -2, "\t-b : toggles the use of one special feature [default = %s]\n", pPars->fUseBat? "yes": "no" ); Abc_Print( -2, "\t-b : toggles the use of one special feature [default = %s]\n", pPars->fUseBat? "yes": "no" );
Abc_Print( -2, "\t-u : toggles the use of MUXes along with LUTs [default = %s]\n", fLutMux? "yes": "no" ); Abc_Print( -2, "\t-u : toggles the use of MUXes along with LUTs [default = %s]\n", fLutMux? "yes": "no" );
Abc_Print( -2, "\t-g : toggles delay optimization by SOP balancing [default = %s]\n", pPars->fDelayOpt? "yes": "no" ); Abc_Print( -2, "\t-g : toggles delay optimization by SOP balancing [default = %s]\n", pPars->fDelayOpt? "yes": "no" );
Abc_Print( -2, "\t-x : toggles delay optimization by DSD balancing [default = %s]\n", pPars->fDsdBalance? "yes": "no" );
Abc_Print( -2, "\t-y : toggles delay optimization with recorded library [default = %s]\n", pPars->fUserRecLib? "yes": "no" ); Abc_Print( -2, "\t-y : toggles delay optimization with recorded library [default = %s]\n", pPars->fUserRecLib? "yes": "no" );
Abc_Print( -2, "\t-o : toggles using buffers to decouple combinational outputs [default = %s]\n", pPars->fUseBuffs? "yes": "no" ); Abc_Print( -2, "\t-o : toggles using buffers to decouple combinational outputs [default = %s]\n", pPars->fUseBuffs? "yes": "no" );
Abc_Print( -2, "\t-j : toggles enabling additional check [default = %s]\n", pPars->fEnableCheck07? "yes": "no" ); Abc_Print( -2, "\t-j : toggles enabling additional check [default = %s]\n", pPars->fEnableCheck07? "yes": "no" );
...@@ -29503,7 +29507,7 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -29503,7 +29507,7 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv )
} }
pPars->pLutLib = (If_LibLut_t *)pAbc->pLibLut; pPars->pLutLib = (If_LibLut_t *)pAbc->pLibLut;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "KCFAGRDEWSTqalepmrsdbgyojikfuztncvh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "KCFAGRDEWSTqalepmrsdbgxyojikfuztncvh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -29666,6 +29670,9 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -29666,6 +29670,9 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'g': case 'g':
pPars->fDelayOpt ^= 1; pPars->fDelayOpt ^= 1;
break; break;
case 'x':
pPars->fDsdBalance ^= 1;
break;
case 'y': case 'y':
pPars->fUserRecLib ^= 1; pPars->fUserRecLib ^= 1;
break; break;
...@@ -29842,8 +29849,8 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -29842,8 +29849,8 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars->fUsePerm = 1; pPars->fUsePerm = 1;
pPars->pLutLib = NULL; pPars->pLutLib = NULL;
} }
// modify for global delay optimization // modify for delay optimization
if ( pPars->fDelayOpt ) if ( pPars->fDelayOpt || pPars->fDsdBalance )
{ {
pPars->fTruth = 1; pPars->fTruth = 1;
pPars->fCutMin = 1; pPars->fCutMin = 1;
...@@ -29851,7 +29858,7 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -29851,7 +29858,7 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars->fUsePerm = 1; pPars->fUsePerm = 1;
pPars->pLutLib = NULL; pPars->pLutLib = NULL;
} }
// modify for global delay optimization // modify for delay optimization
if ( pPars->nGateSize > 0 ) if ( pPars->nGateSize > 0 )
{ {
pPars->fTruth = 1; pPars->fTruth = 1;
...@@ -29924,7 +29931,7 @@ usage: ...@@ -29924,7 +29931,7 @@ usage:
sprintf(LutSize, "library" ); sprintf(LutSize, "library" );
else else
sprintf(LutSize, "%d", pPars->nLutSize ); sprintf(LutSize, "%d", pPars->nLutSize );
Abc_Print( -2, "usage: &if [-KCFAGRT num] [-DEW float] [-S str] [-qarlepmsdbgyojikfuztncvh]\n" ); Abc_Print( -2, "usage: &if [-KCFAGRT num] [-DEW float] [-S str] [-qarlepmsdbgxyojikfuztncvh]\n" );
Abc_Print( -2, "\t performs FPGA technology mapping of the network\n" ); Abc_Print( -2, "\t performs FPGA technology mapping of the network\n" );
Abc_Print( -2, "\t-K num : the number of LUT inputs (2 < num < %d) [default = %s]\n", IF_MAX_LUTSIZE+1, LutSize ); Abc_Print( -2, "\t-K num : the number of LUT inputs (2 < num < %d) [default = %s]\n", IF_MAX_LUTSIZE+1, LutSize );
Abc_Print( -2, "\t-C num : the max number of priority cuts (0 < num < 2^12) [default = %d]\n", pPars->nCutsMax ); Abc_Print( -2, "\t-C num : the max number of priority cuts (0 < num < 2^12) [default = %d]\n", pPars->nCutsMax );
...@@ -29948,6 +29955,7 @@ usage: ...@@ -29948,6 +29955,7 @@ usage:
Abc_Print( -2, "\t-d : toggles deriving local AIGs using bi-decomposition [default = %s]\n", pPars->fBidec? "yes": "no" ); Abc_Print( -2, "\t-d : toggles deriving local AIGs using bi-decomposition [default = %s]\n", pPars->fBidec? "yes": "no" );
Abc_Print( -2, "\t-b : toggles the use of one special feature [default = %s]\n", pPars->fUseBat? "yes": "no" ); Abc_Print( -2, "\t-b : toggles the use of one special feature [default = %s]\n", pPars->fUseBat? "yes": "no" );
Abc_Print( -2, "\t-g : toggles delay optimization by SOP balancing [default = %s]\n", pPars->fDelayOpt? "yes": "no" ); Abc_Print( -2, "\t-g : toggles delay optimization by SOP balancing [default = %s]\n", pPars->fDelayOpt? "yes": "no" );
Abc_Print( -2, "\t-x : toggles delay optimization by DSD balancing [default = %s]\n", pPars->fDsdBalance? "yes": "no" );
Abc_Print( -2, "\t-y : toggles delay optimization with recorded library [default = %s]\n", pPars->fUserRecLib? "yes": "no" ); Abc_Print( -2, "\t-y : toggles delay optimization with recorded library [default = %s]\n", pPars->fUserRecLib? "yes": "no" );
Abc_Print( -2, "\t-o : toggles using buffers to decouple combinational outputs [default = %s]\n", pPars->fUseBuffs? "yes": "no" ); Abc_Print( -2, "\t-o : toggles using buffers to decouple combinational outputs [default = %s]\n", pPars->fUseBuffs? "yes": "no" );
Abc_Print( -2, "\t-j : toggles enabling additional check [default = %s]\n", pPars->fEnableCheck07? "yes": "no" ); Abc_Print( -2, "\t-j : toggles enabling additional check [default = %s]\n", pPars->fEnableCheck07? "yes": "no" );
...@@ -356,7 +356,7 @@ Abc_Ntk_t * Abc_NtkFromIf( If_Man_t * pIfMan, Abc_Ntk_t * pNtk ) ...@@ -356,7 +356,7 @@ Abc_Ntk_t * Abc_NtkFromIf( If_Man_t * pIfMan, Abc_Ntk_t * pNtk )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
Hop_Obj_t * Abc_NodeTruthToHopInt( Hop_Man_t * pMan, Vec_Wrd_t * vAnds, int nVars ) Hop_Obj_t * Abc_NodeFromSopBalanceInt( Hop_Man_t * pMan, Vec_Wrd_t * vAnds, int nVars )
{ {
Vec_Ptr_t * vResults; Vec_Ptr_t * vResults;
Hop_Obj_t * pRes0, * pRes1, * pRes = NULL; Hop_Obj_t * pRes0, * pRes1, * pRes = NULL;
...@@ -387,24 +387,64 @@ Hop_Obj_t * Abc_NodeTruthToHopInt( Hop_Man_t * pMan, Vec_Wrd_t * vAnds, int nVar ...@@ -387,24 +387,64 @@ Hop_Obj_t * Abc_NodeTruthToHopInt( Hop_Man_t * pMan, Vec_Wrd_t * vAnds, int nVar
Vec_PtrFree( vResults ); Vec_PtrFree( vResults );
return Hop_NotCond( pRes, This.fCompl ); return Hop_NotCond( pRes, This.fCompl );
} }
Hop_Obj_t * Abc_NodeFromSopBalance( Hop_Man_t * pMan, If_Man_t * p, If_Cut_t * pCut )
{
Hop_Obj_t * pResult;
Vec_Wrd_t * vArray;
vArray = If_CutDelaySopArray( p, pCut );
pResult = Abc_NodeFromSopBalanceInt( pMan, vArray, If_CutLeaveNum(pCut) );
// Vec_WrdFree( vArray );
return pResult;
}
/**Function************************************************************* /**Function*************************************************************
Synopsis [Creates the mapped network.] Synopsis [Inserts the entry while sorting them by delay.]
Description [Assuming the copy field of the mapped nodes are NULL.] Description []
SideEffects [] SideEffects []
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
Hop_Obj_t * Abc_NodeTruthToHop( Hop_Man_t * pMan, If_Man_t * p, If_Cut_t * pCut ) Hop_Obj_t * Abc_NodeFromDsdBalanceInt( Hop_Man_t * pMan, Vec_Wrd_t * vAnds, int nVars )
{
Vec_Ptr_t * vResults;
Hop_Obj_t * pRes0, * pRes1, * pRes = NULL;
If_And_t This;
word Entry;
int i;
if ( Vec_WrdSize(vAnds) == 0 )
return Hop_ManConst0(pMan);
if ( Vec_WrdSize(vAnds) == 1 && Vec_WrdEntry(vAnds,0) == 0 )
return Hop_ManConst1(pMan);
vResults = Vec_PtrAlloc( Vec_WrdSize(vAnds) );
for ( i = 0; i < nVars; i++ )
Vec_PtrPush( vResults, Hop_IthVar(pMan, i) );
Vec_WrdForEachEntryStart( vAnds, Entry, i, nVars )
{
This = If_WrdToAnd( Entry );
pRes0 = Hop_NotCond( (Hop_Obj_t *)Vec_PtrEntry(vResults, This.iFan0), This.fCompl0 );
pRes1 = Hop_NotCond( (Hop_Obj_t *)Vec_PtrEntry(vResults, This.iFan1), This.fCompl1 );
pRes = Hop_And( pMan, pRes0, pRes1 );
Vec_PtrPush( vResults, pRes );
/*
printf( "fan0 = %c%d fan1 = %c%d Del = %d\n",
This.fCompl0? '-':'+', This.iFan0,
This.fCompl1? '-':'+', This.iFan1,
This.Delay );
*/
}
Vec_PtrFree( vResults );
return Hop_NotCond( pRes, This.fCompl );
}
Hop_Obj_t * Abc_NodeFromDsdBalance( Hop_Man_t * pMan, If_Man_t * p, If_Cut_t * pCut )
{ {
Hop_Obj_t * pResult; Hop_Obj_t * pResult;
Vec_Wrd_t * vArray; Vec_Wrd_t * vArray;
vArray = If_CutDelaySopArray( p, pCut ); vArray = If_CutDelaySopArray( p, pCut );
pResult = Abc_NodeTruthToHopInt( pMan, vArray, If_CutLeaveNum(pCut) ); pResult = Abc_NodeFromDsdBalanceInt( pMan, vArray, If_CutLeaveNum(pCut) );
// Vec_WrdFree( vArray ); // Vec_WrdFree( vArray );
return pResult; return pResult;
} }
...@@ -437,7 +477,7 @@ Abc_Obj_t * Abc_NodeFromIf_rec( Abc_Ntk_t * pNtkNew, If_Man_t * pIfMan, If_Obj_t ...@@ -437,7 +477,7 @@ Abc_Obj_t * Abc_NodeFromIf_rec( Abc_Ntk_t * pNtkNew, If_Man_t * pIfMan, If_Obj_t
pCutBest = If_ObjCutBest( pIfObj ); pCutBest = If_ObjCutBest( pIfObj );
// printf( "%d 0x%02X %d\n", pCutBest->nLeaves, 0xff & *If_CutTruth(pCutBest), pIfMan->pPars->pFuncCost(pCutBest) ); // printf( "%d 0x%02X %d\n", pCutBest->nLeaves, 0xff & *If_CutTruth(pCutBest), pIfMan->pPars->pFuncCost(pCutBest) );
// if ( pIfMan->pPars->pLutLib && pIfMan->pPars->pLutLib->fVarPinDelays ) // if ( pIfMan->pPars->pLutLib && pIfMan->pPars->pLutLib->fVarPinDelays )
if ( !pIfMan->pPars->fUseTtPerm && !pIfMan->pPars->fDelayOpt && !pIfMan->pPars->pLutStruct && !pIfMan->pPars->fUserRecLib && !pIfMan->pPars->nGateSize ) if ( !pIfMan->pPars->fUseTtPerm && !pIfMan->pPars->fDelayOpt && !pIfMan->pPars->fDsdBalance && !pIfMan->pPars->pLutStruct && !pIfMan->pPars->fUserRecLib && !pIfMan->pPars->nGateSize )
If_CutRotatePins( pIfMan, pCutBest ); If_CutRotatePins( pIfMan, pCutBest );
if ( pIfMan->pPars->fUseCnfs || pIfMan->pPars->fUseMv ) if ( pIfMan->pPars->fUseCnfs || pIfMan->pPars->fUseMv )
{ {
...@@ -486,8 +526,13 @@ Abc_Obj_t * Abc_NodeFromIf_rec( Abc_Ntk_t * pNtkNew, If_Man_t * pIfMan, If_Obj_t ...@@ -486,8 +526,13 @@ Abc_Obj_t * Abc_NodeFromIf_rec( Abc_Ntk_t * pNtkNew, If_Man_t * pIfMan, If_Obj_t
} }
else if ( pIfMan->pPars->fDelayOpt ) else if ( pIfMan->pPars->fDelayOpt )
{ {
extern Hop_Obj_t * Abc_NodeTruthToHop( Hop_Man_t * pMan, If_Man_t * pIfMan, If_Cut_t * pCut ); extern Hop_Obj_t * Abc_NodeFromSopBalance( Hop_Man_t * pMan, If_Man_t * pIfMan, If_Cut_t * pCut );
pNodeNew->pData = Abc_NodeTruthToHop( (Hop_Man_t *)pNtkNew->pManFunc, pIfMan, pCutBest ); pNodeNew->pData = Abc_NodeFromSopBalance( (Hop_Man_t *)pNtkNew->pManFunc, pIfMan, pCutBest );
}
else if ( pIfMan->pPars->fDsdBalance )
{
extern Hop_Obj_t * Abc_NodeFromDsdBalance( Hop_Man_t * pMan, If_Man_t * pIfMan, If_Cut_t * pCut );
pNodeNew->pData = Abc_NodeFromDsdBalance( (Hop_Man_t *)pNtkNew->pManFunc, pIfMan, pCutBest );
} }
else if ( pIfMan->pPars->fUserRecLib ) else if ( pIfMan->pPars->fUserRecLib )
{ {
......
...@@ -134,6 +134,7 @@ struct If_Par_t_ ...@@ -134,6 +134,7 @@ struct If_Par_t_
float WireDelay; // wire delay float WireDelay; // wire delay
// internal parameters // internal parameters
int fDelayOpt; // special delay optimization int fDelayOpt; // special delay optimization
int fDsdBalance; // special delay optimization
int fUserRecLib; // use recorded library int fUserRecLib; // use recorded library
int fSkipCutFilter;// skip cut filter int fSkipCutFilter;// skip cut filter
int fAreaOnly; // area only mode int fAreaOnly; // area only mode
...@@ -546,6 +547,8 @@ extern int If_DsdManLutSize( If_DsdMan_t * p ); ...@@ -546,6 +547,8 @@ extern int If_DsdManLutSize( If_DsdMan_t * p );
extern int If_DsdManSuppSize( If_DsdMan_t * p, int iDsd ); extern int If_DsdManSuppSize( If_DsdMan_t * p, int iDsd );
extern int If_DsdManCheckDec( If_DsdMan_t * p, int iDsd ); extern int If_DsdManCheckDec( If_DsdMan_t * p, int iDsd );
extern unsigned If_DsdManCheckXY( If_DsdMan_t * p, int iDsd, int LutSize, int fDerive, int fHighEffort, int fVerbose ); extern unsigned If_DsdManCheckXY( If_DsdMan_t * p, int iDsd, int LutSize, int fDerive, int fHighEffort, int fVerbose );
extern int If_DsdCutBalanceCost( If_Man_t * pIfMan, If_Cut_t * pCut );
extern int If_DsdCutBalance( void * pGia, If_Man_t * pIfMan, If_Cut_t * pCut, Vec_Int_t * vLeaves, int fHash );
/*=== ifLib.c =============================================================*/ /*=== ifLib.c =============================================================*/
extern If_LibLut_t * If_LibLutRead( char * FileName ); extern If_LibLut_t * If_LibLutRead( char * FileName );
extern If_LibLut_t * If_LibLutDup( If_LibLut_t * p ); extern If_LibLut_t * If_LibLutDup( If_LibLut_t * p );
......
...@@ -1849,6 +1849,28 @@ void If_DsdManTest() ...@@ -1849,6 +1849,28 @@ void If_DsdManTest()
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
int If_DsdCutBalanceCost( If_Man_t * pIfMan, If_Cut_t * pCut )
{
return 0;
}
int If_DsdCutBalance( void * pGia, If_Man_t * pIfMan, If_Cut_t * pCut, Vec_Int_t * vLeaves, int fHash )
{
Gia_Man_t * p = (Gia_Man_t *)pGia;
return 0;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void If_DsdManTune( If_DsdMan_t * p, int LutSize, int fFast, int fAdd, int fSpec, int fVerbose ) void If_DsdManTune( If_DsdMan_t * p, int LutSize, int fFast, int fAdd, int fSpec, int fVerbose )
{ {
ProgressBar * pProgress = NULL; ProgressBar * pProgress = NULL;
......
...@@ -99,6 +99,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep ...@@ -99,6 +99,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
If_Cut_t * pCut0R, * pCut1R; If_Cut_t * pCut0R, * pCut1R;
int fFunc0R, fFunc1R; int fFunc0R, fFunc1R;
int i, k, v, fChange; int i, k, v, fChange;
int fSave0 = p->pPars->fDelayOpt || p->pPars->fDsdBalance || p->pPars->fUserRecLib;
assert( p->pPars->fSeqMap || !If_ObjIsAnd(pObj->pFanin0) || pObj->pFanin0->pCutSet->nCuts > 0 ); assert( p->pPars->fSeqMap || !If_ObjIsAnd(pObj->pFanin0) || pObj->pFanin0->pCutSet->nCuts > 0 );
assert( p->pPars->fSeqMap || !If_ObjIsAnd(pObj->pFanin1) || pObj->pFanin1->pCutSet->nCuts > 0 ); assert( p->pPars->fSeqMap || !If_ObjIsAnd(pObj->pFanin1) || pObj->pFanin1->pCutSet->nCuts > 0 );
...@@ -122,12 +123,14 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep ...@@ -122,12 +123,14 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
if ( !fFirst ) if ( !fFirst )
{ {
// recompute the parameters of the best cut // recompute the parameters of the best cut
if ( p->pPars->fUserRecLib ) if ( p->pPars->fDelayOpt )
pCut->Delay = If_CutDelayRecCost3(p, pCut, pObj); pCut->Delay = If_CutDelaySopCost( p, pCut );
else if(p->pPars->fDelayOpt) else if ( p->pPars->fDsdBalance )
pCut->Delay = If_CutDelaySopCost(p,pCut); pCut->Delay = If_DsdCutBalanceCost( p, pCut );
else if(p->pPars->nGateSize > 0) else if ( p->pPars->fUserRecLib )
pCut->Delay = If_CutDelaySop(p,pCut); pCut->Delay = If_CutDelayRecCost3( p, pCut, pObj );
else if( p->pPars->nGateSize > 0 )
pCut->Delay = If_CutDelaySop( p, pCut );
else else
pCut->Delay = If_CutDelay( p, pObj, pCut ); pCut->Delay = If_CutDelay( p, pObj, pCut );
// assert( pCut->Delay <= pObj->Required + p->fEpsilon ); // assert( pCut->Delay <= pObj->Required + p->fEpsilon );
...@@ -184,7 +187,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep ...@@ -184,7 +187,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
p->nCutsMerged++; p->nCutsMerged++;
p->nCutsTotal++; p->nCutsTotal++;
// check if this cut is contained in any of the available cuts // check if this cut is contained in any of the available cuts
if ( !p->pPars->fSkipCutFilter && If_CutFilter( pCutSet, pCut, p->pPars->fUserRecLib || p->pPars->fDelayOpt ) ) if ( !p->pPars->fSkipCutFilter && If_CutFilter( pCutSet, pCut, fSave0 ) )
continue; continue;
// compute the truth table // compute the truth table
pCut->iCutFunc = -1; pCut->iCutFunc = -1;
...@@ -202,7 +205,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep ...@@ -202,7 +205,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
fChange = If_CutComputeTruth( p, pCut, pCut0, pCut1, pObj->fCompl0, pObj->fCompl1 ); fChange = If_CutComputeTruth( p, pCut, pCut0, pCut1, pObj->fCompl0, pObj->fCompl1 );
if ( p->pPars->fVerbose ) if ( p->pPars->fVerbose )
p->timeCache[4] += Abc_Clock() - clk; p->timeCache[4] += Abc_Clock() - clk;
if ( !p->pPars->fSkipCutFilter && fChange && If_CutFilter( pCutSet, pCut, p->pPars->fUserRecLib || p->pPars->fDelayOpt ) ) if ( !p->pPars->fSkipCutFilter && fChange && If_CutFilter( pCutSet, pCut, fSave0 ) )
continue; continue;
if ( p->pPars->fUseDsd ) if ( p->pPars->fUseDsd )
{ {
...@@ -276,19 +279,16 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep ...@@ -276,19 +279,16 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
if ( pCut->Cost == IF_COST_MAX ) if ( pCut->Cost == IF_COST_MAX )
continue; continue;
// check if the cut satisfies the required times // check if the cut satisfies the required times
/// if ( p->pPars->pLutStruct ) if ( p->pPars->fDelayOpt )
/// pCut->Delay = If_CutDelayLutStruct( p, pCut, p->pPars->pLutStruct, p->pPars->WireDelay ); pCut->Delay = If_CutDelaySopCost( p, pCut );
if ( p->pPars->fUserRecLib ) else if ( p->pPars->fDsdBalance )
pCut->Delay = If_CutDelayRecCost3(p, pCut, pObj); pCut->Delay = If_DsdCutBalanceCost( p, pCut );
else if (p->pPars->fDelayOpt) else if ( p->pPars->fUserRecLib )
pCut->Delay = If_CutDelaySopCost(p, pCut); pCut->Delay = If_CutDelayRecCost3( p, pCut, pObj );
else if(p->pPars->nGateSize > 0) else if( p->pPars->nGateSize > 0 )
pCut->Delay = If_CutDelaySop(p,pCut); pCut->Delay = If_CutDelaySop( p, pCut );
else else
pCut->Delay = If_CutDelay( p, pObj, pCut ); pCut->Delay = If_CutDelay( p, pObj, pCut );
//if ( pCut->Cost == IF_COST_MAX )
// continue;
// Abc_Print( 1, "%.2f ", pCut->Delay );
if ( Mode && pCut->Delay > pObj->Required + p->fEpsilon ) if ( Mode && pCut->Delay > pObj->Required + p->fEpsilon )
continue; continue;
// compute area of the cut (this area may depend on the application specific cost) // compute area of the cut (this area may depend on the application specific cost)
...@@ -352,7 +352,7 @@ void If_ObjPerformMappingChoice( If_Man_t * p, If_Obj_t * pObj, int Mode, int fP ...@@ -352,7 +352,7 @@ void If_ObjPerformMappingChoice( If_Man_t * p, If_Obj_t * pObj, int Mode, int fP
If_Set_t * pCutSet; If_Set_t * pCutSet;
If_Obj_t * pTemp; If_Obj_t * pTemp;
If_Cut_t * pCutTemp, * pCut; If_Cut_t * pCutTemp, * pCut;
int i; int i, fSave0 = p->pPars->fDelayOpt || p->pPars->fDsdBalance || p->pPars->fUserRecLib;
assert( pObj->pEquiv != NULL ); assert( pObj->pEquiv != NULL );
// prepare // prepare
...@@ -369,8 +369,6 @@ void If_ObjPerformMappingChoice( If_Man_t * p, If_Obj_t * pObj, int Mode, int fP ...@@ -369,8 +369,6 @@ void If_ObjPerformMappingChoice( If_Man_t * p, If_Obj_t * pObj, int Mode, int fP
// generate cuts // generate cuts
for ( pTemp = pObj->pEquiv; pTemp; pTemp = pTemp->pEquiv ) for ( pTemp = pObj->pEquiv; pTemp; pTemp = pTemp->pEquiv )
{ {
// assert( pTemp->nRefs == 0 );
// assert( p->pPars->fSeqMap || pTemp->pCutSet->nCuts > 0 ); // June 9, 2009
if ( pTemp->pCutSet->nCuts == 0 ) if ( pTemp->pCutSet->nCuts == 0 )
continue; continue;
// go through the cuts of this node // go through the cuts of this node
...@@ -385,10 +383,10 @@ void If_ObjPerformMappingChoice( If_Man_t * p, If_Obj_t * pObj, int Mode, int fP ...@@ -385,10 +383,10 @@ void If_ObjPerformMappingChoice( If_Man_t * p, If_Obj_t * pObj, int Mode, int fP
// copy the cut into storage // copy the cut into storage
If_CutCopy( p, pCut, pCutTemp ); If_CutCopy( p, pCut, pCutTemp );
// check if this cut is contained in any of the available cuts // check if this cut is contained in any of the available cuts
if ( If_CutFilter( pCutSet, pCut, p->pPars->fUserRecLib || p->pPars->fDelayOpt ) ) if ( If_CutFilter( pCutSet, pCut, fSave0 ) )
continue; continue;
// check if the cut satisfies the required times // check if the cut satisfies the required times
assert( pCut->Delay == If_CutDelay( p, pTemp, pCut ) ); // assert( pCut->Delay == If_CutDelay( p, pTemp, pCut ) );
if ( Mode && pCut->Delay > pObj->Required + p->fEpsilon ) if ( Mode && pCut->Delay > pObj->Required + p->fEpsilon )
continue; continue;
// set the phase attribute // set the phase attribute
......
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