Commit e0eb2703 by Alan Mishchenko

Changes to command 'upsize'.

parent 508b6f1b
...@@ -457,6 +457,9 @@ static inline void Abc_ObjSetMvVar( Abc_Obj_t * pObj, void * pV) { Vec_At ...@@ -457,6 +457,9 @@ static inline void Abc_ObjSetMvVar( Abc_Obj_t * pObj, void * pV) { Vec_At
#define Abc_NtkForEachObjVec( vIds, pNtk, pObj, i ) \ #define Abc_NtkForEachObjVec( vIds, pNtk, pObj, i ) \
for ( i = 0; i < Vec_IntSize(vIds) && (((pObj) = Abc_NtkObj(pNtk, Vec_IntEntry(vIds,i))), 1); i++ ) \ for ( i = 0; i < Vec_IntSize(vIds) && (((pObj) = Abc_NtkObj(pNtk, Vec_IntEntry(vIds,i))), 1); i++ ) \
if ( (pObj) == NULL ) {} else if ( (pObj) == NULL ) {} else
#define Abc_NtkForEachObjVecStart( vIds, pNtk, pObj, i, Start ) \
for ( i = Start; i < Vec_IntSize(vIds) && (((pObj) = Abc_NtkObj(pNtk, Vec_IntEntry(vIds,i))), 1); i++ ) \
if ( (pObj) == NULL ) {} else
#define Abc_NtkForEachNet( pNtk, pNet, i ) \ #define Abc_NtkForEachNet( pNtk, pNet, i ) \
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNet) = Abc_NtkObj(pNtk, i)), 1); i++ ) \ for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNet) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
if ( (pNet) == NULL || !Abc_ObjIsNet(pNet) ) {} else if ( (pNet) == NULL || !Abc_ObjIsNet(pNet) ) {} else
......
...@@ -642,34 +642,46 @@ usage: ...@@ -642,34 +642,46 @@ usage:
int Scl_CommandUpsize( Abc_Frame_t * pAbc, int argc, char **argv ) int Scl_CommandUpsize( Abc_Frame_t * pAbc, int argc, char **argv )
{ {
Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
int Degree = 2; int Window = 5;
int nRange = 5; int Ratio = 5;
int nIters = 20;
int c, fVerbose = 0; int c, fVerbose = 0;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "NWvh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "WRIvh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
case 'N': case 'W':
if ( globalUtilOptind >= argc ) if ( globalUtilOptind >= argc )
{ {
Abc_Print( -1, "Command line switch \"-N\" should be followed by a positive integer.\n" ); Abc_Print( -1, "Command line switch \"-W\" should be followed by a positive integer.\n" );
goto usage; goto usage;
} }
Degree = atoi(argv[globalUtilOptind]); Window = atoi(argv[globalUtilOptind]);
globalUtilOptind++; globalUtilOptind++;
if ( Degree < 0 ) if ( Window < 0 )
goto usage; goto usage;
break; break;
case 'W': case 'R':
if ( globalUtilOptind >= argc ) if ( globalUtilOptind >= argc )
{ {
Abc_Print( -1, "Command line switch \"-W\" should be followed by a positive integer.\n" ); Abc_Print( -1, "Command line switch \"-R\" should be followed by a positive integer.\n" );
goto usage;
}
Ratio = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
if ( Ratio < 0 )
goto usage;
break;
case 'I':
if ( globalUtilOptind >= argc )
{
Abc_Print( -1, "Command line switch \"-I\" should be followed by a positive integer.\n" );
goto usage; goto usage;
} }
nRange = atoi(argv[globalUtilOptind]); nIters = atoi(argv[globalUtilOptind]);
globalUtilOptind++; globalUtilOptind++;
if ( nRange < 0 ) if ( nIters < 0 )
goto usage; goto usage;
break; break;
case 'v': case 'v':
...@@ -703,14 +715,15 @@ int Scl_CommandUpsize( Abc_Frame_t * pAbc, int argc, char **argv ) ...@@ -703,14 +715,15 @@ int Scl_CommandUpsize( Abc_Frame_t * pAbc, int argc, char **argv )
return 1; return 1;
} }
Abc_SclUpsizingPerform( pAbc->pLibScl, pNtk, Degree, nRange, fVerbose ); Abc_SclUpsizePerform( pAbc->pLibScl, pNtk, Window, Ratio, nIters, fVerbose );
return 0; return 0;
usage: usage:
fprintf( pAbc->Err, "usage: upsize [-NW num] [-vh]\n" ); fprintf( pAbc->Err, "usage: upsize [-WRI num] [-vh]\n" );
fprintf( pAbc->Err, "\t selectively increases gate sizes in timing-critical regions\n" ); fprintf( pAbc->Err, "\t selectively increases gate sizes in timing-critical regions\n" );
fprintf( pAbc->Err, "\t-N <num> : the max fanout count of gates to upsize [default = %d]\n", Degree ); fprintf( pAbc->Err, "\t-W <num> : delay window (in percents) of near-critical COs [default = %d]\n", Window );
fprintf( pAbc->Err, "\t-W <num> : delay window (in percents) of near-critical COs [default = %d]\n", nRange ); fprintf( pAbc->Err, "\t-R <num> : ratio of critical nodes (in percents) to update [default = %d]\n", Ratio );
fprintf( pAbc->Err, "\t-I <num> : the number of upsizing iterations to perform [default = %d]\n", nIters );
fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
fprintf( pAbc->Err, "\t-h : print the command usage\n"); fprintf( pAbc->Err, "\t-h : print the command usage\n");
return 1; return 1;
......
...@@ -121,6 +121,7 @@ static void Abc_SclReadLibrary( Vec_Str_t * vOut, int * pPos, SC_Lib * p ) ...@@ -121,6 +121,7 @@ static void Abc_SclReadLibrary( Vec_Str_t * vOut, int * pPos, SC_Lib * p )
for ( i = Vec_StrGetI(vOut, pPos); i != 0; i-- ) for ( i = Vec_StrGetI(vOut, pPos); i != 0; i-- )
{ {
SC_Cell * pCell = Abc_SclCellAlloc(); SC_Cell * pCell = Abc_SclCellAlloc();
pCell->Id = Vec_PtrSize(p->vCells);
Vec_PtrPush( p->vCells, pCell ); Vec_PtrPush( p->vCells, pCell );
pCell->pName = Vec_StrGetS(vOut, pPos); pCell->pName = Vec_StrGetS(vOut, pPos);
......
...@@ -155,6 +155,7 @@ struct SC_Pin_ ...@@ -155,6 +155,7 @@ struct SC_Pin_
struct SC_Cell_ struct SC_Cell_
{ {
char * pName; char * pName;
int Id;
int seq; // -- set to TRUE by parser if a sequential element int seq; // -- set to TRUE by parser if a sequential element
int unsupp; // -- set to TRUE by parser if cell contains information we cannot handle int unsupp; // -- set to TRUE by parser if cell contains information we cannot handle
float area; float area;
...@@ -436,7 +437,7 @@ extern void Abc_SclTimePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fUse ...@@ -436,7 +437,7 @@ extern void Abc_SclTimePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fUse
/*=== sclSize.c =============================================================*/ /*=== sclSize.c =============================================================*/
extern void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * p ); extern void Abc_SclSizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * p );
/*=== sclUpsize.c =============================================================*/ /*=== sclUpsize.c =============================================================*/
extern void Abc_SclUpsizingPerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int Degree, int nRange, int fVerbose ); extern void Abc_SclUpsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int Window, int Ratio, int nIters, int fVerbose );
/*=== sclUtil.c =============================================================*/ /*=== sclUtil.c =============================================================*/
extern void Abc_SclHashCells( SC_Lib * p ); extern void Abc_SclHashCells( SC_Lib * p );
extern int Abc_SclCellFind( SC_Lib * p, char * pName ); extern int Abc_SclCellFind( SC_Lib * p, char * pName );
......
...@@ -200,7 +200,7 @@ static inline float Abc_SclGetMaxDelay( SC_Man * p ) ...@@ -200,7 +200,7 @@ static inline float Abc_SclGetMaxDelay( SC_Man * p )
fMaxArr = Abc_MaxFloat( fMaxArr, Abc_SclObjTimeMax(p, pObj) ); fMaxArr = Abc_MaxFloat( fMaxArr, Abc_SclObjTimeMax(p, pObj) );
return fMaxArr; return fMaxArr;
} }
static inline float Abc_SclGetMaxDelayNode( SC_Man * p, Abc_Obj_t * pNode ) static inline float Abc_SclGetMaxDelayNodeFanins( SC_Man * p, Abc_Obj_t * pNode )
{ {
float fMaxArr = 0; float fMaxArr = 0;
Abc_Obj_t * pObj; Abc_Obj_t * pObj;
......
...@@ -103,7 +103,7 @@ void Abc_SclFindCriticalCone_rec( SC_Man * p, Abc_Obj_t * pObj, Vec_Int_t * vVis ...@@ -103,7 +103,7 @@ void Abc_SclFindCriticalCone_rec( SC_Man * p, Abc_Obj_t * pObj, Vec_Int_t * vVis
Abc_NodeSetTravIdCurrent( pObj ); Abc_NodeSetTravIdCurrent( pObj );
assert( Abc_ObjIsNode(pObj) ); assert( Abc_ObjIsNode(pObj) );
// compute timing critical fanin // compute timing critical fanin
fArrMax = Abc_SclGetMaxDelayNode( p, pObj ) * (100.0 - RangeF) / 100.0; fArrMax = Abc_SclGetMaxDelayNodeFanins( p, pObj ) * (100.0 - RangeF) / 100.0;
// traverse all fanins whose arrival times are within a window // traverse all fanins whose arrival times are within a window
Abc_ObjForEachFanin( pObj, pNext, i ) Abc_ObjForEachFanin( pObj, pNext, i )
if ( Abc_SclObjTimeMax(p, pNext) >= fArrMax ) if ( Abc_SclObjTimeMax(p, pNext) >= fArrMax )
......
...@@ -619,6 +619,42 @@ static inline int Vec_FltRemove( Vec_Flt_t * p, float Entry ) ...@@ -619,6 +619,42 @@ static inline int Vec_FltRemove( Vec_Flt_t * p, float Entry )
/**Function************************************************************* /**Function*************************************************************
Synopsis [Find entry.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static inline float Vec_FltFindMax( Vec_Flt_t * p )
{
int i;
float Best;
if ( p->nSize == 0 )
return 0;
Best = p->pArray[0];
for ( i = 1; i < p->nSize; i++ )
if ( Best < p->pArray[i] )
Best = p->pArray[i];
return Best;
}
static inline float Vec_FltFindMin( Vec_Flt_t * p )
{
int i;
float Best;
if ( p->nSize == 0 )
return 0;
Best = p->pArray[0];
for ( i = 1; i < p->nSize; i++ )
if ( Best > p->pArray[i] )
Best = p->pArray[i];
return Best;
}
/**Function*************************************************************
Synopsis [Comparison procedure for two floats.] Synopsis [Comparison procedure for two floats.]
Description [] Description []
......
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