Commit a43d8273 by Alan Mishchenko

Changes for delay-oriented computation.

parent 61d46232
...@@ -5173,7 +5173,7 @@ int Abc_CommandMfs3( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -5173,7 +5173,7 @@ int Abc_CommandMfs3( Abc_Frame_t * pAbc, int argc, char ** argv )
// set defaults // set defaults
Sfm_ParSetDefault3( pPars ); Sfm_ParSetDefault3( pPars );
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "OIFLHDMCNPdamzospvwh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "OIFLHDMCNPWdamzospvwh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -5290,6 +5290,17 @@ int Abc_CommandMfs3( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -5290,6 +5290,17 @@ int Abc_CommandMfs3( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( pPars->iNodeOne < 0 ) if ( pPars->iNodeOne < 0 )
goto usage; goto usage;
break; break;
case 'W':
if ( globalUtilOptind >= argc )
{
Abc_Print( -1, "Command line switch \"-W\" should be followed by an integer.\n" );
goto usage;
}
pPars->nTimeWin = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
if ( pPars->nTimeWin < 0 || pPars->nTimeWin > 100 )
goto usage;
break;
case 'a': case 'a':
pPars->fArea ^= 1; pPars->fArea ^= 1;
break; break;
...@@ -5335,7 +5346,7 @@ int Abc_CommandMfs3( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -5335,7 +5346,7 @@ int Abc_CommandMfs3( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0; return 0;
usage: usage:
Abc_Print( -2, "usage: mfs3 [-OIFLHDMCNP <num>] [-amzospvwh]\n" ); Abc_Print( -2, "usage: mfs3 [-OIFLHDMCNPW <num>] [-amzospvwh]\n" );
Abc_Print( -2, "\t performs don't-care-based optimization of mapped networks\n" ); Abc_Print( -2, "\t performs don't-care-based optimization of mapped networks\n" );
Abc_Print( -2, "\t-O <num> : the number of levels in the TFO cone (0 <= num) [default = %d]\n", pPars->nTfoLevMax ); Abc_Print( -2, "\t-O <num> : the number of levels in the TFO cone (0 <= num) [default = %d]\n", pPars->nTfoLevMax );
Abc_Print( -2, "\t-I <num> : the number of levels in the TFI cone (1 <= num) [default = %d]\n", pPars->nTfiLevMax ); Abc_Print( -2, "\t-I <num> : the number of levels in the TFI cone (1 <= num) [default = %d]\n", pPars->nTfiLevMax );
...@@ -5347,6 +5358,7 @@ usage: ...@@ -5347,6 +5358,7 @@ usage:
Abc_Print( -2, "\t-C <num> : the max number of conflicts in one SAT run (0 = no limit) [default = %d]\n", pPars->nBTLimit ); Abc_Print( -2, "\t-C <num> : the max number of conflicts in one SAT run (0 = no limit) [default = %d]\n", pPars->nBTLimit );
Abc_Print( -2, "\t-N <num> : the max number of nodes to try (0 = all) [default = %d]\n", pPars->nNodesMax ); Abc_Print( -2, "\t-N <num> : the max number of nodes to try (0 = all) [default = %d]\n", pPars->nNodesMax );
Abc_Print( -2, "\t-P <num> : one particular node to try (0 = none) [default = %d]\n", pPars->iNodeOne ); Abc_Print( -2, "\t-P <num> : one particular node to try (0 = none) [default = %d]\n", pPars->iNodeOne );
Abc_Print( -2, "\t-W <num> : size of timing window in percents (0 <= num <= 100) [default = %d]\n", pPars->nTimeWin );
Abc_Print( -2, "\t-a : toggle area minimization [default = %s]\n", pPars->fArea? "yes": "no" ); Abc_Print( -2, "\t-a : toggle area minimization [default = %s]\n", pPars->fArea? "yes": "no" );
Abc_Print( -2, "\t-m : toggle detecting multi-input AND/OR gates [default = %s]\n", pPars->fUseAndOr? "yes": "no" ); Abc_Print( -2, "\t-m : toggle detecting multi-input AND/OR gates [default = %s]\n", pPars->fUseAndOr? "yes": "no" );
Abc_Print( -2, "\t-z : toggle zero-cost replacements [default = %s]\n", pPars->fZeroCost? "yes": "no" ); Abc_Print( -2, "\t-z : toggle zero-cost replacements [default = %s]\n", pPars->fZeroCost? "yes": "no" );
...@@ -55,6 +55,7 @@ struct Sfm_Par_t_ ...@@ -55,6 +55,7 @@ struct Sfm_Par_t_
int nNodesMax; // the maximum number of nodes to try int nNodesMax; // the maximum number of nodes to try
int iNodeOne; // one particular node to try int iNodeOne; // one particular node to try
int nFirstFixed; // the number of first nodes to be treated as fixed int nFirstFixed; // the number of first nodes to be treated as fixed
int nTimeWin; // the size of timing window in percents
int fRrOnly; // perform redundance removal int fRrOnly; // perform redundance removal
int fArea; // performs optimization for area int fArea; // performs optimization for area
int fMoreEffort; // performs high-affort minimization int fMoreEffort; // performs high-affort minimization
......
...@@ -218,9 +218,9 @@ extern int Sfm_TimReadNtkDelay( Sfm_Tim_t * p ); ...@@ -218,9 +218,9 @@ extern int Sfm_TimReadNtkDelay( Sfm_Tim_t * p );
extern int Sfm_TimReadObjDelay( Sfm_Tim_t * p, int iObj ); extern int Sfm_TimReadObjDelay( Sfm_Tim_t * p, int iObj );
extern void Sfm_TimUpdateTiming( Sfm_Tim_t * p, Vec_Int_t * vTimeNodes ); extern void Sfm_TimUpdateTiming( Sfm_Tim_t * p, Vec_Int_t * vTimeNodes );
extern int Sfm_TimSortArrayByArrival( Sfm_Tim_t * p, Vec_Int_t * vNodes, int iPivot ); extern int Sfm_TimSortArrayByArrival( Sfm_Tim_t * p, Vec_Int_t * vNodes, int iPivot );
extern int Sfm_TimPriorityNodes( Sfm_Tim_t * p, Vec_Int_t * vCands ); extern int Sfm_TimPriorityNodes( Sfm_Tim_t * p, Vec_Int_t * vCands, int Window );
extern int Sfm_TimNodeIsNonCritical( Sfm_Tim_t * p, Abc_Obj_t * pPivot, Abc_Obj_t * pNode ); extern int Sfm_TimNodeIsNonCritical( Sfm_Tim_t * p, Abc_Obj_t * pPivot, Abc_Obj_t * pNode );
extern int Sfm_TimEvalRemapping( Sfm_Tim_t * p, Vec_Int_t * vFanins, Mio_Gate_t * pGate1, char * pFans1, Mio_Gate_t * pGate2, char * pFans2 ); extern int Sfm_TimEvalRemapping( Sfm_Tim_t * p, Vec_Int_t * vFanins, Vec_Int_t * vMap, Mio_Gate_t * pGate1, char * pFans1, Mio_Gate_t * pGate2, char * pFans2 );
/*=== sfmWin.c ==========================================================*/ /*=== sfmWin.c ==========================================================*/
extern int Sfm_ObjMffcSize( Sfm_Ntk_t * p, int iObj ); extern int Sfm_ObjMffcSize( Sfm_Ntk_t * p, int iObj );
extern int Sfm_NtkCreateWindow( Sfm_Ntk_t * p, int iNode, int fVerbose ); extern int Sfm_NtkCreateWindow( Sfm_Ntk_t * p, int iNode, int fVerbose );
......
...@@ -509,15 +509,18 @@ void Sfm_LibPrintObj( Sfm_Lib_t * p, Sfm_Fun_t * pObj ) ...@@ -509,15 +509,18 @@ void Sfm_LibPrintObj( Sfm_Lib_t * p, Sfm_Fun_t * pObj )
} }
void Sfm_LibPrint( Sfm_Lib_t * p ) void Sfm_LibPrint( Sfm_Lib_t * p )
{ {
word * pTruth; Sfm_Fun_t * pObj; int iFunc; word * pTruth; Sfm_Fun_t * pObj; int iFunc, nSupp;
Vec_MemForEachEntry( p->vTtMem, pTruth, iFunc ) Vec_MemForEachEntry( p->vTtMem, pTruth, iFunc )
{ {
if ( iFunc < 2 ) if ( iFunc < 2 )
continue; continue;
nSupp = Abc_TtSupportSize(pTruth, 6);
if ( nSupp > 3 )
continue;
//if ( iFunc % 10000 ) //if ( iFunc % 10000 )
// continue; // continue;
printf( "%d : Count = %d ", iFunc, Vec_IntEntry(&p->vCounts, iFunc) ); printf( "%d : Count = %d ", iFunc, Vec_IntEntry(&p->vCounts, iFunc) );
Dau_DsdPrintFromTruth( pTruth, Abc_TtSupportSize(pTruth, 6) ); Dau_DsdPrintFromTruth( pTruth, nSupp );
Sfm_LibForEachSuper( p, pObj, iFunc ) Sfm_LibForEachSuper( p, pObj, iFunc )
Sfm_LibPrintObj( p, pObj ); Sfm_LibPrintObj( p, pObj );
} }
...@@ -565,8 +568,8 @@ int Sfm_LibFindMatches( Sfm_Lib_t * p, word uTruth, int * pFanins, int nFanins, ...@@ -565,8 +568,8 @@ int Sfm_LibFindMatches( Sfm_Lib_t * p, word uTruth, int * pFanins, int nFanins,
{ {
pCellB = p->pCells + (int)pObj->pFansB[0]; pCellB = p->pCells + (int)pObj->pFansB[0];
pCellT = p->pCells + (int)pObj->pFansT[0]; pCellT = p->pCells + (int)pObj->pFansT[0];
Vec_PtrPush( vGates, pCellB ); Vec_PtrPush( vGates, pCellB->pMioGate );
Vec_PtrPush( vGates, pCellT == p->pCells ? NULL : pCellT ); Vec_PtrPush( vGates, pCellT == p->pCells ? NULL : pCellT->pMioGate );
Vec_PtrPush( vFans, pObj->pFansB + 1 ); Vec_PtrPush( vFans, pObj->pFansB + 1 );
Vec_PtrPush( vFans, pCellT == p->pCells ? NULL : pObj->pFansT + 1 ); Vec_PtrPush( vFans, pCellT == p->pCells ? NULL : pObj->pFansT + 1 );
} }
...@@ -599,6 +602,7 @@ int Sfm_LibAddNewGates( Sfm_Lib_t * p, int * pFanins, Mio_Gate_t * pGateB, Mio_G ...@@ -599,6 +602,7 @@ int Sfm_LibAddNewGates( Sfm_Lib_t * p, int * pFanins, Mio_Gate_t * pGateB, Mio_G
// create top gate // create top gate
Vec_IntPush( vGates, Mio_GateReadValue(pGateT) ); Vec_IntPush( vGates, Mio_GateReadValue(pGateT) );
vLevel = Vec_WecPushLevel( vFanins ); vLevel = Vec_WecPushLevel( vFanins );
nFanins = Mio_GateReadPinNum( pGateT );
for ( i = 0; i < nFanins; i++ ) for ( i = 0; i < nFanins; i++ )
if ( pFansT[i] == (char)16 ) if ( pFansT[i] == (char)16 )
Vec_IntPush( vLevel, Vec_WecSize(vFanins)-2 ); Vec_IntPush( vLevel, Vec_WecSize(vFanins)-2 );
......
...@@ -242,11 +242,11 @@ Sfm_Tim_t * Sfm_TimStart( Mio_Library_t * pLib, Scl_Con_t * pExt, Abc_Ntk_t * pN ...@@ -242,11 +242,11 @@ Sfm_Tim_t * Sfm_TimStart( Mio_Library_t * pLib, Scl_Con_t * pExt, Abc_Ntk_t * pN
p->pLib = pLib; p->pLib = pLib;
p->pExt = pExt; p->pExt = pExt;
p->pNtk = pNtk; p->pNtk = pNtk;
Vec_IntFill( &p->vTimArrs, 2*Abc_NtkObjNumMax(pNtk), 0 ); Vec_IntFill( &p->vTimArrs, 4*Abc_NtkObjNumMax(pNtk), 0 );
Vec_IntFill( &p->vTimReqs, 2*Abc_NtkObjNumMax(pNtk), 0 ); Vec_IntFill( &p->vTimReqs, 4*Abc_NtkObjNumMax(pNtk), 0 );
// Vec_IntFill( &p->vTimSlews, 2*Abc_NtkObjNumMax(pNtk), 0 ); // Vec_IntFill( &p->vTimSlews, 4*Abc_NtkObjNumMax(pNtk), 0 );
// Vec_IntFill( &p->vTimLoads, 2*Abc_NtkObjNumMax(pNtk), 0 ); // Vec_IntFill( &p->vTimLoads, 4*Abc_NtkObjNumMax(pNtk), 0 );
// Vec_IntFill( &p->vObjOffs, Abc_NtkObjNumMax(pNtk), 0 ); // Vec_IntFill( &p->vObjOffs, 2*Abc_NtkObjNumMax(pNtk), 0 );
// Abc_NtkForEachNode( pNtk, pObj, i ) // Abc_NtkForEachNode( pNtk, pObj, i )
// { // {
// Vec_IntWriteEntry( &p->vObjOffs, i, Vec_IntSize(Vec_IntSize(&p->vTimEdges)) ); // Vec_IntWriteEntry( &p->vObjOffs, i, Vec_IntSize(Vec_IntSize(&p->vTimEdges)) );
...@@ -264,7 +264,9 @@ void Sfm_TimStop( Sfm_Tim_t * p ) ...@@ -264,7 +264,9 @@ void Sfm_TimStop( Sfm_Tim_t * p )
Vec_IntErase( &p->vTimLoads ); Vec_IntErase( &p->vTimLoads );
Vec_IntErase( &p->vObjOffs ); Vec_IntErase( &p->vObjOffs );
Vec_IntErase( &p->vTimEdges ); Vec_IntErase( &p->vTimEdges );
Vec_WecErase( &p->vLevels );
Vec_IntErase( &p->vPath ); Vec_IntErase( &p->vPath );
Vec_WrdErase( &p->vSortData );
ABC_FREE( p ); ABC_FREE( p );
} }
int Sfm_TimReadNtkDelay( Sfm_Tim_t * p ) int Sfm_TimReadNtkDelay( Sfm_Tim_t * p )
...@@ -384,13 +386,14 @@ int Sfm_TimSortArrayByArrival( Sfm_Tim_t * p, Vec_Int_t * vNodes, int iPivot ) ...@@ -384,13 +386,14 @@ int Sfm_TimSortArrayByArrival( Sfm_Tim_t * p, Vec_Int_t * vNodes, int iPivot )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
int Sfm_TimPriorityNodes( Sfm_Tim_t * p, Vec_Int_t * vCands ) int Sfm_TimPriorityNodes( Sfm_Tim_t * p, Vec_Int_t * vCands, int Window )
{ {
Vec_Int_t * vLevel; Vec_Int_t * vLevel;
Abc_Obj_t * pObj; Abc_Obj_t * pObj;
int i; int i, k;
assert( Window >= 0 && Window <= 100 );
// collect critical path // collect critical path
Sfm_TimCriticalPath(p, 1); Sfm_TimCriticalPath( p, Window );
// add nodes to the levelized structure // add nodes to the levelized structure
Sfm_TimUpdateClean( p ); Sfm_TimUpdateClean( p );
Abc_NtkForEachObjVec( &p->vPath, p->pNtk, pObj, i ) Abc_NtkForEachObjVec( &p->vPath, p->pNtk, pObj, i )
...@@ -403,7 +406,7 @@ int Sfm_TimPriorityNodes( Sfm_Tim_t * p, Vec_Int_t * vCands ) ...@@ -403,7 +406,7 @@ int Sfm_TimPriorityNodes( Sfm_Tim_t * p, Vec_Int_t * vCands )
Vec_WecSort( &p->vLevels, 0 ); Vec_WecSort( &p->vLevels, 0 );
Vec_IntClear( vCands ); Vec_IntClear( vCands );
Vec_WecForEachLevel( &p->vLevels, vLevel, i ) Vec_WecForEachLevel( &p->vLevels, vLevel, i )
Abc_NtkForEachObjVec( vLevel, p->pNtk, pObj, i ) Abc_NtkForEachObjVec( vLevel, p->pNtk, pObj, k )
if ( !pObj->fMarkA ) if ( !pObj->fMarkA )
Vec_IntPush( vCands, Abc_ObjId(pObj) ); Vec_IntPush( vCands, Abc_ObjId(pObj) );
return Vec_IntSize(vCands) > 0; return Vec_IntSize(vCands) > 0;
...@@ -436,7 +439,7 @@ int Sfm_TimNodeIsNonCritical( Sfm_Tim_t * p, Abc_Obj_t * pPivot, Abc_Obj_t * pNo ...@@ -436,7 +439,7 @@ int Sfm_TimNodeIsNonCritical( Sfm_Tim_t * p, Abc_Obj_t * pPivot, Abc_Obj_t * pNo
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
int Sfm_TimEvalRemapping( Sfm_Tim_t * p, Vec_Int_t * vFanins, Mio_Gate_t * pGate1, char * pFans1, Mio_Gate_t * pGate2, char * pFans2 ) int Sfm_TimEvalRemapping( Sfm_Tim_t * p, Vec_Int_t * vFanins, Vec_Int_t * vMap, Mio_Gate_t * pGate1, char * pFans1, Mio_Gate_t * pGate2, char * pFans2 )
{ {
int TimeOut[2][2]; int TimeOut[2][2];
int * pTimesIn1[6], * pTimesIn2[6]; int * pTimesIn1[6], * pTimesIn2[6];
...@@ -444,7 +447,7 @@ int Sfm_TimEvalRemapping( Sfm_Tim_t * p, Vec_Int_t * vFanins, Mio_Gate_t * pGate ...@@ -444,7 +447,7 @@ int Sfm_TimEvalRemapping( Sfm_Tim_t * p, Vec_Int_t * vFanins, Mio_Gate_t * pGate
// process the first gate // process the first gate
nFanins1 = Mio_GateReadPinNum( pGate1 ); nFanins1 = Mio_GateReadPinNum( pGate1 );
for ( i = 0; i < nFanins1; i++ ) for ( i = 0; i < nFanins1; i++ )
pTimesIn1[i] = Sfm_TimArrId( p, Vec_IntEntry(vFanins, (int)pFans1[i]) ); pTimesIn1[i] = Sfm_TimArrId( p, Vec_IntEntry(vMap, Vec_IntEntry(vFanins, (int)pFans1[i])) );
Sfm_TimGateArrival( p, pGate1, pTimesIn1, TimeOut[0] ); Sfm_TimGateArrival( p, pGate1, pTimesIn1, TimeOut[0] );
if ( pGate2 == NULL ) if ( pGate2 == NULL )
return Abc_MaxInt(TimeOut[0][0], TimeOut[0][1]); return Abc_MaxInt(TimeOut[0][0], TimeOut[0][1]);
...@@ -454,7 +457,7 @@ int Sfm_TimEvalRemapping( Sfm_Tim_t * p, Vec_Int_t * vFanins, Mio_Gate_t * pGate ...@@ -454,7 +457,7 @@ int Sfm_TimEvalRemapping( Sfm_Tim_t * p, Vec_Int_t * vFanins, Mio_Gate_t * pGate
if ( (int)pFans2[i] == 16 ) if ( (int)pFans2[i] == 16 )
pTimesIn2[i] = TimeOut[0]; pTimesIn2[i] = TimeOut[0];
else else
pTimesIn2[i] = Sfm_TimArrId( p, Vec_IntEntry(vFanins, (int)pFans2[i]) ); pTimesIn2[i] = Sfm_TimArrId( p, Vec_IntEntry(vMap, Vec_IntEntry(vFanins, (int)pFans2[i])) );
Sfm_TimGateArrival( p, pGate2, pTimesIn2, TimeOut[1] ); Sfm_TimGateArrival( p, pGate2, pTimesIn2, TimeOut[1] );
return Abc_MaxInt(TimeOut[1][0], TimeOut[1][1]); return Abc_MaxInt(TimeOut[1][0], TimeOut[1][1]);
} }
......
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