summaryrefslogtreecommitdiffstats
path: root/src/base
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2015-12-14 00:44:33 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2015-12-14 00:44:33 -0800
commit19586f105cd15279084541a5edf033724a32be49 (patch)
tree1a468a5de4856992b461532b3cc78911e363ff03 /src/base
parent64afe6e9f861f8c570ba68c3a2d47ec92ebad96f (diff)
downloadabc-19586f105cd15279084541a5edf033724a32be49.tar.gz
abc-19586f105cd15279084541a5edf033724a32be49.tar.bz2
abc-19586f105cd15279084541a5edf033724a32be49.zip
Adding code to support gate profiles.
Diffstat (limited to 'src/base')
-rw-r--r--src/base/abci/abc.c32
-rw-r--r--src/base/abci/abcMap.c11
-rw-r--r--src/base/abci/abcPrint.c18
-rw-r--r--src/base/wlc/wlcReadVer.c5
4 files changed, 46 insertions, 20 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index 878d9a99..a26f67db 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -2209,19 +2209,24 @@ int Abc_CommandPrintGates( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
int c;
int fUseLibrary;
+ int fUpdateProfile;
- extern void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary );
+ extern void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary, int fUpdateProfile );
// set defaults
fUseLibrary = 1;
+ fUpdateProfile = 0;
Extra_UtilGetoptReset();
- while ( ( c = Extra_UtilGetopt( argc, argv, "lh" ) ) != EOF )
+ while ( ( c = Extra_UtilGetopt( argc, argv, "luh" ) ) != EOF )
{
switch ( c )
{
case 'l':
fUseLibrary ^= 1;
break;
+ case 'u':
+ fUpdateProfile ^= 1;
+ break;
case 'h':
goto usage;
default:
@@ -2240,13 +2245,14 @@ int Abc_CommandPrintGates( Abc_Frame_t * pAbc, int argc, char ** argv )
return 1;
}
- Abc_NtkPrintGates( pNtk, fUseLibrary );
+ Abc_NtkPrintGates( pNtk, fUseLibrary, fUpdateProfile );
return 0;
usage:
- Abc_Print( -2, "usage: print_gates [-lh]\n" );
+ Abc_Print( -2, "usage: print_gates [-luh]\n" );
Abc_Print( -2, "\t prints statistics about gates used in the network\n" );
Abc_Print( -2, "\t-l : used library gate names (if mapped) [default = %s]\n", fUseLibrary? "yes": "no" );
+ Abc_Print( -2, "\t-u : update profile before printing it[default = %s]\n", fUpdateProfile? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n");
return 1;
}
@@ -14851,15 +14857,16 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
float LogFan = 0;
float Slew = 0; // choose based on the library
float Gain = 250;
- int nGatesMin = 4;
+ int nGatesMin = 0;
int fAreaOnly;
int fRecovery;
int fSweep;
int fSwitching;
int fSkipFanout;
+ int fUseProfile;
int fVerbose;
int c;
- 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 fSkipFanout, 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 fSkipFanout, int fUseProfile, int fVerbose );
extern int Abc_NtkFraigSweep( Abc_Ntk_t * pNtk, int fUseInv, int fExdc, int fVerbose, int fVeryVerbose );
pNtk = Abc_FrameReadNtk(pAbc);
@@ -14872,9 +14879,10 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
fSweep = 0;
fSwitching = 0;
fSkipFanout = 0;
+ fUseProfile = 0;
fVerbose = 0;
Extra_UtilGetoptReset();
- while ( ( c = Extra_UtilGetopt( argc, argv, "DABFSGMarspfvh" ) ) != EOF )
+ while ( ( c = Extra_UtilGetopt( argc, argv, "DABFSGMarspfuvh" ) ) != EOF )
{
switch ( c )
{
@@ -14966,6 +14974,9 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'f':
fSkipFanout ^= 1;
break;
+ case 'u':
+ fUseProfile ^= 1;
+ break;
case 'v':
fVerbose ^= 1;
break;
@@ -15002,7 +15013,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, LogFan, Slew, Gain, nGatesMin, fRecovery, fSwitching, fSkipFanout, fVerbose );
+ pNtkRes = Abc_NtkMap( pNtk, DelayTarget, AreaMulti, DelayMulti, LogFan, Slew, Gain, nGatesMin, fRecovery, fSwitching, fSkipFanout, fUseProfile, fVerbose );
if ( pNtkRes == NULL )
{
Abc_NtkDelete( pNtk );
@@ -15014,7 +15025,7 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv )
else
{
// get the new network
- pNtkRes = Abc_NtkMap( pNtk, DelayTarget, AreaMulti, DelayMulti, LogFan, Slew, Gain, nGatesMin, fRecovery, fSwitching, fSkipFanout, fVerbose );
+ pNtkRes = Abc_NtkMap( pNtk, DelayTarget, AreaMulti, DelayMulti, LogFan, Slew, Gain, nGatesMin, fRecovery, fSwitching, fSkipFanout, fUseProfile, fVerbose );
if ( pNtkRes == NULL )
{
Abc_Print( -1, "Mapping has failed.\n" );
@@ -15041,7 +15052,7 @@ usage:
sprintf(Buffer, "not used" );
else
sprintf(Buffer, "%.3f", DelayTarget );
- Abc_Print( -2, "usage: map [-DABFSG float] [-M num] [-arspfvh]\n" );
+ Abc_Print( -2, "usage: map [-DABFSG float] [-M num] [-arspfuvh]\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 );
@@ -15055,6 +15066,7 @@ usage:
Abc_Print( -2, "\t-s : toggles sweep after mapping [default = %s]\n", fSweep? "yes": "no" );
Abc_Print( -2, "\t-p : optimizes power by minimizing switching [default = %s]\n", fSwitching? "yes": "no" );
Abc_Print( -2, "\t-f : do not use large gates to map high-fanout nodes [default = %s]\n", fSkipFanout? "yes": "no" );
+ Abc_Print( -2, "\t-u : use standard-cell profile [default = %s]\n", fUseProfile? "yes": "no" );
Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n");
return 1;
diff --git a/src/base/abci/abcMap.c b/src/base/abci/abcMap.c
index ac7bd0f4..9098c71f 100644
--- a/src/base/abci/abcMap.c
+++ b/src/base/abci/abcMap.c
@@ -56,7 +56,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 LogFan, float Slew, float Gain, int nGatesMin, int fRecovery, int fSwitching, int fSkipFanout, 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 fSkipFanout, int fUseProfile, int fVerbose )
{
static int fUseMulti = 0;
int fShowSwitching = 1;
@@ -72,7 +72,10 @@ Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti,
// if the library is created here, it will be deleted when pSuperLib is deleted in Map_SuperLibFree()
if ( Abc_FrameReadLibScl() && Abc_SclHasDelayInfo( Abc_FrameReadLibScl() ) )
{
- pLib = Abc_SclDeriveGenlib( Abc_FrameReadLibScl(), Slew, Gain, nGatesMin, fVerbose );
+ if ( pLib && Mio_LibraryHasProfile(pLib) )
+ pLib = Abc_SclDeriveGenlib( Abc_FrameReadLibScl(), pLib, Slew, Gain, nGatesMin, fVerbose );
+ else
+ pLib = Abc_SclDeriveGenlib( Abc_FrameReadLibScl(), NULL, Slew, Gain, nGatesMin, fVerbose );
if ( Abc_FrameReadLibGen() )
{
Mio_LibraryTransferDelays( (Mio_Library_t *)Abc_FrameReadLibGen(), pLib );
@@ -138,6 +141,8 @@ Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti,
clk = Abc_Clock();
Map_ManSetSwitching( pMan, fSwitching );
Map_ManSetSkipFanout( pMan, fSkipFanout );
+ if ( fUseProfile )
+ Map_ManSetUseProfile( pMan );
if ( LogFan != 0 )
Map_ManCreateNodeDelays( pMan, LogFan );
if ( !Map_Mapping( pMan ) )
@@ -149,6 +154,8 @@ clk = Abc_Clock();
// reconstruct the network after mapping
pNtkNew = Abc_NtkFromMap( pMan, pNtk );
+ if ( Mio_LibraryHasProfile(pLib) )
+ Mio_LibraryTransferProfile2( (Mio_Library_t *)Abc_FrameReadLibGen(), pLib );
Map_ManFree( pMan );
if ( pNtkNew == NULL )
return NULL;
diff --git a/src/base/abci/abcPrint.c b/src/base/abci/abcPrint.c
index a577b807..bbb4060b 100644
--- a/src/base/abci/abcPrint.c
+++ b/src/base/abci/abcPrint.c
@@ -1322,11 +1322,11 @@ void Abc_NodePrintKMap( Abc_Obj_t * pNode, int fUseRealNames )
SeeAlso []
***********************************************************************/
-void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary )
+void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary, int fUpdateProfile )
{
Abc_Obj_t * pObj;
int fHasBdds, i;
- int CountConst, CountBuf, CountInv, CountAnd, CountOr, CountOther, CounterTotal;
+ int CountConst, CountBuf, CountInv, CountAnd, CountOr, CountOther, CounterTotal, TotalDiff = 0;
char * pSop;
if ( fUseLibrary && Abc_NtkHasMapping(pNtk) )
@@ -1341,7 +1341,8 @@ void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary )
for ( i = 0; i < nGates; i++ )
{
Mio_GateSetValue( ppGates[i], 0 );
- Mio_GateSetProfile2( ppGates[i], 0 );
+ if ( fUpdateProfile )
+ Mio_GateSetProfile2( ppGates[i], 0 );
}
// count the gates by name
@@ -1350,7 +1351,8 @@ void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary )
{
if ( i == 0 ) continue;
Mio_GateSetValue( (Mio_Gate_t *)pObj->pData, 1 + Mio_GateReadValue((Mio_Gate_t *)pObj->pData) );
- Mio_GateIncProfile2( (Mio_Gate_t *)pObj->pData );
+ if ( fUpdateProfile )
+ Mio_GateIncProfile2( (Mio_Gate_t *)pObj->pData );
CounterTotal++;
// assuming that twin gates follow each other
if ( Abc_NtkFetchTwinNode(pObj) )
@@ -1372,8 +1374,10 @@ void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary )
for ( i = 0; i < nGates; i++ )
{
Counter = Mio_GateReadValue( ppGates[i] );
- if ( Counter == 0 )
+ if ( Counter == 0 && Mio_GateReadProfile(ppGates[i]) == 0 )
continue;
+ if ( Mio_GateReadPinNum(ppGates[i]) > 1 )
+ TotalDiff += Abc_AbsInt( Mio_GateReadProfile(ppGates[i]) - Mio_GateReadProfile2(ppGates[i]) );
Area = Counter * Mio_GateReadArea( ppGates[i] );
printf( "%-*s Fanin = %2d Instance = %8d Area = %10.2f %6.2f %% %8d %8d %s\n",
nGateNameLen, Mio_GateReadName( ppGates[i] ),
@@ -1383,9 +1387,9 @@ void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary )
Mio_GateReadProfile2(ppGates[i]),
Mio_GateReadForm(ppGates[i]) );
}
- printf( "%-*s Instance = %8d Area = %10.2f %6.2f %%\n",
+ printf( "%-*s Instance = %8d Area = %10.2f %6.2f %% AbsDiff = %d\n",
nGateNameLen, "TOTAL",
- CounterTotal, AreaTotal, 100.0 );
+ CounterTotal, AreaTotal, 100.0, TotalDiff );
return;
}
diff --git a/src/base/wlc/wlcReadVer.c b/src/base/wlc/wlcReadVer.c
index dcafc014..eb704211 100644
--- a/src/base/wlc/wlcReadVer.c
+++ b/src/base/wlc/wlcReadVer.c
@@ -1085,7 +1085,10 @@ startword:
if ( fDefaultFound )
{
int EntryLast = Vec_IntEntryLast( p->vFanins );
- Vec_IntFillExtra( p->vFanins, nValues + 1, EntryLast );
+ if (nValues != Vec_IntSize(p->vFanins)-2)
+ Vec_IntFillExtra( p->vFanins, nValues + 1, EntryLast );
+ else
+ Vec_IntPop(p->vFanins);
// get next line and check its opening character
pStart = Wlc_PrsStr(p, Vec_IntEntry(p->vStarts, ++i));
pStart = Wlc_PrsSkipSpaces( pStart );