From 0792ab0eb630da4a46b117367f86a6c7a8ab94a0 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Wed, 21 Mar 2012 23:19:49 -0700 Subject: Additional features for delay optimization --- src/map/mio/mio.c | 34 ++++++++++++++++++++++++++-------- src/map/mio/mio.h | 5 +---- src/map/mio/mioInt.h | 2 -- src/map/mio/mioUtils.c | 28 ++++++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 14 deletions(-) (limited to 'src/map/mio') diff --git a/src/map/mio/mio.c b/src/map/mio/mio.c index 1f410705..619168c2 100644 --- a/src/map/mio/mio.c +++ b/src/map/mio/mio.c @@ -231,6 +231,7 @@ int Mio_CommandReadLibrary( Abc_Frame_t * pAbc, int argc, char **argv ) Abc_Ntk_t * pNet; char * FileName; int fVerbose; + double WireDelay; int c; pNet = Abc_FrameReadNtk(pAbc); @@ -238,12 +239,24 @@ int Mio_CommandReadLibrary( Abc_Frame_t * pAbc, int argc, char **argv ) pErr = Abc_FrameReadErr(pAbc); // set the defaults + WireDelay = 0.0; fVerbose = 1; Extra_UtilGetoptReset(); - while ( (c = Extra_UtilGetopt(argc, argv, "vh")) != EOF ) + while ( (c = Extra_UtilGetopt(argc, argv, "Wvh")) != EOF ) { switch (c) { + case 'W': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-W\" should be followed by a floating point number.\n" ); + goto usage; + } + WireDelay = (float)atof(argv[globalUtilOptind]); + globalUtilOptind++; + if ( WireDelay <= 0.0 ) + goto usage; + break; case 'v': fVerbose ^= 1; break; @@ -280,6 +293,10 @@ int Mio_CommandReadLibrary( Abc_Frame_t * pAbc, int argc, char **argv ) fprintf( pErr, "Reading GENLIB library has failed.\n" ); return 1; } + // add the fixed number (wire delay) to all delays in the library + if ( WireDelay != 0.0 ) + Mio_LibraryShift( pLib, WireDelay ); + // free the current superlib because it depends on the old Mio library if ( Abc_FrameReadLibSuper() ) { @@ -304,13 +321,14 @@ int Mio_CommandReadLibrary( Abc_Frame_t * pAbc, int argc, char **argv ) return 0; usage: - fprintf( pErr, "usage: read_library [-vh]\n"); - fprintf( pErr, "\t read the library from a genlib file\n" ); - fprintf( pErr, "\t (if the library contains more than one gate\n" ); - fprintf( pErr, "\t with the same Boolean function, only the gate\n" ); - fprintf( pErr, "\t with the smallest area will be used)\n" ); - fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : enable verbose output\n"); + fprintf( pErr, "usage: read_library [-W float] [-vh]\n"); + fprintf( pErr, "\t read the library from a genlib file\n" ); + fprintf( pErr, "\t (if the library contains more than one gate\n" ); + fprintf( pErr, "\t with the same Boolean function, only the gate\n" ); + fprintf( pErr, "\t with the smallest area will be used)\n" ); + Abc_Print( -2, "\t-W float : wire delay (added to pin-to-pin gate delays) [default = %g]\n", WireDelay ); + fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); + fprintf( pErr, "\t-h : enable verbose output\n"); return 1; /* error exit */ } diff --git a/src/map/mio/mio.h b/src/map/mio/mio.h index a31e2e2b..005d2acc 100644 --- a/src/map/mio/mio.h +++ b/src/map/mio/mio.h @@ -84,7 +84,6 @@ extern char * Mio_LibraryReadName ( Mio_Library_t * pLib ); extern int Mio_LibraryReadGateNum ( Mio_Library_t * pLib ); extern Mio_Gate_t * Mio_LibraryReadGates ( Mio_Library_t * pLib ); extern Mio_Gate_t ** Mio_LibraryReadGatesByName( Mio_Library_t * pLib ); -//extern DdManager * Mio_LibraryReadDd ( Mio_Library_t * pLib ); extern Mio_Gate_t * Mio_LibraryReadGateByName ( Mio_Library_t * pLib, char * pName ); extern char * Mio_LibraryReadSopByName ( Mio_Library_t * pLib, char * pName ); extern Mio_Gate_t * Mio_LibraryReadConst0 ( Mio_Library_t * pLib ); @@ -114,7 +113,6 @@ extern Mio_Gate_t * Mio_GateReadNext ( Mio_Gate_t * pGate ); extern int Mio_GateReadInputs ( Mio_Gate_t * pGate ); extern double Mio_GateReadDelayMax ( Mio_Gate_t * pGate ); extern char * Mio_GateReadSop ( Mio_Gate_t * pGate ); -//extern DdNode * Mio_GateReadFunc ( Mio_Gate_t * pGate ); extern word Mio_GateReadTruth ( Mio_Gate_t * pGate ); extern int Mio_GateReadValue ( Mio_Gate_t * pGate ); extern void Mio_GateSetValue ( Mio_Gate_t * pGate, int Value ); @@ -150,8 +148,7 @@ extern void Mio_DeriveGateDelays( Mio_Gate_t * pGate, float ** ptPinDelays, int nPins, int nInputs, float tDelayZero, float * ptDelaysRes, float * ptPinDelayMax ); extern Mio_Gate_t * Mio_GateCreatePseudo( int nInputs ); - - +extern void Mio_LibraryShift( Mio_Library_t * pLib, double Shift ); ABC_NAMESPACE_HEADER_END diff --git a/src/map/mio/mioInt.h b/src/map/mio/mioInt.h index 59bd6ba6..a253ac63 100644 --- a/src/map/mio/mioInt.h +++ b/src/map/mio/mioInt.h @@ -72,7 +72,6 @@ struct Mio_LibraryStruct_t_ Mio_Gate_t * pGateNand2; // the NAND2 gate Mio_Gate_t * pGateAnd2; // the AND2 gate st_table * tName2Gate; // the mapping of gate names into their pointer -// DdManager * dd; // the nanager storing functions of gates Mem_Flex_t * pMmFlex; // the memory manaqer for SOPs Vec_Str_t * vCube; // temporary cube }; @@ -93,7 +92,6 @@ struct Mio_GateStruct_t_ // the derived information int nInputs; // the number of inputs double dDelayMax; // the maximum delay -// DdNode * bFunc; // the functionality char * pSop; // sum-of-products Vec_Int_t * vExpr; // boolean expression union { word uTruth; // truth table diff --git a/src/map/mio/mioUtils.c b/src/map/mio/mioUtils.c index d9447085..fac32873 100644 --- a/src/map/mio/mioUtils.c +++ b/src/map/mio/mioUtils.c @@ -613,6 +613,34 @@ Mio_Gate_t * Mio_GateCreatePseudo( int nInputs ) return pGate; } +/**Function************************************************************* + + Synopsis [Adds constant value to all delay values.] + + Description [The pseudo-gate is a N-input gate with all info set to 0.] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Mio_LibraryShift( Mio_Library_t * pLib, double Shift ) +{ + Mio_Gate_t * pGate; + Mio_Pin_t * pPin; + Mio_LibraryForEachGate( pLib, pGate ) + { + pGate->dDelayMax += Shift; + Mio_GateForEachPin( pGate, pPin ) + { + pPin->dDelayBlockRise += Shift; + pPin->dDelayBlockFall += Shift; + pPin->dDelayBlockMax += Shift; + } + } +} + + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// -- cgit v1.2.3