Improvements to the hierarchy/timing manager.

This commit is contained in:
Alan Mishchenko
2013-03-05 13:13:15 -08:00
parent 0c9337f627
commit 4ff5203f4c
20 changed files with 198 additions and 88 deletions
+4 -1
View File
@@ -119,6 +119,7 @@ extern int Tim_ManBoxInputNum( Tim_Man_t * p, int iBox );
extern int Tim_ManBoxOutputNum( Tim_Man_t * p, int iBox );
extern int Tim_ManBoxDelayTableId( Tim_Man_t * p, int iBox );
extern float * Tim_ManBoxDelayTable( Tim_Man_t * p, int iBox );
extern int Tim_ManBoxIsBlack( Tim_Man_t * p, int iBox );
extern int Tim_ManBoxCopy( Tim_Man_t * p, int iBox );
extern void Tim_ManBoxSetCopy( Tim_Man_t * p, int iBox, int iCopy );
extern int Tim_ManBoxFindFromCiNum( Tim_Man_t * p, int iCiNum );
@@ -129,8 +130,10 @@ 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 Tim_Man_t * Tim_ManTrim( Tim_Man_t * p, Vec_Int_t * vBoxPres );
extern Vec_Int_t * Tim_ManAlignTwo( Tim_Man_t * pSpec, Tim_Man_t * pImpl );
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 float * Tim_ManGetArrTimes( Tim_Man_t * p );
extern float * Tim_ManGetReqTimes( Tim_Man_t * p );
extern void Tim_ManStop( Tim_Man_t * p );
extern void Tim_ManStopP( Tim_Man_t ** p );
extern void Tim_ManPrint( Tim_Man_t * p );
+17
View File
@@ -211,6 +211,23 @@ float * Tim_ManBoxDelayTable( Tim_Man_t * p, int iBox )
return pTable;
}
/**Function*************************************************************
Synopsis [Return 1 if the box is black.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int Tim_ManBoxIsBlack( Tim_Man_t * p, int iBox )
{
return Tim_ManBox(p, iBox)->fBlack;
}
/**Function*************************************************************
Synopsis [Returns the copy of the box.]
+1
View File
@@ -71,6 +71,7 @@ struct Tim_Box_t_
int nOutputs; // the number of box outputs (PIs)
int iDelayTable; // index of the delay table
int iCopy; // copy of this box
int fBlack; // this is black box
int Inouts[0]; // the int numbers of PIs and POs
};
+56 -19
View File
@@ -234,6 +234,36 @@ Tim_Man_t * Tim_ManTrim( Tim_Man_t * p, Vec_Int_t * vBoxPres )
return pNew;
}
/**Function*************************************************************
Synopsis [Aligns two sets of boxes using the copy field.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Int_t * Tim_ManAlignTwo( Tim_Man_t * pSpec, Tim_Man_t * pImpl )
{
Vec_Int_t * vBoxPres;
Tim_Box_t * pBox;
int i;
assert( Tim_ManBoxNum(pSpec) > Tim_ManBoxNum(pImpl) );
// check if boxes of pImpl can be aligned
Tim_ManForEachBox( pImpl, pBox, i )
if ( pBox->iCopy < 0 || pBox->iCopy >= Tim_ManBoxNum(pSpec) )
return NULL;
// map dropped boxes into 1, others into 0
vBoxPres = Vec_IntStart( Tim_ManBoxNum(pSpec) );
Tim_ManForEachBox( pImpl, pBox, i )
{
assert( !Vec_IntEntry(vBoxPres, pBox->iCopy) );
Vec_IntWriteEntry( vBoxPres, pBox->iCopy, 1 );
}
return vBoxPres;
}
/**Function*************************************************************
@@ -306,6 +336,7 @@ void Tim_ManCreate( Tim_Man_t * p, void * pLib, Vec_Flt_t * vInArrs, Vec_Flt_t *
assert( pIfBox != NULL );
assert( pIfBox->nPis == pBox->nInputs );
assert( pIfBox->nPos == pBox->nOutputs );
pBox->fBlack = pIfBox->fBlack;
if ( Vec_PtrEntry( p->vDelayTables, pBox->iDelayTable ) != NULL )
continue;
// create table of boxes
@@ -349,33 +380,36 @@ void Tim_ManCreate( Tim_Man_t * p, void * pLib, Vec_Flt_t * vInArrs, Vec_Flt_t *
SeeAlso []
***********************************************************************/
int Tim_ManGetArrsReqs( Tim_Man_t * p, Vec_Flt_t ** pvInArrs, Vec_Flt_t ** pvOutReqs )
float * Tim_ManGetArrTimes( Tim_Man_t * p )
{
float * pTimes;
Tim_Obj_t * pObj;
int i, fTrivial = 1;
*pvInArrs = NULL;
*pvOutReqs = NULL;
int i;
Tim_ManForEachPi( p, pObj, i )
if ( pObj->timeArr != 0.0 )
{
fTrivial = 0;
break;
}
if ( i == Tim_ManPiNum(p) )
return NULL;
pTimes = ABC_ALLOC( float, Tim_ManPiNum(p) );
Tim_ManForEachPi( p, pObj, i )
pTimes[i] = pObj->timeArr;
return pTimes;
}
float * Tim_ManGetReqTimes( Tim_Man_t * p )
{
float * pTimes;
Tim_Obj_t * pObj;
int i, k = 0;
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) );
if ( i == Tim_ManPoNum(p) )
return NULL;
pTimes = ABC_ALLOC( float, Tim_ManPoNum(p) );
Tim_ManForEachPo( p, pObj, i )
Vec_FltPush( *pvOutReqs, pObj->timeReq );
return 1;
pTimes[k++] = pObj->timeArr;
assert( k == Tim_ManPoNum(p) );
return pTimes;
}
@@ -421,8 +455,11 @@ void Tim_ManPrint( Tim_Man_t * p )
if ( i == Tim_ManCoNum(p) )
printf( "All POs : arr = %5.3f req = %5.3f\n", pPrev->timeArr, pPrev->timeReq );
else
{
int k = 0;
Tim_ManForEachPo( p, pObj, i )
printf( "PO%5d : arr = %5.3f req = %5.3f\n", i, pObj->timeArr, pObj->timeReq );
printf( "PO%5d : arr = %5.3f req = %5.3f\n", k++, pObj->timeArr, pObj->timeReq );
}
// print box info
if ( Tim_ManBoxNum(p) > 0 )