Commit eb4aa425 by Alan Mishchenko

Enabling user-specified required times in 'map'.

parent a0933b16
...@@ -867,12 +867,13 @@ extern ABC_DLL void Abc_NtkTimeSetDefaultArrival( Abc_Ntk_t * pNtk ...@@ -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_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_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_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_ManTimeStop( Abc_ManTime_t * p );
extern ABC_DLL void Abc_ManTimeDup( Abc_Ntk_t * pNtkOld, Abc_Ntk_t * pNtkNew ); 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 void Abc_NtkSetNodeLevelsArrival( Abc_Ntk_t * pNtk );
extern ABC_DLL float * Abc_NtkGetCiArrivalFloats( 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_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 float Abc_NtkDelayTrace( Abc_Ntk_t * pNtk );
extern ABC_DLL int Abc_ObjLevelNew( Abc_Obj_t * pObj ); extern ABC_DLL int Abc_ObjLevelNew( Abc_Obj_t * pObj );
extern ABC_DLL int Abc_ObjReverseLevelNew( Abc_Obj_t * pObj ); extern ABC_DLL int Abc_ObjReverseLevelNew( Abc_Obj_t * pObj );
......
...@@ -226,6 +226,9 @@ void Abc_NtkFinalize( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkNew ) ...@@ -226,6 +226,9 @@ void Abc_NtkFinalize( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkNew )
pDriverNew = Abc_ObjNotCond(pDriver->pCopy, Abc_ObjFaninC0(pObj)); pDriverNew = Abc_ObjNotCond(pDriver->pCopy, Abc_ObjFaninC0(pObj));
Abc_ObjAddFanin( pObj->pCopy, pDriverNew ); Abc_ObjAddFanin( pObj->pCopy, pDriverNew );
} }
// duplicate timing manager
if ( pNtk->pManTime )
Abc_NtkTimeInitialize( pNtkNew, pNtk );
} }
/**Function************************************************************* /**Function*************************************************************
...@@ -378,6 +381,10 @@ Abc_Ntk_t * Abc_NtkDup( Abc_Ntk_t * pNtk ) ...@@ -378,6 +381,10 @@ Abc_Ntk_t * Abc_NtkDup( Abc_Ntk_t * pNtk )
pNtkNew->pExdc = Abc_NtkDup( pNtk->pExdc ); pNtkNew->pExdc = Abc_NtkDup( pNtk->pExdc );
if ( pNtk->pExcare ) if ( pNtk->pExcare )
pNtkNew->pExcare = Abc_NtkDup( (Abc_Ntk_t *)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 ) ) if ( !Abc_NtkCheck( pNtkNew ) )
fprintf( stdout, "Abc_NtkDup(): Network check has failed.\n" ); fprintf( stdout, "Abc_NtkDup(): Network check has failed.\n" );
pNtk->pCopy = pNtkNew; pNtk->pCopy = pNtkNew;
......
...@@ -163,6 +163,7 @@ Map_Man_t * Abc_NtkToMap( Abc_Ntk_t * pNtk, double DelayTarget, int fRecovery, f ...@@ -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_ManSetOutputNames( pMan, Abc_NtkCollectCioNames(pNtk, 1) );
Map_ManSetDelayTarget( pMan, (float)DelayTarget ); Map_ManSetDelayTarget( pMan, (float)DelayTarget );
Map_ManSetInputArrivals( pMan, (Map_Time_t *)Abc_NtkGetCiArrivalTimes(pNtk) ); 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 // create PIs and remember them in the old nodes
Abc_NtkCleanCopy( pNtk ); Abc_NtkCleanCopy( pNtk );
......
...@@ -40,7 +40,6 @@ struct Abc_ManTime_t_ ...@@ -40,7 +40,6 @@ struct Abc_ManTime_t_
// static functions // static functions
static Abc_ManTime_t * Abc_ManTimeStart(); static Abc_ManTime_t * Abc_ManTimeStart();
static void Abc_ManTimeExpand( Abc_ManTime_t * p, int nSize, int fProgressive ); 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 ); void Abc_NodeDelayTraceArrival( Abc_Obj_t * pNode );
...@@ -139,7 +138,7 @@ void Abc_NtkTimeSetDefaultArrival( Abc_Ntk_t * pNtk, float Rise, float Fall ) ...@@ -139,7 +138,7 @@ void Abc_NtkTimeSetDefaultArrival( Abc_Ntk_t * pNtk, float Rise, float Fall )
pNtk->pManTime = Abc_ManTimeStart(); pNtk->pManTime = Abc_ManTimeStart();
pNtk->pManTime->tArrDef.Rise = Rise; pNtk->pManTime->tArrDef.Rise = Rise;
pNtk->pManTime->tArrDef.Fall = Fall; pNtk->pManTime->tArrDef.Fall = Fall;
pNtk->pManTime->tArrDef.Worst = Abc_MaxInt( Rise, Fall ); pNtk->pManTime->tArrDef.Worst = Abc_MaxFloat( Rise, Fall );
} }
/**Function************************************************************* /**Function*************************************************************
...@@ -161,7 +160,7 @@ void Abc_NtkTimeSetDefaultRequired( Abc_Ntk_t * pNtk, float Rise, float Fall ) ...@@ -161,7 +160,7 @@ void Abc_NtkTimeSetDefaultRequired( Abc_Ntk_t * pNtk, float Rise, float Fall )
pNtk->pManTime = Abc_ManTimeStart(); pNtk->pManTime = Abc_ManTimeStart();
pNtk->pManTime->tReqDef.Rise = Rise; pNtk->pManTime->tReqDef.Rise = Rise;
pNtk->pManTime->tReqDef.Fall = Fall; pNtk->pManTime->tReqDef.Fall = Fall;
pNtk->pManTime->tReqDef.Worst = Abc_MaxInt( Rise, Fall ); pNtk->pManTime->tReqDef.Worst = Abc_MaxFloat( Rise, Fall );
} }
/**Function************************************************************* /**Function*************************************************************
...@@ -189,7 +188,7 @@ void Abc_NtkTimeSetArrival( Abc_Ntk_t * pNtk, int ObjId, float Rise, float Fall ...@@ -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 = (Abc_Time_t *)vTimes->pArray[ObjId];
pTime->Rise = Rise; pTime->Rise = Rise;
pTime->Fall = Fall; pTime->Fall = Fall;
pTime->Worst = Abc_MaxInt( Rise, Fall ); pTime->Worst = Abc_MaxFloat( Rise, Fall );
} }
/**Function************************************************************* /**Function*************************************************************
...@@ -217,7 +216,7 @@ void Abc_NtkTimeSetRequired( Abc_Ntk_t * pNtk, int ObjId, float Rise, float Fall ...@@ -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 = (Abc_Time_t *)vTimes->pArray[ObjId];
pTime->Rise = Rise; pTime->Rise = Rise;
pTime->Fall = Fall; pTime->Fall = Fall;
pTime->Worst = Abc_MaxInt( Rise, Fall ); pTime->Worst = Abc_MaxFloat( Rise, Fall );
} }
/**Function************************************************************* /**Function*************************************************************
...@@ -231,14 +230,23 @@ void Abc_NtkTimeSetRequired( Abc_Ntk_t * pNtk, int ObjId, float Rise, float Fall ...@@ -231,14 +230,23 @@ void Abc_NtkTimeSetRequired( Abc_Ntk_t * pNtk, int ObjId, float Rise, float Fall
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
void Abc_NtkTimeInitialize( Abc_Ntk_t * pNtk ) void Abc_NtkTimeInitialize( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkOld )
{ {
Abc_Obj_t * pObj; Abc_Obj_t * pObj;
Abc_Time_t ** ppTimes, * pTime; Abc_Time_t ** ppTimes, * pTime;
int i; 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 ) if ( pNtk->pManTime == NULL )
return; return;
Abc_ManTimeExpand( pNtk->pManTime, Abc_NtkObjNumMax(pNtk), 0 ); 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 // set the default timing
ppTimes = (Abc_Time_t **)pNtk->pManTime->vArrs->pArray; ppTimes = (Abc_Time_t **)pNtk->pManTime->vArrs->pArray;
Abc_NtkForEachPi( pNtk, pObj, i ) Abc_NtkForEachPi( pNtk, pObj, i )
...@@ -246,7 +254,7 @@ void Abc_NtkTimeInitialize( Abc_Ntk_t * pNtk ) ...@@ -246,7 +254,7 @@ void Abc_NtkTimeInitialize( Abc_Ntk_t * pNtk )
pTime = ppTimes[pObj->Id]; pTime = ppTimes[pObj->Id];
if ( pTime->Worst != -ABC_INFINITY ) if ( pTime->Worst != -ABC_INFINITY )
continue; continue;
*pTime = pNtk->pManTime->tArrDef; *pTime = pNtkOld ? *Abc_NodeReadArrival(Abc_NtkPi(pNtkOld, i)) : pNtk->pManTime->tArrDef;
} }
// set the default timing // set the default timing
ppTimes = (Abc_Time_t **)pNtk->pManTime->vReqs->pArray; ppTimes = (Abc_Time_t **)pNtk->pManTime->vReqs->pArray;
...@@ -255,7 +263,7 @@ void Abc_NtkTimeInitialize( Abc_Ntk_t * pNtk ) ...@@ -255,7 +263,7 @@ void Abc_NtkTimeInitialize( Abc_Ntk_t * pNtk )
pTime = ppTimes[pObj->Id]; pTime = ppTimes[pObj->Id];
if ( pTime->Worst != -ABC_INFINITY ) if ( pTime->Worst != -ABC_INFINITY )
continue; 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 // set the 0 arrival times for latch outputs and constant nodes
ppTimes = (Abc_Time_t **)pNtk->pManTime->vArrs->pArray; ppTimes = (Abc_Time_t **)pNtk->pManTime->vArrs->pArray;
...@@ -286,7 +294,7 @@ void Abc_NtkTimePrepare( Abc_Ntk_t * pNtk ) ...@@ -286,7 +294,7 @@ void Abc_NtkTimePrepare( Abc_Ntk_t * pNtk )
if ( pNtk->pManTime == NULL ) if ( pNtk->pManTime == NULL )
{ {
pNtk->pManTime = Abc_ManTimeStart(); pNtk->pManTime = Abc_ManTimeStart();
Abc_NtkTimeInitialize( pNtk ); Abc_NtkTimeInitialize( pNtk, NULL );
return; return;
} }
// if timing manager is given, expand it if necessary // if timing manager is given, expand it if necessary
...@@ -304,6 +312,17 @@ void Abc_NtkTimePrepare( Abc_Ntk_t * pNtk ) ...@@ -304,6 +312,17 @@ void Abc_NtkTimePrepare( Abc_Ntk_t * pNtk )
pTime->Fall = pTime->Rise = pTime->Worst = -ABC_INFINITY; pTime->Fall = pTime->Rise = pTime->Worst = -ABC_INFINITY;
} }
// clean required except for POs // 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 ) ...@@ -499,8 +518,7 @@ Abc_Time_t * Abc_NtkGetCiArrivalTimes( Abc_Ntk_t * pNtk )
Abc_Time_t * p; Abc_Time_t * p;
Abc_Obj_t * pNode; Abc_Obj_t * pNode;
int i; int i;
p = ABC_ALLOC( Abc_Time_t, Abc_NtkCiNum(pNtk) ); p = ABC_CALLOC( Abc_Time_t, Abc_NtkCiNum(pNtk) );
memset( p, 0, sizeof(Abc_Time_t) * Abc_NtkCiNum(pNtk) );
if ( pNtk->pManTime == NULL ) if ( pNtk->pManTime == NULL )
return p; return p;
// set the PI arrival times // set the PI arrival times
...@@ -509,6 +527,31 @@ Abc_Time_t * Abc_NtkGetCiArrivalTimes( Abc_Ntk_t * pNtk ) ...@@ -509,6 +527,31 @@ Abc_Time_t * Abc_NtkGetCiArrivalTimes( Abc_Ntk_t * pNtk )
return p; 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************************************************************* /**Function*************************************************************
...@@ -526,8 +569,7 @@ float * Abc_NtkGetCiArrivalFloats( Abc_Ntk_t * pNtk ) ...@@ -526,8 +569,7 @@ float * Abc_NtkGetCiArrivalFloats( Abc_Ntk_t * pNtk )
float * p; float * p;
Abc_Obj_t * pNode; Abc_Obj_t * pNode;
int i; int i;
p = ABC_ALLOC( float, Abc_NtkCiNum(pNtk) ); p = ABC_CALLOC( float, Abc_NtkCiNum(pNtk) );
memset( p, 0, sizeof(float) * Abc_NtkCiNum(pNtk) );
if ( pNtk->pManTime == NULL ) if ( pNtk->pManTime == NULL )
return p; return p;
// set the PI arrival times // set the PI arrival times
...@@ -625,7 +667,7 @@ void Abc_NodeDelayTraceArrival( Abc_Obj_t * pNode ) ...@@ -625,7 +667,7 @@ void Abc_NodeDelayTraceArrival( Abc_Obj_t * pNode )
} }
pPin = Mio_PinReadNext(pPin); 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 ) ...@@ -647,7 +689,7 @@ int Abc_ObjLevelNew( Abc_Obj_t * pObj )
Abc_Obj_t * pFanin; Abc_Obj_t * pFanin;
int i, Level = 0; int i, Level = 0;
Abc_ObjForEachFanin( pObj, pFanin, i ) Abc_ObjForEachFanin( pObj, pFanin, i )
Level = Abc_MaxInt( Level, Abc_ObjLevel(pFanin) ); Level = Abc_MaxFloat( Level, Abc_ObjLevel(pFanin) );
return Level + 1; return Level + 1;
} }
...@@ -669,7 +711,7 @@ int Abc_ObjReverseLevelNew( Abc_Obj_t * pObj ) ...@@ -669,7 +711,7 @@ int Abc_ObjReverseLevelNew( Abc_Obj_t * pObj )
Abc_ObjForEachFanout( pObj, pFanout, i ) Abc_ObjForEachFanout( pObj, pFanout, i )
{ {
LevelCur = Abc_ObjReverseLevel( pFanout ); LevelCur = Abc_ObjReverseLevel( pFanout );
Level = Abc_MaxInt( Level, LevelCur ); Level = Abc_MaxFloat( Level, LevelCur );
} }
return Level + 1; return Level + 1;
} }
...@@ -827,7 +869,7 @@ void Abc_NtkUpdateLevel( Abc_Obj_t * pObjNew, Vec_Vec_t * vLevels ) ...@@ -827,7 +869,7 @@ void Abc_NtkUpdateLevel( Abc_Obj_t * pObjNew, Vec_Vec_t * vLevels )
assert( Abc_ObjLevel(pFanout) >= Lev ); assert( Abc_ObjLevel(pFanout) >= Lev );
Vec_VecPush( vLevels, Abc_ObjLevel(pFanout), pFanout ); Vec_VecPush( vLevels, Abc_ObjLevel(pFanout), pFanout );
// Counter++; // Counter++;
// CounterMax = Abc_MaxInt( CounterMax, Counter ); // CounterMax = Abc_MaxFloat( CounterMax, Counter );
pFanout->fMarkA = 1; pFanout->fMarkA = 1;
} }
} }
......
...@@ -64,7 +64,9 @@ static int Io_ReadBlifNetworkNames( Io_ReadBlif_t * p, Vec_Ptr_t ** pvTokens ); ...@@ -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_ReadBlifNetworkGate( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens );
static int Io_ReadBlifNetworkSubcircuit( 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_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_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 ); 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 ) ...@@ -100,7 +102,7 @@ Abc_Ntk_t * Io_ReadBlif( char * pFileName, int fCheck )
return NULL; return NULL;
} }
pNtk->pSpec = Extra_UtilStrsav( pFileName ); pNtk->pSpec = Extra_UtilStrsav( pFileName );
Abc_NtkTimeInitialize( pNtk ); Abc_NtkTimeInitialize( pNtk, NULL );
Io_ReadBlifFree( p ); Io_ReadBlifFree( p );
// make sure that everything is okay with the network structure // make sure that everything is okay with the network structure
...@@ -267,8 +269,12 @@ Abc_Ntk_t * Io_ReadBlifNetworkOne( Io_ReadBlif_t * p ) ...@@ -267,8 +269,12 @@ Abc_Ntk_t * Io_ReadBlifNetworkOne( Io_ReadBlif_t * p )
fStatus = Io_ReadBlifNetworkOutputs( p, p->vTokens ); fStatus = Io_ReadBlifNetworkOutputs( p, p->vTokens );
else if ( !strcmp( pDirective, ".input_arrival" ) ) else if ( !strcmp( pDirective, ".input_arrival" ) )
fStatus = Io_ReadBlifNetworkInputArrival( p, p->vTokens ); 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" ) ) else if ( !strcmp( pDirective, ".default_input_arrival" ) )
fStatus = Io_ReadBlifNetworkDefaultInputArrival( p, p->vTokens ); fStatus = Io_ReadBlifNetworkDefaultInputArrival( p, p->vTokens );
else if ( !strcmp( pDirective, ".default_output_required" ) )
fStatus = Io_ReadBlifNetworkDefaultOutputRequired( p, p->vTokens );
// else if ( !strcmp( pDirective, ".subckt" ) ) // else if ( !strcmp( pDirective, ".subckt" ) )
// fStatus = Io_ReadBlifNetworkSubcircuit( p, p->vTokens ); // fStatus = Io_ReadBlifNetworkSubcircuit( p, p->vTokens );
else if ( !strcmp( pDirective, ".exdc" ) ) else if ( !strcmp( pDirective, ".exdc" ) )
...@@ -782,6 +788,54 @@ int Io_ReadBlifNetworkInputArrival( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens ) ...@@ -782,6 +788,54 @@ int Io_ReadBlifNetworkInputArrival( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens )
SeeAlso [] 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 ) int Io_ReadBlifNetworkDefaultInputArrival( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens )
{ {
char * pFoo1, * pFoo2; char * pFoo1, * pFoo2;
...@@ -812,6 +866,45 @@ int Io_ReadBlifNetworkDefaultInputArrival( Io_ReadBlif_t * p, Vec_Ptr_t * vToken ...@@ -812,6 +866,45 @@ int Io_ReadBlifNetworkDefaultInputArrival( Io_ReadBlif_t * p, Vec_Ptr_t * vToken
/**Function************************************************************* /**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.] Synopsis [Prints the error message including the file name and line number.]
Description [] Description []
......
...@@ -589,6 +589,8 @@ void Io_WriteTimingInfo( FILE * pFile, Abc_Ntk_t * pNtk ) ...@@ -589,6 +589,8 @@ void Io_WriteTimingInfo( FILE * pFile, Abc_Ntk_t * pNtk )
if ( pNtk->pManTime == NULL ) if ( pNtk->pManTime == NULL )
return; return;
fprintf( pFile, "\n" );
pTimeDef = Abc_NtkReadDefaultArrival( pNtk ); pTimeDef = Abc_NtkReadDefaultArrival( pNtk );
fprintf( pFile, ".default_input_arrival %g %g\n", pTimeDef->Rise, pTimeDef->Fall ); fprintf( pFile, ".default_input_arrival %g %g\n", pTimeDef->Rise, pTimeDef->Fall );
Abc_NtkForEachPi( pNtk, pNode, i ) Abc_NtkForEachPi( pNtk, pNode, i )
...@@ -596,9 +598,18 @@ void Io_WriteTimingInfo( FILE * pFile, Abc_Ntk_t * pNtk ) ...@@ -596,9 +598,18 @@ void Io_WriteTimingInfo( FILE * pFile, Abc_Ntk_t * pNtk )
pTime = Abc_NodeReadArrival(pNode); pTime = Abc_NodeReadArrival(pNode);
if ( pTime->Rise == pTimeDef->Rise && pTime->Fall == pTimeDef->Fall ) if ( pTime->Rise == pTimeDef->Rise && pTime->Fall == pTimeDef->Fall )
continue; 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 ); 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 );
}
} }
......
...@@ -97,6 +97,7 @@ extern void Map_ManSetOutputNames( Map_Man_t * p, char ** ppNames ); ...@@ -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_ManSetAreaRecovery( Map_Man_t * p, int fAreaRecovery );
extern void Map_ManSetDelayTarget( Map_Man_t * p, float DelayTarget ); 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_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_ManSetObeyFanoutLimits( Map_Man_t * p, int fObeyFanoutLimits );
extern void Map_ManSetNumIterations( Map_Man_t * p, int nNumIterations ); extern void Map_ManSetNumIterations( Map_Man_t * p, int nNumIterations );
extern int Map_ManReadPass( Map_Man_t * p ); extern int Map_ManReadPass( Map_Man_t * p );
......
...@@ -52,7 +52,8 @@ int Map_ManReadOutputNum( Map_Man_t * p ) { return ...@@ -52,7 +52,8 @@ int Map_ManReadOutputNum( Map_Man_t * p ) { return
Map_Node_t ** Map_ManReadInputs ( Map_Man_t * p ) { return p->pInputs; } 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_ManReadOutputs( Map_Man_t * p ) { return p->pOutputs; }
Map_Node_t * Map_ManReadConst1 ( Map_Man_t * p ) { return p->pConst1; } 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; } Mio_Library_t * Map_ManReadGenLib ( Map_Man_t * p ) { return p->pSuperLib->pGenlib; }
int Map_ManReadVerbose( Map_Man_t * p ) { return p->fVerbose; } int Map_ManReadVerbose( Map_Man_t * p ) { return p->fVerbose; }
float Map_ManReadAreaFinal( Map_Man_t * p ) { return p->AreaFinal; } float Map_ManReadAreaFinal( Map_Man_t * p ) { return p->AreaFinal; }
...@@ -61,10 +62,11 @@ void Map_ManSetTimeToMap( Map_Man_t * p, int Time ) { p->tim ...@@ -61,10 +62,11 @@ void Map_ManSetTimeToMap( Map_Man_t * p, int Time ) { p->tim
void Map_ManSetTimeToNet( Map_Man_t * p, int Time ) { p->timeToNet = 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_ManSetTimeSweep( Map_Man_t * p, int Time ) { p->timeSweep = Time; }
void Map_ManSetTimeTotal( Map_Man_t * p, int Time ) { p->timeTotal = 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_ManSetAreaRecovery( Map_Man_t * p, int fAreaRecovery ) { p->fAreaRecovery = fAreaRecovery;}
void Map_ManSetDelayTarget( Map_Man_t * p, float DelayTarget ) { p->DelayTarget = DelayTarget;} 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_ManSetObeyFanoutLimits( Map_Man_t * p, int fObeyFanoutLimits ) { p->fObeyFanoutLimits = fObeyFanoutLimits; }
void Map_ManSetNumIterations( Map_Man_t * p, int nIterations ) { p->nIterations = nIterations; } void Map_ManSetNumIterations( Map_Man_t * p, int nIterations ) { p->nIterations = nIterations; }
int Map_ManReadFanoutViolations( Map_Man_t * p ) { return p->nFanoutViolations; } int Map_ManReadFanoutViolations( Map_Man_t * p ) { return p->nFanoutViolations; }
...@@ -267,6 +269,7 @@ void Map_ManFree( Map_Man_t * p ) ...@@ -267,6 +269,7 @@ void Map_ManFree( Map_Man_t * p )
Extra_MmFixedStop( p->mmNodes ); Extra_MmFixedStop( p->mmNodes );
Extra_MmFixedStop( p->mmCuts ); Extra_MmFixedStop( p->mmCuts );
ABC_FREE( p->pInputArrivals ); ABC_FREE( p->pInputArrivals );
ABC_FREE( p->pOutputRequireds );
ABC_FREE( p->pInputs ); ABC_FREE( p->pInputs );
ABC_FREE( p->pOutputs ); ABC_FREE( p->pOutputs );
ABC_FREE( p->pBins ); ABC_FREE( p->pBins );
......
...@@ -106,6 +106,7 @@ struct Map_ManStruct_t_ ...@@ -106,6 +106,7 @@ struct Map_ManStruct_t_
// info about the original circuit // info about the original circuit
char ** ppOutputNames; // the primary output names char ** ppOutputNames; // the primary output names
Map_Time_t * pInputArrivals;// the PI arrival times Map_Time_t * pInputArrivals;// the PI arrival times
Map_Time_t * pOutputRequireds;// the PI arrival times
// mapping parameters // mapping parameters
int nVarsMax; // the max number of variables int nVarsMax; // the max number of variables
......
...@@ -231,7 +231,7 @@ void Map_TimeComputeRequiredGlobal( Map_Man_t * p ) ...@@ -231,7 +231,7 @@ void Map_TimeComputeRequiredGlobal( Map_Man_t * p )
***********************************************************************/ ***********************************************************************/
void Map_TimeComputeRequired( Map_Man_t * p, float fRequired ) void Map_TimeComputeRequired( Map_Man_t * p, float fRequired )
{ {
Map_Time_t * ptTime; Map_Time_t * ptTime, * ptTimeA;
int fPhase, i; int fPhase, i;
// clean the required times // clean the required times
...@@ -250,6 +250,16 @@ void Map_TimeComputeRequired( Map_Man_t * p, float fRequired ) ...@@ -250,6 +250,16 @@ void Map_TimeComputeRequired( Map_Man_t * p, float fRequired )
{ {
fPhase = !Map_IsComplement(p->pOutputs[i]); fPhase = !Map_IsComplement(p->pOutputs[i]);
ptTime = Map_Regular(p->pOutputs[i])->tRequired + fPhase; ptTime = Map_Regular(p->pOutputs[i])->tRequired + fPhase;
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; ptTime->Rise = ptTime->Fall = ptTime->Worst = fRequired;
} }
......
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