Commit b8b478c8 by Alan Mishchenko

Improvements to gate-sizing.

parent caa66f0c
...@@ -373,7 +373,7 @@ int Scl_CommandGsize( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -373,7 +373,7 @@ int Scl_CommandGsize( Abc_Frame_t * pAbc, int argc, char **argv )
int c; int c;
int nSteps = 100000; int nSteps = 100000;
int nRange = 0; int nRange = 0;
int fTryAll = 0; int fTryAll = 1;
int fPrintCP = 0; int fPrintCP = 0;
int fVerbose = 0; int fVerbose = 0;
int fVeryVerbose = 0; int fVeryVerbose = 0;
......
...@@ -307,7 +307,7 @@ Abc_Obj_t * Abc_SclChooseBiggestGain( SC_Man * p, Vec_Int_t * vPath, Vec_Int_t * ...@@ -307,7 +307,7 @@ Abc_Obj_t * Abc_SclChooseBiggestGain( SC_Man * p, Vec_Int_t * vPath, Vec_Int_t *
//printf( "thresh = %8.2f ps best gain = %8.2f ps \n", SC_LibTimePs(p->pLib, GainThresh), SC_LibTimePs(p->pLib, dGainBest) ); //printf( "thresh = %8.2f ps best gain = %8.2f ps \n", SC_LibTimePs(p->pLib, GainThresh), SC_LibTimePs(p->pLib, dGainBest) );
return pPivot; return pPivot;
} }
void Abc_SclUpdateNetwork( SC_Man * p, Abc_Obj_t * pObj, int fUpsize, int iStep, int fVerbose, int fVeryVerbose ) void Abc_SclUpdateNetwork( SC_Man * p, Abc_Obj_t * pObj, int nCone, int fUpsize, int iStep, int fVerbose, int fVeryVerbose )
{ {
Vec_Int_t * vCone; Vec_Int_t * vCone;
SC_Cell * pOld, * pNew; SC_Cell * pOld, * pNew;
...@@ -330,8 +330,9 @@ void Abc_SclUpdateNetwork( SC_Man * p, Abc_Obj_t * pObj, int fUpsize, int iStep, ...@@ -330,8 +330,9 @@ void Abc_SclUpdateNetwork( SC_Man * p, Abc_Obj_t * pObj, int fUpsize, int iStep,
printf( "%5d :", iStep ); printf( "%5d :", iStep );
printf( "%7d ", Abc_ObjId(pObj) ); printf( "%7d ", Abc_ObjId(pObj) );
printf( "%-12s-> %-12s ", pOld->pName, pNew->pName ); printf( "%-12s-> %-12s ", pOld->pName, pNew->pName );
printf( "delay =%8.2f ps ", SC_LibTimePs(p->pLib, Abc_SclGetMaxDelay(p)) ); printf( "d =%8.2f ps ", SC_LibTimePs(p->pLib, Abc_SclGetMaxDelay(p)) );
printf( "area =%10.2f ", p->SumArea ); printf( "a =%10.2f ", p->SumArea );
printf( "n =%5d ", nCone );
// Abc_PrintTime( 1, "Time", clock() - p->clkStart ); // Abc_PrintTime( 1, "Time", clock() - p->clkStart );
// ABC_PRTr( "Time", clock() - p->clkStart ); // ABC_PRTr( "Time", clock() - p->clkStart );
if ( fVeryVerbose ) if ( fVeryVerbose )
...@@ -354,11 +355,11 @@ void Abc_SclUpdateNetwork( SC_Man * p, Abc_Obj_t * pObj, int fUpsize, int iStep, ...@@ -354,11 +355,11 @@ void Abc_SclUpdateNetwork( SC_Man * p, Abc_Obj_t * pObj, int fUpsize, int iStep,
***********************************************************************/ ***********************************************************************/
void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRange, int fTryAll, int fPrintCP, int fVerbose, int fVeryVerbose ) void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRange, int fTryAll, int fPrintCP, int fVerbose, int fVeryVerbose )
{ {
int nIters = 3; int nIters = 1;
SC_Man * p; SC_Man * p;
Vec_Int_t * vPath, * vPivots; Vec_Int_t * vPath, * vPivots;
Abc_Obj_t * pBest; Abc_Obj_t * pBest;
int r, i, nCones = 0, nDownSize = 0; int r, i, nNodes, nCones = 0, nDownSize = 0;
p = Abc_SclManStart( pLib, pNtk ); p = Abc_SclManStart( pLib, pNtk );
if ( fPrintCP ) if ( fPrintCP )
Abc_SclTimeNtkPrint( p, 0 ); Abc_SclTimeNtkPrint( p, 0 );
...@@ -368,8 +369,9 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan ...@@ -368,8 +369,9 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan
{ {
// printf( "%5d : ", 0 ); // printf( "%5d : ", 0 );
printf( "Starting parameters of current mapping: " ); printf( "Starting parameters of current mapping: " );
printf( "delay =%8.2f ps ", SC_LibTimePs(p->pLib, Abc_SclGetMaxDelay(p)) ); printf( "d =%8.2f ps ", SC_LibTimePs(p->pLib, Abc_SclGetMaxDelay(p)) );
printf( "area =%10.2f ", p->SumArea ); printf( "a =%10.2f ", p->SumArea );
printf( " " );
Abc_PrintTime( 1, "Time", clock() - p->clkStart ); Abc_PrintTime( 1, "Time", clock() - p->clkStart );
} }
for ( r = i = 0; r < nIters; r++ ) for ( r = i = 0; r < nIters; r++ )
...@@ -381,6 +383,7 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan ...@@ -381,6 +383,7 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan
{ {
vPath = Abc_SclFindCriticalPath( p, nRange, &vPivots ); vPath = Abc_SclFindCriticalPath( p, nRange, &vPivots );
pBest = Abc_SclChooseBiggestGain( p, vPath, vPivots, 1, nThresh1 ); pBest = Abc_SclChooseBiggestGain( p, vPath, vPivots, 1, nThresh1 );
nNodes = Vec_IntSize(vPath);
Vec_IntFree( vPath ); Vec_IntFree( vPath );
Vec_IntFree( vPivots ); Vec_IntFree( vPivots );
if ( pBest == NULL ) if ( pBest == NULL )
...@@ -389,6 +392,7 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan ...@@ -389,6 +392,7 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan
{ {
vPath = Abc_SclFindCriticalCone( p, nRange, &vPivots ); vPath = Abc_SclFindCriticalCone( p, nRange, &vPivots );
pBest = Abc_SclChooseBiggestGain( p, vPath, vPivots, 1, nThresh1 ); pBest = Abc_SclChooseBiggestGain( p, vPath, vPivots, 1, nThresh1 );
nNodes = Vec_IntSize(vPath);
Vec_IntFree( vPath ); Vec_IntFree( vPath );
Vec_IntFree( vPivots ); Vec_IntFree( vPivots );
nCones++; nCones++;
...@@ -396,7 +400,7 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan ...@@ -396,7 +400,7 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan
if ( pBest == NULL ) if ( pBest == NULL )
break; break;
} }
Abc_SclUpdateNetwork( p, pBest, 1, i+1, fVerbose, fVeryVerbose ); Abc_SclUpdateNetwork( p, pBest, nNodes, 1, i+1, fVerbose, fVeryVerbose );
// recompute loads every 100 steps // recompute loads every 100 steps
if ( i && i % 100 == 0 ) if ( i && i % 100 == 0 )
Abc_SclComputeLoad( p ); Abc_SclComputeLoad( p );
...@@ -411,6 +415,7 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan ...@@ -411,6 +415,7 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan
vPath = Abc_SclFindCriticalPath( p, nRange, &vPivots ); vPath = Abc_SclFindCriticalPath( p, nRange, &vPivots );
// pBest = Abc_SclChooseBiggestGain( p, vPath, vPivots, 0, -p->MaxDelay0/100000 ); // pBest = Abc_SclChooseBiggestGain( p, vPath, vPivots, 0, -p->MaxDelay0/100000 );
pBest = Abc_SclChooseBiggestGain( p, vPath, NULL, 0, nThresh2 ); pBest = Abc_SclChooseBiggestGain( p, vPath, NULL, 0, nThresh2 );
nNodes = Vec_IntSize(vPath);
Vec_IntFree( vPath ); Vec_IntFree( vPath );
Vec_IntFree( vPivots ); Vec_IntFree( vPivots );
if ( pBest == NULL ) if ( pBest == NULL )
...@@ -421,6 +426,7 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan ...@@ -421,6 +426,7 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan
vPath = Abc_SclFindCriticalCone( p, nRange, &vPivots ); vPath = Abc_SclFindCriticalCone( p, nRange, &vPivots );
// pBest = Abc_SclChooseBiggestGain( p, vPath, vPivots, 0, -p->MaxDelay0/100000 ); // pBest = Abc_SclChooseBiggestGain( p, vPath, vPivots, 0, -p->MaxDelay0/100000 );
pBest = Abc_SclChooseBiggestGain( p, vPath, NULL, 0, nThresh2 ); pBest = Abc_SclChooseBiggestGain( p, vPath, NULL, 0, nThresh2 );
nNodes = Vec_IntSize(vPath);
Vec_IntFree( vPath ); Vec_IntFree( vPath );
Vec_IntFree( vPivots ); Vec_IntFree( vPivots );
nCones++; nCones++;
...@@ -428,7 +434,7 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan ...@@ -428,7 +434,7 @@ void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nSteps, int nRan
if ( pBest == NULL ) if ( pBest == NULL )
break; break;
} }
Abc_SclUpdateNetwork( p, pBest, 0, i+1, fVerbose, fVeryVerbose ); Abc_SclUpdateNetwork( p, pBest, nNodes, 0, i+1, fVerbose, fVeryVerbose );
// recompute loads every 100 steps // recompute loads every 100 steps
if ( i && i % 100 == 0 ) if ( i && i % 100 == 0 )
Abc_SclComputeLoad( p ); Abc_SclComputeLoad( p );
......
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