diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2012-03-02 13:50:28 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2012-03-02 13:50:28 -0800 |
commit | eb4aa4257722d1a72401fdd477aaaff19028e290 (patch) | |
tree | 9d8b548ba0848086479ae68ec18016e48fc73e5a /src | |
parent | a0933b1643d216ec401983580d896ab7d70669de (diff) | |
download | abc-eb4aa4257722d1a72401fdd477aaaff19028e290.tar.gz abc-eb4aa4257722d1a72401fdd477aaaff19028e290.tar.bz2 abc-eb4aa4257722d1a72401fdd477aaaff19028e290.zip |
Enabling user-specified required times in 'map'.
Diffstat (limited to 'src')
-rw-r--r-- | src/base/abc/abc.h | 3 | ||||
-rw-r--r-- | src/base/abc/abcNtk.c | 7 | ||||
-rw-r--r-- | src/base/abci/abcMap.c | 1 | ||||
-rw-r--r-- | src/base/abci/abcTiming.c | 76 | ||||
-rw-r--r-- | src/base/io/ioReadBlif.c | 95 | ||||
-rw-r--r-- | src/base/io/ioWriteBlif.c | 13 | ||||
-rw-r--r-- | src/map/mapper/mapper.h | 1 | ||||
-rw-r--r-- | src/map/mapper/mapperCreate.c | 19 | ||||
-rw-r--r-- | src/map/mapper/mapperInt.h | 1 | ||||
-rw-r--r-- | src/map/mapper/mapperTime.c | 14 |
10 files changed, 200 insertions, 30 deletions
diff --git a/src/base/abc/abc.h b/src/base/abc/abc.h index 99cf605a..272e4fb6 100644 --- a/src/base/abc/abc.h +++ b/src/base/abc/abc.h @@ -867,12 +867,13 @@ extern ABC_DLL void Abc_NtkTimeSetDefaultArrival( Abc_Ntk_t * pNtk extern ABC_DLL void Abc_NtkTimeSetDefaultRequired( Abc_Ntk_t * pNtk, float Rise, float Fall ); extern ABC_DLL void Abc_NtkTimeSetArrival( Abc_Ntk_t * pNtk, int ObjId, float Rise, float Fall ); extern ABC_DLL void Abc_NtkTimeSetRequired( Abc_Ntk_t * pNtk, int ObjId, float Rise, float Fall ); -extern ABC_DLL void Abc_NtkTimeInitialize( Abc_Ntk_t * pNtk ); +extern ABC_DLL void Abc_NtkTimeInitialize( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkOld ); extern ABC_DLL void Abc_ManTimeStop( Abc_ManTime_t * p ); extern ABC_DLL void Abc_ManTimeDup( Abc_Ntk_t * pNtkOld, Abc_Ntk_t * pNtkNew ); extern ABC_DLL void Abc_NtkSetNodeLevelsArrival( Abc_Ntk_t * pNtk ); extern ABC_DLL float * Abc_NtkGetCiArrivalFloats( Abc_Ntk_t * pNtk ); extern ABC_DLL Abc_Time_t * Abc_NtkGetCiArrivalTimes( Abc_Ntk_t * pNtk ); +extern ABC_DLL Abc_Time_t * Abc_NtkGetCoRequiredTimes( Abc_Ntk_t * pNtk ); extern ABC_DLL float Abc_NtkDelayTrace( Abc_Ntk_t * pNtk ); extern ABC_DLL int Abc_ObjLevelNew( Abc_Obj_t * pObj ); extern ABC_DLL int Abc_ObjReverseLevelNew( Abc_Obj_t * pObj ); diff --git a/src/base/abc/abcNtk.c b/src/base/abc/abcNtk.c index 3840fdfc..42036f4b 100644 --- a/src/base/abc/abcNtk.c +++ b/src/base/abc/abcNtk.c @@ -226,6 +226,9 @@ void Abc_NtkFinalize( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkNew ) pDriverNew = Abc_ObjNotCond(pDriver->pCopy, Abc_ObjFaninC0(pObj)); Abc_ObjAddFanin( pObj->pCopy, pDriverNew ); } + // duplicate timing manager + if ( pNtk->pManTime ) + Abc_NtkTimeInitialize( pNtkNew, pNtk ); } /**Function************************************************************* @@ -378,6 +381,10 @@ Abc_Ntk_t * Abc_NtkDup( Abc_Ntk_t * pNtk ) pNtkNew->pExdc = Abc_NtkDup( pNtk->pExdc ); if ( pNtk->pExcare ) pNtkNew->pExcare = Abc_NtkDup( (Abc_Ntk_t *)pNtk->pExcare ); + // duplicate timing manager + if ( pNtk->pManTime ) + Abc_NtkTimeInitialize( pNtkNew, pNtk ); + // check correctness if ( !Abc_NtkCheck( pNtkNew ) ) fprintf( stdout, "Abc_NtkDup(): Network check has failed.\n" ); pNtk->pCopy = pNtkNew; diff --git a/src/base/abci/abcMap.c b/src/base/abci/abcMap.c index eeeaf15f..723e5688 100644 --- a/src/base/abci/abcMap.c +++ b/src/base/abci/abcMap.c @@ -163,6 +163,7 @@ Map_Man_t * Abc_NtkToMap( Abc_Ntk_t * pNtk, double DelayTarget, int fRecovery, f Map_ManSetOutputNames( pMan, Abc_NtkCollectCioNames(pNtk, 1) ); Map_ManSetDelayTarget( pMan, (float)DelayTarget ); Map_ManSetInputArrivals( pMan, (Map_Time_t *)Abc_NtkGetCiArrivalTimes(pNtk) ); + Map_ManSetOutputRequireds( pMan, (Map_Time_t *)Abc_NtkGetCoRequiredTimes(pNtk) ); // create PIs and remember them in the old nodes Abc_NtkCleanCopy( pNtk ); diff --git a/src/base/abci/abcTiming.c b/src/base/abci/abcTiming.c index d8334e9d..a9b50563 100644 --- a/src/base/abci/abcTiming.c +++ b/src/base/abci/abcTiming.c @@ -40,7 +40,6 @@ struct Abc_ManTime_t_ // static functions static Abc_ManTime_t * Abc_ManTimeStart(); static void Abc_ManTimeExpand( Abc_ManTime_t * p, int nSize, int fProgressive ); -void Abc_NtkTimePrepare( Abc_Ntk_t * pNtk ); void Abc_NodeDelayTraceArrival( Abc_Obj_t * pNode ); @@ -139,7 +138,7 @@ void Abc_NtkTimeSetDefaultArrival( Abc_Ntk_t * pNtk, float Rise, float Fall ) pNtk->pManTime = Abc_ManTimeStart(); pNtk->pManTime->tArrDef.Rise = Rise; pNtk->pManTime->tArrDef.Fall = Fall; - pNtk->pManTime->tArrDef.Worst = Abc_MaxInt( Rise, Fall ); + pNtk->pManTime->tArrDef.Worst = Abc_MaxFloat( Rise, Fall ); } /**Function************************************************************* @@ -161,7 +160,7 @@ void Abc_NtkTimeSetDefaultRequired( Abc_Ntk_t * pNtk, float Rise, float Fall ) pNtk->pManTime = Abc_ManTimeStart(); pNtk->pManTime->tReqDef.Rise = Rise; pNtk->pManTime->tReqDef.Fall = Fall; - pNtk->pManTime->tReqDef.Worst = Abc_MaxInt( Rise, Fall ); + pNtk->pManTime->tReqDef.Worst = Abc_MaxFloat( Rise, Fall ); } /**Function************************************************************* @@ -189,7 +188,7 @@ void Abc_NtkTimeSetArrival( Abc_Ntk_t * pNtk, int ObjId, float Rise, float Fall pTime = (Abc_Time_t *)vTimes->pArray[ObjId]; pTime->Rise = Rise; pTime->Fall = Fall; - pTime->Worst = Abc_MaxInt( Rise, Fall ); + pTime->Worst = Abc_MaxFloat( Rise, Fall ); } /**Function************************************************************* @@ -217,7 +216,7 @@ void Abc_NtkTimeSetRequired( Abc_Ntk_t * pNtk, int ObjId, float Rise, float Fall pTime = (Abc_Time_t *)vTimes->pArray[ObjId]; pTime->Rise = Rise; pTime->Fall = Fall; - pTime->Worst = Abc_MaxInt( Rise, Fall ); + pTime->Worst = Abc_MaxFloat( Rise, Fall ); } /**Function************************************************************* @@ -231,14 +230,23 @@ void Abc_NtkTimeSetRequired( Abc_Ntk_t * pNtk, int ObjId, float Rise, float Fall SeeAlso [] ***********************************************************************/ -void Abc_NtkTimeInitialize( Abc_Ntk_t * pNtk ) +void Abc_NtkTimeInitialize( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkOld ) { Abc_Obj_t * pObj; Abc_Time_t ** ppTimes, * pTime; int i; + assert( pNtkOld == NULL || pNtkOld->pManTime != NULL ); + assert( pNtkOld == NULL || Abc_NtkPiNum(pNtk) == Abc_NtkPiNum(pNtkOld) ); + assert( pNtkOld == NULL || Abc_NtkPoNum(pNtk) == Abc_NtkPoNum(pNtkOld) ); if ( pNtk->pManTime == NULL ) return; Abc_ManTimeExpand( pNtk->pManTime, Abc_NtkObjNumMax(pNtk), 0 ); + // set global defaults + if ( pNtkOld ) + { + pNtk->pManTime->tArrDef = pNtkOld->pManTime->tArrDef; + pNtk->pManTime->tReqDef = pNtkOld->pManTime->tReqDef; + } // set the default timing ppTimes = (Abc_Time_t **)pNtk->pManTime->vArrs->pArray; Abc_NtkForEachPi( pNtk, pObj, i ) @@ -246,7 +254,7 @@ void Abc_NtkTimeInitialize( Abc_Ntk_t * pNtk ) pTime = ppTimes[pObj->Id]; if ( pTime->Worst != -ABC_INFINITY ) continue; - *pTime = pNtk->pManTime->tArrDef; + *pTime = pNtkOld ? *Abc_NodeReadArrival(Abc_NtkPi(pNtkOld, i)) : pNtk->pManTime->tArrDef; } // set the default timing ppTimes = (Abc_Time_t **)pNtk->pManTime->vReqs->pArray; @@ -255,7 +263,7 @@ void Abc_NtkTimeInitialize( Abc_Ntk_t * pNtk ) pTime = ppTimes[pObj->Id]; if ( pTime->Worst != -ABC_INFINITY ) continue; - *pTime = pNtk->pManTime->tReqDef; + *pTime = pNtkOld ? *Abc_NodeReadRequired(Abc_NtkPo(pNtkOld, i)) : pNtk->pManTime->tReqDef; } // set the 0 arrival times for latch outputs and constant nodes ppTimes = (Abc_Time_t **)pNtk->pManTime->vArrs->pArray; @@ -286,7 +294,7 @@ void Abc_NtkTimePrepare( Abc_Ntk_t * pNtk ) if ( pNtk->pManTime == NULL ) { pNtk->pManTime = Abc_ManTimeStart(); - Abc_NtkTimeInitialize( pNtk ); + Abc_NtkTimeInitialize( pNtk, NULL ); return; } // if timing manager is given, expand it if necessary @@ -304,6 +312,17 @@ void Abc_NtkTimePrepare( Abc_Ntk_t * pNtk ) pTime->Fall = pTime->Rise = pTime->Worst = -ABC_INFINITY; } // clean required except for POs + ppTimes = (Abc_Time_t **)pNtk->pManTime->vReqs->pArray; + Abc_NtkForEachNode( pNtk, pObj, i ) + { + pTime = ppTimes[pObj->Id]; + pTime->Fall = pTime->Rise = pTime->Worst = -ABC_INFINITY; + } + Abc_NtkForEachPi( pNtk, pObj, i ) + { + pTime = ppTimes[pObj->Id]; + pTime->Fall = pTime->Rise = pTime->Worst = -ABC_INFINITY; + } } @@ -499,8 +518,7 @@ Abc_Time_t * Abc_NtkGetCiArrivalTimes( Abc_Ntk_t * pNtk ) Abc_Time_t * p; Abc_Obj_t * pNode; int i; - p = ABC_ALLOC( Abc_Time_t, Abc_NtkCiNum(pNtk) ); - memset( p, 0, sizeof(Abc_Time_t) * Abc_NtkCiNum(pNtk) ); + p = ABC_CALLOC( Abc_Time_t, Abc_NtkCiNum(pNtk) ); if ( pNtk->pManTime == NULL ) return p; // set the PI arrival times @@ -509,6 +527,31 @@ Abc_Time_t * Abc_NtkGetCiArrivalTimes( Abc_Ntk_t * pNtk ) return p; } +/**Function************************************************************* + + Synopsis [Sets the CI node levels according to the arrival info.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +Abc_Time_t * Abc_NtkGetCoRequiredTimes( Abc_Ntk_t * pNtk ) +{ + Abc_Time_t * p; + Abc_Obj_t * pNode; + int i; + p = ABC_CALLOC( Abc_Time_t, Abc_NtkCoNum(pNtk) ); + if ( pNtk->pManTime == NULL ) + return p; + // set the PO required times + Abc_NtkForEachPo( pNtk, pNode, i ) + p[i] = *Abc_NodeRequired(pNode); + return p; +} + /**Function************************************************************* @@ -526,8 +569,7 @@ float * Abc_NtkGetCiArrivalFloats( Abc_Ntk_t * pNtk ) float * p; Abc_Obj_t * pNode; int i; - p = ABC_ALLOC( float, Abc_NtkCiNum(pNtk) ); - memset( p, 0, sizeof(float) * Abc_NtkCiNum(pNtk) ); + p = ABC_CALLOC( float, Abc_NtkCiNum(pNtk) ); if ( pNtk->pManTime == NULL ) return p; // set the PI arrival times @@ -625,7 +667,7 @@ void Abc_NodeDelayTraceArrival( Abc_Obj_t * pNode ) } pPin = Mio_PinReadNext(pPin); } - pTimeOut->Worst = Abc_MaxInt( pTimeOut->Rise, pTimeOut->Fall ); + pTimeOut->Worst = Abc_MaxFloat( pTimeOut->Rise, pTimeOut->Fall ); } @@ -647,7 +689,7 @@ int Abc_ObjLevelNew( Abc_Obj_t * pObj ) Abc_Obj_t * pFanin; int i, Level = 0; Abc_ObjForEachFanin( pObj, pFanin, i ) - Level = Abc_MaxInt( Level, Abc_ObjLevel(pFanin) ); + Level = Abc_MaxFloat( Level, Abc_ObjLevel(pFanin) ); return Level + 1; } @@ -669,7 +711,7 @@ int Abc_ObjReverseLevelNew( Abc_Obj_t * pObj ) Abc_ObjForEachFanout( pObj, pFanout, i ) { LevelCur = Abc_ObjReverseLevel( pFanout ); - Level = Abc_MaxInt( Level, LevelCur ); + Level = Abc_MaxFloat( Level, LevelCur ); } return Level + 1; } @@ -827,7 +869,7 @@ void Abc_NtkUpdateLevel( Abc_Obj_t * pObjNew, Vec_Vec_t * vLevels ) assert( Abc_ObjLevel(pFanout) >= Lev ); Vec_VecPush( vLevels, Abc_ObjLevel(pFanout), pFanout ); // Counter++; -// CounterMax = Abc_MaxInt( CounterMax, Counter ); +// CounterMax = Abc_MaxFloat( CounterMax, Counter ); pFanout->fMarkA = 1; } } diff --git a/src/base/io/ioReadBlif.c b/src/base/io/ioReadBlif.c index faf0f53e..eb919210 100644 --- a/src/base/io/ioReadBlif.c +++ b/src/base/io/ioReadBlif.c @@ -64,7 +64,9 @@ static int Io_ReadBlifNetworkNames( Io_ReadBlif_t * p, Vec_Ptr_t ** pvTokens ); static int Io_ReadBlifNetworkGate( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens ); static int Io_ReadBlifNetworkSubcircuit( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens ); static int Io_ReadBlifNetworkInputArrival( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens ); +static int Io_ReadBlifNetworkOutputRequired( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens ); static int Io_ReadBlifNetworkDefaultInputArrival( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens ); +static int Io_ReadBlifNetworkDefaultOutputRequired( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens ); static int Io_ReadBlifNetworkConnectBoxes( Io_ReadBlif_t * p, Abc_Ntk_t * pNtkMaster ); //////////////////////////////////////////////////////////////////////// @@ -100,7 +102,7 @@ Abc_Ntk_t * Io_ReadBlif( char * pFileName, int fCheck ) return NULL; } pNtk->pSpec = Extra_UtilStrsav( pFileName ); - Abc_NtkTimeInitialize( pNtk ); + Abc_NtkTimeInitialize( pNtk, NULL ); Io_ReadBlifFree( p ); // make sure that everything is okay with the network structure @@ -267,8 +269,12 @@ Abc_Ntk_t * Io_ReadBlifNetworkOne( Io_ReadBlif_t * p ) fStatus = Io_ReadBlifNetworkOutputs( p, p->vTokens ); else if ( !strcmp( pDirective, ".input_arrival" ) ) fStatus = Io_ReadBlifNetworkInputArrival( p, p->vTokens ); + else if ( !strcmp( pDirective, ".output_required" ) ) + fStatus = Io_ReadBlifNetworkOutputRequired( p, p->vTokens ); else if ( !strcmp( pDirective, ".default_input_arrival" ) ) fStatus = Io_ReadBlifNetworkDefaultInputArrival( p, p->vTokens ); + else if ( !strcmp( pDirective, ".default_output_required" ) ) + fStatus = Io_ReadBlifNetworkDefaultOutputRequired( p, p->vTokens ); // else if ( !strcmp( pDirective, ".subckt" ) ) // fStatus = Io_ReadBlifNetworkSubcircuit( p, p->vTokens ); else if ( !strcmp( pDirective, ".exdc" ) ) @@ -782,6 +788,54 @@ int Io_ReadBlifNetworkInputArrival( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens ) SeeAlso [] ***********************************************************************/ +int Io_ReadBlifNetworkOutputRequired( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens ) +{ + Abc_Obj_t * pNet; + char * pFoo1, * pFoo2; + double TimeRise, TimeFall; + + // make sure this is indeed the .inputs line + assert( strncmp( (char *)vTokens->pArray[0], ".output_required", 16 ) == 0 ); + if ( vTokens->nSize != 4 ) + { + p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0); + sprintf( p->sError, "Wrong number of arguments on .output_required line." ); + Io_ReadBlifPrintErrorMessage( p ); + return 1; + } + pNet = Abc_NtkFindNet( p->pNtkCur, (char *)vTokens->pArray[1] ); + if ( pNet == NULL ) + { + p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0); + sprintf( p->sError, "Cannot find object corresponding to %s on .output_required line.", (char*)vTokens->pArray[1] ); + Io_ReadBlifPrintErrorMessage( p ); + return 1; + } + TimeRise = strtod( (char *)vTokens->pArray[2], &pFoo1 ); + TimeFall = strtod( (char *)vTokens->pArray[3], &pFoo2 ); + if ( *pFoo1 != '\0' || *pFoo2 != '\0' ) + { + p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0); + sprintf( p->sError, "Bad value (%s %s) for rise or fall time on .output_required line.", (char*)vTokens->pArray[2], (char*)vTokens->pArray[3] ); + Io_ReadBlifPrintErrorMessage( p ); + return 1; + } + // set the arrival time + Abc_NtkTimeSetRequired( p->pNtkCur, Abc_ObjFanout0(pNet)->Id, (float)TimeRise, (float)TimeFall ); + return 0; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ int Io_ReadBlifNetworkDefaultInputArrival( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens ) { char * pFoo1, * pFoo2; @@ -812,6 +866,45 @@ int Io_ReadBlifNetworkDefaultInputArrival( Io_ReadBlif_t * p, Vec_Ptr_t * vToken /**Function************************************************************* + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Io_ReadBlifNetworkDefaultOutputRequired( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens ) +{ + char * pFoo1, * pFoo2; + double TimeRise, TimeFall; + + // make sure this is indeed the .inputs line + assert( strncmp( (char *)vTokens->pArray[0], ".default_output_required", 25 ) == 0 ); + if ( vTokens->nSize != 3 ) + { + p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0); + sprintf( p->sError, "Wrong number of arguments on .default_output_required line." ); + Io_ReadBlifPrintErrorMessage( p ); + return 1; + } + TimeRise = strtod( (char *)vTokens->pArray[1], &pFoo1 ); + TimeFall = strtod( (char *)vTokens->pArray[2], &pFoo2 ); + if ( *pFoo1 != '\0' || *pFoo2 != '\0' ) + { + p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0); + sprintf( p->sError, "Bad value (%s %s) for rise or fall time on .default_output_required line.", (char*)vTokens->pArray[1], (char*)vTokens->pArray[2] ); + Io_ReadBlifPrintErrorMessage( p ); + return 1; + } + // set the arrival time + Abc_NtkTimeSetDefaultRequired( p->pNtkCur, (float)TimeRise, (float)TimeFall ); + return 0; +} + +/**Function************************************************************* + Synopsis [Prints the error message including the file name and line number.] Description [] diff --git a/src/base/io/ioWriteBlif.c b/src/base/io/ioWriteBlif.c index fe4266b0..327e16e1 100644 --- a/src/base/io/ioWriteBlif.c +++ b/src/base/io/ioWriteBlif.c @@ -589,6 +589,8 @@ void Io_WriteTimingInfo( FILE * pFile, Abc_Ntk_t * pNtk ) if ( pNtk->pManTime == NULL ) return; + fprintf( pFile, "\n" ); + pTimeDef = Abc_NtkReadDefaultArrival( pNtk ); fprintf( pFile, ".default_input_arrival %g %g\n", pTimeDef->Rise, pTimeDef->Fall ); Abc_NtkForEachPi( pNtk, pNode, i ) @@ -596,9 +598,18 @@ void Io_WriteTimingInfo( FILE * pFile, Abc_Ntk_t * pNtk ) pTime = Abc_NodeReadArrival(pNode); if ( pTime->Rise == pTimeDef->Rise && pTime->Fall == pTimeDef->Fall ) continue; -// fprintf( pFile, ".input_arrival %s %g %g\n", Abc_ObjName(pNode), pTime->Rise, pTime->Fall ); fprintf( pFile, ".input_arrival %s %g %g\n", Abc_ObjName(Abc_ObjFanout0(pNode)), pTime->Rise, pTime->Fall ); } + + pTimeDef = Abc_NtkReadDefaultRequired( pNtk ); + fprintf( pFile, ".default_output_required %g %g\n", pTimeDef->Rise, pTimeDef->Fall ); + Abc_NtkForEachPo( pNtk, pNode, i ) + { + pTime = Abc_NodeReadRequired(pNode); + if ( pTime->Rise == pTimeDef->Rise && pTime->Fall == pTimeDef->Fall ) + continue; + fprintf( pFile, ".output_required %s %g %g\n", Abc_ObjName(Abc_ObjFanin0(pNode)), pTime->Rise, pTime->Fall ); + } } diff --git a/src/map/mapper/mapper.h b/src/map/mapper/mapper.h index 3fd5fd9e..29bc98ef 100644 --- a/src/map/mapper/mapper.h +++ b/src/map/mapper/mapper.h @@ -97,6 +97,7 @@ extern void Map_ManSetOutputNames( Map_Man_t * p, char ** ppNames ); extern void Map_ManSetAreaRecovery( Map_Man_t * p, int fAreaRecovery ); extern void Map_ManSetDelayTarget( Map_Man_t * p, float DelayTarget ); extern void Map_ManSetInputArrivals( Map_Man_t * p, Map_Time_t * pArrivals ); +extern void Map_ManSetOutputRequireds( Map_Man_t * p, Map_Time_t * pArrivals ); extern void Map_ManSetObeyFanoutLimits( Map_Man_t * p, int fObeyFanoutLimits ); extern void Map_ManSetNumIterations( Map_Man_t * p, int nNumIterations ); extern int Map_ManReadPass( Map_Man_t * p ); diff --git a/src/map/mapper/mapperCreate.c b/src/map/mapper/mapperCreate.c index 73ccdb19..2b1663a4 100644 --- a/src/map/mapper/mapperCreate.c +++ b/src/map/mapper/mapperCreate.c @@ -52,26 +52,28 @@ int Map_ManReadOutputNum( Map_Man_t * p ) { return Map_Node_t ** Map_ManReadInputs ( Map_Man_t * p ) { return p->pInputs; } Map_Node_t ** Map_ManReadOutputs( Map_Man_t * p ) { return p->pOutputs; } Map_Node_t * Map_ManReadConst1 ( Map_Man_t * p ) { return p->pConst1; } -Map_Time_t * Map_ManReadInputArrivals( Map_Man_t * p ) { return p->pInputArrivals;} +Map_Time_t * Map_ManReadInputArrivals( Map_Man_t * p ) { return p->pInputArrivals; } +Map_Time_t * Map_ManReadOutputRequireds( Map_Man_t * p ) { return p->pOutputRequireds; } Mio_Library_t * Map_ManReadGenLib ( Map_Man_t * p ) { return p->pSuperLib->pGenlib; } int Map_ManReadVerbose( Map_Man_t * p ) { return p->fVerbose; } float Map_ManReadAreaFinal( Map_Man_t * p ) { return p->AreaFinal; } -float Map_ManReadRequiredGlo( Map_Man_t * p ) { return p->fRequiredGlo; } +float Map_ManReadRequiredGlo( Map_Man_t * p ) { return p->fRequiredGlo; } void Map_ManSetTimeToMap( Map_Man_t * p, int Time ) { p->timeToMap = Time; } void Map_ManSetTimeToNet( Map_Man_t * p, int Time ) { p->timeToNet = Time; } void Map_ManSetTimeSweep( Map_Man_t * p, int Time ) { p->timeSweep = Time; } void Map_ManSetTimeTotal( Map_Man_t * p, int Time ) { p->timeTotal = Time; } -void Map_ManSetOutputNames( Map_Man_t * p, char ** ppNames ) { p->ppOutputNames = ppNames; } +void Map_ManSetOutputNames( Map_Man_t * p, char ** ppNames ) { p->ppOutputNames = ppNames;} void Map_ManSetAreaRecovery( Map_Man_t * p, int fAreaRecovery ) { p->fAreaRecovery = fAreaRecovery;} void Map_ManSetDelayTarget( Map_Man_t * p, float DelayTarget ) { p->DelayTarget = DelayTarget;} -void Map_ManSetInputArrivals( Map_Man_t * p, Map_Time_t * pArrivals ) { p->pInputArrivals = pArrivals;} +void Map_ManSetInputArrivals( Map_Man_t * p, Map_Time_t * pArrivals ) { p->pInputArrivals = pArrivals; } +void Map_ManSetOutputRequireds( Map_Man_t * p, Map_Time_t * pRequireds ) { p->pOutputRequireds = pRequireds; } void Map_ManSetObeyFanoutLimits( Map_Man_t * p, int fObeyFanoutLimits ) { p->fObeyFanoutLimits = fObeyFanoutLimits; } void Map_ManSetNumIterations( Map_Man_t * p, int nIterations ) { p->nIterations = nIterations; } -int Map_ManReadFanoutViolations( Map_Man_t * p ) { return p->nFanoutViolations; } -void Map_ManSetFanoutViolations( Map_Man_t * p, int nVio ) { p->nFanoutViolations = nVio; } +int Map_ManReadFanoutViolations( Map_Man_t * p ) { return p->nFanoutViolations; } +void Map_ManSetFanoutViolations( Map_Man_t * p, int nVio ) { p->nFanoutViolations = nVio; } void Map_ManSetChoiceNodeNum( Map_Man_t * p, int nChoiceNodes ) { p->nChoiceNodes = nChoiceNodes; } -void Map_ManSetChoiceNum( Map_Man_t * p, int nChoices ) { p->nChoices = nChoices; } -void Map_ManSetVerbose( Map_Man_t * p, int fVerbose ) { p->fVerbose = fVerbose; } +void Map_ManSetChoiceNum( Map_Man_t * p, int nChoices ) { p->nChoices = nChoices; } +void Map_ManSetVerbose( Map_Man_t * p, int fVerbose ) { p->fVerbose = fVerbose; } void Map_ManSetSwitching( Map_Man_t * p, int fSwitching ) { p->fSwitching = fSwitching; } /**Function************************************************************* @@ -267,6 +269,7 @@ void Map_ManFree( Map_Man_t * p ) Extra_MmFixedStop( p->mmNodes ); Extra_MmFixedStop( p->mmCuts ); ABC_FREE( p->pInputArrivals ); + ABC_FREE( p->pOutputRequireds ); ABC_FREE( p->pInputs ); ABC_FREE( p->pOutputs ); ABC_FREE( p->pBins ); diff --git a/src/map/mapper/mapperInt.h b/src/map/mapper/mapperInt.h index 08a27e68..8d1e3fb7 100644 --- a/src/map/mapper/mapperInt.h +++ b/src/map/mapper/mapperInt.h @@ -106,6 +106,7 @@ struct Map_ManStruct_t_ // info about the original circuit char ** ppOutputNames; // the primary output names Map_Time_t * pInputArrivals;// the PI arrival times + Map_Time_t * pOutputRequireds;// the PI arrival times // mapping parameters int nVarsMax; // the max number of variables diff --git a/src/map/mapper/mapperTime.c b/src/map/mapper/mapperTime.c index d12b607a..162e6f9a 100644 --- a/src/map/mapper/mapperTime.c +++ b/src/map/mapper/mapperTime.c @@ -231,7 +231,7 @@ void Map_TimeComputeRequiredGlobal( Map_Man_t * p ) ***********************************************************************/ void Map_TimeComputeRequired( Map_Man_t * p, float fRequired ) { - Map_Time_t * ptTime; + Map_Time_t * ptTime, * ptTimeA; int fPhase, i; // clean the required times @@ -250,7 +250,17 @@ void Map_TimeComputeRequired( Map_Man_t * p, float fRequired ) { fPhase = !Map_IsComplement(p->pOutputs[i]); ptTime = Map_Regular(p->pOutputs[i])->tRequired + fPhase; - ptTime->Rise = ptTime->Fall = ptTime->Worst = fRequired; + ptTimeA = Map_Regular(p->pOutputs[i])->tArrival + fPhase; + + // if external required time can be achieved, use it + if ( p->pOutputRequireds && p->pOutputRequireds[i].Worst > 0 && ptTimeA->Worst <= p->pOutputRequireds[i].Worst && p->pOutputRequireds[i].Worst <= fRequired ) + ptTime->Rise = ptTime->Fall = ptTime->Worst = p->pOutputRequireds[i].Worst; + // if external required cannot be achieved, set the earliest possible arrival time + else if ( p->pOutputRequireds && p->pOutputRequireds[i].Worst > 0 && ptTimeA->Worst > p->pOutputRequireds[i].Worst ) + ptTime->Rise = ptTime->Fall = ptTime->Worst = ptTimeA->Worst; + // otherwise, set the global required time + else + ptTime->Rise = ptTime->Fall = ptTime->Worst = fRequired; } // sorts the nodes in the decreasing order of levels |