From bfad6542056bebc84497ad1d3c7e2231999b4b6e Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Sat, 15 Dec 2012 17:39:34 -0800 Subject: Assembling timing/hierarchy manager from input data. --- src/misc/tim/tim.h | 1 + src/misc/tim/timMan.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 51 insertions(+), 5 deletions(-) (limited to 'src/misc') diff --git a/src/misc/tim/tim.h b/src/misc/tim/tim.h index 97e55b9d..48bef93a 100644 --- a/src/misc/tim/tim.h +++ b/src/misc/tim/tim.h @@ -128,6 +128,7 @@ extern Tim_Man_t * Tim_ManLoad( Vec_Str_t * p, int fHieOnly ); extern Tim_Man_t * Tim_ManStart( int nCis, int nCos ); extern Tim_Man_t * Tim_ManDup( Tim_Man_t * p, int fUnitDelay ); extern void Tim_ManCreate( Tim_Man_t * p, void * pLib, Vec_Flt_t * vInArrs, Vec_Flt_t * vOutReqs ); +extern int Tim_ManGetArrsReqs( Tim_Man_t * p, Vec_Flt_t ** pvInArrs, Vec_Flt_t ** pvOutReqs ); extern void Tim_ManStop( Tim_Man_t * p ); extern void Tim_ManStopP( Tim_Man_t ** p ); extern void Tim_ManPrint( Tim_Man_t * p ); diff --git a/src/misc/tim/timMan.c b/src/misc/tim/timMan.c index 965f3d11..72f3bbff 100644 --- a/src/misc/tim/timMan.c +++ b/src/misc/tim/timMan.c @@ -186,7 +186,8 @@ void Tim_ManCreate( Tim_Man_t * p, void * pLib, Vec_Flt_t * vInArrs, Vec_Flt_t * If_LibBox_t * pLibBox = (If_LibBox_t *)pLib; If_Box_t * pIfBox; Tim_Box_t * pBox; - float * pTable, Entry; + Tim_Obj_t * pObj; + float * pTable; int i, k; assert( p->vDelayTables == NULL ); p->vDelayTables = Vec_PtrStart( Vec_PtrSize(pLibBox->vBoxes) ); @@ -227,19 +228,63 @@ void Tim_ManCreate( Tim_Man_t * p, void * pLib, Vec_Flt_t * vInArrs, Vec_Flt_t * if ( vInArrs ) { assert( Vec_FltSize(vInArrs) == Tim_ManPiNum(p) ); - Vec_FltForEachEntry( vInArrs, Entry, i ) - Tim_ManInitPiArrival( p, i, Entry ); + Tim_ManForEachPi( p, pObj, i ) + pObj->timeArr = Vec_FltEntry(vInArrs, i); + } // create required times if ( vOutReqs ) { + k = 0; assert( Vec_FltSize(vOutReqs) == Tim_ManPoNum(p) ); - Vec_FltForEachEntry( vOutReqs, Entry, i ) - Tim_ManInitPoRequired( p, i, Entry ); + Tim_ManForEachPo( p, pObj, i ) + pObj->timeReq = Vec_FltEntry(vOutReqs, k++); + assert( k == Tim_ManPoNum(p) ); } } +/**Function************************************************************* + + Synopsis [Get arrival and required times if they are non-trivial.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Tim_ManGetArrsReqs( Tim_Man_t * p, Vec_Flt_t ** pvInArrs, Vec_Flt_t ** pvOutReqs ) +{ + Tim_Obj_t * pObj; + int i, fTrivial = 1; + *pvInArrs = NULL; + *pvOutReqs = NULL; + Tim_ManForEachPi( p, pObj, i ) + if ( pObj->timeArr != 0.0 ) + { + fTrivial = 0; + break; + } + Tim_ManForEachPo( p, pObj, i ) + if ( pObj->timeReq != TIM_ETERNITY ) + { + fTrivial = 0; + break; + } + if ( fTrivial ) + return 0; + *pvInArrs = Vec_FltAlloc( Tim_ManPiNum(p) ); + Tim_ManForEachPi( p, pObj, i ) + Vec_FltPush( *pvInArrs, pObj->timeArr ); + *pvOutReqs = Vec_FltAlloc( Tim_ManPoNum(p) ); + Tim_ManForEachPo( p, pObj, i ) + Vec_FltPush( *pvOutReqs, pObj->timeReq ); + return 1; +} + + /**Function************************************************************* Synopsis [Prints the timing manager.] -- cgit v1.2.3