summaryrefslogtreecommitdiffstats
path: root/src/misc/tim
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2013-03-05 13:13:15 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2013-03-05 13:13:15 -0800
commit4ff5203f4c8b341eb717b742bf1af51f64f31ccd (patch)
treed3e814bd980de2c87db542d7e0929fded9db25b8 /src/misc/tim
parent0c9337f6276f8a56960f697b7361c978e3e50a41 (diff)
downloadabc-4ff5203f4c8b341eb717b742bf1af51f64f31ccd.tar.gz
abc-4ff5203f4c8b341eb717b742bf1af51f64f31ccd.tar.bz2
abc-4ff5203f4c8b341eb717b742bf1af51f64f31ccd.zip
Improvements to the hierarchy/timing manager.
Diffstat (limited to 'src/misc/tim')
-rw-r--r--src/misc/tim/tim.h5
-rw-r--r--src/misc/tim/timBox.c17
-rw-r--r--src/misc/tim/timInt.h1
-rw-r--r--src/misc/tim/timMan.c75
4 files changed, 78 insertions, 20 deletions
diff --git a/src/misc/tim/tim.h b/src/misc/tim/tim.h
index b2303c21..df787748 100644
--- a/src/misc/tim/tim.h
+++ b/src/misc/tim/tim.h
@@ -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 );
diff --git a/src/misc/tim/timBox.c b/src/misc/tim/timBox.c
index 5d29970e..bff7b39c 100644
--- a/src/misc/tim/timBox.c
+++ b/src/misc/tim/timBox.c
@@ -213,6 +213,23 @@ float * Tim_ManBoxDelayTable( Tim_Man_t * p, int iBox )
/**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.]
Description []
diff --git a/src/misc/tim/timInt.h b/src/misc/tim/timInt.h
index 67312064..27881498 100644
--- a/src/misc/tim/timInt.h
+++ b/src/misc/tim/timInt.h
@@ -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
};
diff --git a/src/misc/tim/timMan.c b/src/misc/tim/timMan.c
index 4825ed71..51a0c381 100644
--- a/src/misc/tim/timMan.c
+++ b/src/misc/tim/timMan.c
@@ -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 )