Commit f10480f9 by Alan Mishchenko

Parametrizing standard-cell mapper to account for the fanout delay.

parent 8e54792c
......@@ -14391,6 +14391,7 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
double DelayTarget;
double AreaMulti;
double DelayMulti;
float LogFan = 0;
float Slew = 200;
float Gain = 100;
int nGatesMin = 4;
......@@ -14400,7 +14401,7 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
int fSwitching;
int fVerbose;
int c;
extern Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti, double DelayMulti, float Slew, float Gain, int nGatesMin, int fRecovery, int fSwitching, int fVerbose );
extern Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti, double DelayMulti, float LogFan, float Slew, float Gain, int nGatesMin, int fRecovery, int fSwitching, int fVerbose );
extern int Abc_NtkFraigSweep( Abc_Ntk_t * pNtk, int fUseInv, int fExdc, int fVerbose, int fVeryVerbose );
pNtk = Abc_FrameReadNtk(pAbc);
......@@ -14414,7 +14415,7 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
fSwitching = 0;
fVerbose = 0;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "DABSGMarspvh" ) ) != EOF )
while ( ( c = Extra_UtilGetopt( argc, argv, "DABFSGMarspvh" ) ) != EOF )
{
switch ( c )
{
......@@ -14447,6 +14448,17 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
DelayMulti = (float)atof(argv[globalUtilOptind]);
globalUtilOptind++;
break;
case 'F':
if ( globalUtilOptind >= argc )
{
Abc_Print( -1, "Command line switch \"-F\" should be followed by a floating point number.\n" );
goto usage;
}
LogFan = (float)atof(argv[globalUtilOptind]);
globalUtilOptind++;
if ( LogFan < 0.0 )
goto usage;
break;
case 'S':
if ( globalUtilOptind >= argc )
{
......@@ -14528,7 +14540,7 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
}
Abc_Print( 0, "The network was strashed and balanced before mapping.\n" );
// get the new network
pNtkRes = Abc_NtkMap( pNtk, DelayTarget, AreaMulti, DelayMulti, Slew, Gain, nGatesMin, fRecovery, fSwitching, fVerbose );
pNtkRes = Abc_NtkMap( pNtk, DelayTarget, AreaMulti, DelayMulti, LogFan, Slew, Gain, nGatesMin, fRecovery, fSwitching, fVerbose );
if ( pNtkRes == NULL )
{
Abc_NtkDelete( pNtk );
......@@ -14540,7 +14552,7 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
else
{
// get the new network
pNtkRes = Abc_NtkMap( pNtk, DelayTarget, AreaMulti, DelayMulti, Slew, Gain, nGatesMin, fRecovery, fSwitching, fVerbose );
pNtkRes = Abc_NtkMap( pNtk, DelayTarget, AreaMulti, DelayMulti, LogFan, Slew, Gain, nGatesMin, fRecovery, fSwitching, fVerbose );
if ( pNtkRes == NULL )
{
Abc_Print( -1, "Mapping has failed.\n" );
......@@ -14567,11 +14579,12 @@ usage:
sprintf(Buffer, "not used" );
else
sprintf(Buffer, "%.3f", DelayTarget );
Abc_Print( -2, "usage: map [-DABSG float] [-M num] [-arspvh]\n" );
Abc_Print( -2, "usage: map [-DABFSG float] [-M num] [-arspvh]\n" );
Abc_Print( -2, "\t performs standard cell mapping of the current network\n" );
Abc_Print( -2, "\t-D float : sets the global required times [default = %s]\n", Buffer );
Abc_Print( -2, "\t-A float : \"area multiplier\" to bias gate selection [default = %.2f]\n", AreaMulti );
Abc_Print( -2, "\t-B float : \"delay multiplier\" to bias gate selection [default = %.2f]\n", DelayMulti );
Abc_Print( -2, "\t-F float : the logarithmic fanout delay parameter [default = %.2f]\n", LogFan );
Abc_Print( -2, "\t-S float : the slew parameter used to generate the library [default = %.2f]\n", Slew );
Abc_Print( -2, "\t-G float : the gain parameter used to generate the library [default = %.2f]\n", Gain );
Abc_Print( -2, "\t-M num : skip gate classes whose size is less than this [default = %d]\n", nGatesMin );
......@@ -57,7 +57,7 @@ static Abc_Obj_t * Abc_NodeFromMapSuperChoice_rec( Abc_Ntk_t * pNtkNew, Map_Sup
SeeAlso []
***********************************************************************/
Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti, double DelayMulti, float Slew, float Gain, int nGatesMin, int fRecovery, int fSwitching, int fVerbose )
Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti, double DelayMulti, float LogFan, float Slew, float Gain, int nGatesMin, int fRecovery, int fSwitching, int fVerbose )
{
static int fUseMulti = 0;
int fShowSwitching = 1;
......@@ -125,6 +125,8 @@ Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti,
return NULL;
clk = Abc_Clock();
Map_ManSetSwitching( pMan, fSwitching );
if ( LogFan != 0 )
Map_ManCreateNodeDelays( pMan, LogFan );
if ( !Map_Mapping( pMan ) )
{
Map_ManFree( pMan );
......
......@@ -76,6 +76,7 @@ struct Map_TimeStruct_t_
/*=== mapperCreate.c =============================================================*/
extern Map_Man_t * Map_ManCreate( int nInputs, int nOutputs, int fVerbose );
extern Map_Node_t * Map_NodeCreate( Map_Man_t * p, Map_Node_t * p1, Map_Node_t * p2 );
extern void Map_ManCreateNodeDelays( Map_Man_t * p, int LogFan );
extern void Map_ManFree( Map_Man_t * pMan );
extern void Map_ManPrintTimeStats( Map_Man_t * p );
extern void Map_ManPrintStatsToFile( char * pName, float Area, float Delay, abctime Time );
......
......@@ -264,6 +264,7 @@ void Map_ManFree( Map_Man_t * p )
if ( p->pCounters ) ABC_FREE( p->pCounters );
Extra_MmFixedStop( p->mmNodes );
Extra_MmFixedStop( p->mmCuts );
ABC_FREE( p->pNodeDelays );
ABC_FREE( p->pInputArrivals );
ABC_FREE( p->pOutputRequireds );
ABC_FREE( p->pInputs );
......@@ -276,6 +277,35 @@ void Map_ManFree( Map_Man_t * p )
/**Function*************************************************************
Synopsis [Creates node delays.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Map_ManCreateNodeDelays( Map_Man_t * p, int LogFan )
{
Map_Node_t * pNode;
int k;
assert( p->pNodeDelays == NULL );
p->pNodeDelays = ABC_CALLOC( float, p->vNodesAll->nSize );
for ( k = 0; k < p->vNodesAll->nSize; k++ )
{
pNode = p->vNodesAll->pArray[k];
if ( pNode->nRefs == 0 )
continue;
p->pNodeDelays[k] = 0.014426 * LogFan * p->pSuperLib->tDelayInv.Worst * log( (double)pNode->nRefs ); // 1.4426 = 1/ln(2)
// printf( "%d = %d (%.2f) ", k, pNode->nRefs, p->pNodeDelays[k] );
}
// printf( "\n" );
}
/**Function*************************************************************
Synopsis [Deallocates the mapping manager.]
Description []
......
......@@ -102,6 +102,7 @@ struct Map_ManStruct_t_
Map_NodeVec_t * vNodesAll; // the array of all nodes
Map_NodeVec_t * vNodesTemp; // the array of all nodes
Map_NodeVec_t * vMapping; // the array of internal nodes used in the mapping
float * pNodeDelays; // the array of node delays
// info about the original circuit
char ** ppOutputNames; // the primary output names
......
......@@ -450,6 +450,9 @@ void Map_MappingSetPiArrivalTimes( Map_Man_t * p )
pNode = p->pInputs[i];
// set the arrival time of the positive phase
pNode->tArrival[1] = p->pInputArrivals[i];
pNode->tArrival[1].Rise += p->pNodeDelays ? p->pNodeDelays[pNode->Num] : 0;
pNode->tArrival[1].Fall += p->pNodeDelays ? p->pNodeDelays[pNode->Num] : 0;
pNode->tArrival[1].Worst += p->pNodeDelays ? p->pNodeDelays[pNode->Num] : 0;
// set the arrival time of the negative phase
pNode->tArrival[0].Rise = pNode->tArrival[1].Fall + p->pSuperLib->tDelayInv.Rise;
pNode->tArrival[0].Fall = pNode->tArrival[1].Rise + p->pSuperLib->tDelayInv.Fall;
......
......@@ -100,9 +100,10 @@ float Map_TimeCutComputeArrival( Map_Node_t * pNode, Map_Cut_t * pCut, int fPhas
Map_Time_t * ptArrRes = &pM->tArrive;
Map_Time_t * ptArrIn;
int fPinPhase;
float tDelay;
float tDelay, tExtra;
int i;
tExtra = pNode->p->pNodeDelays ? pNode->p->pNodeDelays[pNode->Num] : 0;
ptArrRes->Rise = ptArrRes->Fall = 0.0;
ptArrRes->Worst = MAP_FLOAT_LARGE;
for ( i = pCut->nLeaves - 1; i >= 0; i-- )
......@@ -114,7 +115,7 @@ float Map_TimeCutComputeArrival( Map_Node_t * pNode, Map_Cut_t * pCut, int fPhas
// get the rise of the output due to rise of the inputs
if ( pSuper->tDelaysR[i].Rise > 0 )
{
tDelay = ptArrIn->Rise + pSuper->tDelaysR[i].Rise;
tDelay = ptArrIn->Rise + pSuper->tDelaysR[i].Rise + tExtra;
if ( tDelay > tWorstLimit )
return MAP_FLOAT_LARGE;
if ( ptArrRes->Rise < tDelay )
......@@ -124,7 +125,7 @@ float Map_TimeCutComputeArrival( Map_Node_t * pNode, Map_Cut_t * pCut, int fPhas
// get the rise of the output due to fall of the inputs
if ( pSuper->tDelaysR[i].Fall > 0 )
{
tDelay = ptArrIn->Fall + pSuper->tDelaysR[i].Fall;
tDelay = ptArrIn->Fall + pSuper->tDelaysR[i].Fall + tExtra;
if ( tDelay > tWorstLimit )
return MAP_FLOAT_LARGE;
if ( ptArrRes->Rise < tDelay )
......@@ -134,7 +135,7 @@ float Map_TimeCutComputeArrival( Map_Node_t * pNode, Map_Cut_t * pCut, int fPhas
// get the fall of the output due to rise of the inputs
if ( pSuper->tDelaysF[i].Rise > 0 )
{
tDelay = ptArrIn->Rise + pSuper->tDelaysF[i].Rise;
tDelay = ptArrIn->Rise + pSuper->tDelaysF[i].Rise + tExtra;
if ( tDelay > tWorstLimit )
return MAP_FLOAT_LARGE;
if ( ptArrRes->Fall < tDelay )
......@@ -144,7 +145,7 @@ float Map_TimeCutComputeArrival( Map_Node_t * pNode, Map_Cut_t * pCut, int fPhas
// get the fall of the output due to fall of the inputs
if ( pSuper->tDelaysF[i].Fall > 0 )
{
tDelay = ptArrIn->Fall + pSuper->tDelaysF[i].Fall;
tDelay = ptArrIn->Fall + pSuper->tDelaysF[i].Fall + tExtra;
if ( tDelay > tWorstLimit )
return MAP_FLOAT_LARGE;
if ( ptArrRes->Fall < tDelay )
......@@ -383,10 +384,11 @@ void Map_TimePropagateRequiredPhase( Map_Man_t * p, Map_Node_t * pNode, int fPha
Map_Time_t * ptReqIn, * ptReqOut;
Map_Cut_t * pCut;
Map_Super_t * pSuper;
float tNewReqTime;
float tNewReqTime, tExtra;
unsigned uPhase;
int fPinPhase, i;
tExtra = pNode->p->pNodeDelays ? pNode->p->pNodeDelays[pNode->Num] : 0;
// get the cut to be propagated
pCut = pNode->pCutBest[fPhase];
assert( pCut != NULL );
......@@ -408,7 +410,7 @@ void Map_TimePropagateRequiredPhase( Map_Man_t * p, Map_Node_t * pNode, int fPha
// ptArrOut->Rise = ptArrIn->Rise + pSuper->tDelaysR[i].Rise;
if ( pSuper->tDelaysR[i].Rise > 0 )
{
tNewReqTime = ptReqOut->Rise - pSuper->tDelaysR[i].Rise;
tNewReqTime = ptReqOut->Rise - pSuper->tDelaysR[i].Rise - tExtra;
ptReqIn->Rise = MAP_MIN( ptReqIn->Rise, tNewReqTime );
}
......@@ -417,7 +419,7 @@ void Map_TimePropagateRequiredPhase( Map_Man_t * p, Map_Node_t * pNode, int fPha
// ptArrOut->Rise = ptArrIn->Fall + pSuper->tDelaysR[i].Fall;
if ( pSuper->tDelaysR[i].Fall > 0 )
{
tNewReqTime = ptReqOut->Rise - pSuper->tDelaysR[i].Fall;
tNewReqTime = ptReqOut->Rise - pSuper->tDelaysR[i].Fall - tExtra;
ptReqIn->Fall = MAP_MIN( ptReqIn->Fall, tNewReqTime );
}
......@@ -426,7 +428,7 @@ void Map_TimePropagateRequiredPhase( Map_Man_t * p, Map_Node_t * pNode, int fPha
// ptArrOut->Fall = ptArrIn->Rise + pSuper->tDelaysF[i].Rise;
if ( pSuper->tDelaysF[i].Rise > 0 )
{
tNewReqTime = ptReqOut->Fall - pSuper->tDelaysF[i].Rise;
tNewReqTime = ptReqOut->Fall - pSuper->tDelaysF[i].Rise - tExtra;
ptReqIn->Rise = MAP_MIN( ptReqIn->Rise, tNewReqTime );
}
......@@ -435,7 +437,7 @@ void Map_TimePropagateRequiredPhase( Map_Man_t * p, Map_Node_t * pNode, int fPha
// ptArrOut->Fall = ptArrIn->Fall + pSuper->tDelaysF[i].Fall;
if ( pSuper->tDelaysF[i].Fall > 0 )
{
tNewReqTime = ptReqOut->Fall - pSuper->tDelaysF[i].Fall;
tNewReqTime = ptReqOut->Fall - pSuper->tDelaysF[i].Fall - tExtra;
ptReqIn->Fall = MAP_MIN( ptReqIn->Fall, tNewReqTime );
}
}
......
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