summaryrefslogtreecommitdiffstats
path: root/src/misc/tim
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2012-12-10 16:04:01 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2012-12-10 16:04:01 -0800
commitad67f4ef259db50a0eaa9debdbd80c40c0fac2d3 (patch)
tree5e85c8bc43bf6182bf1eae8476e89da2dabc82cf /src/misc/tim
parent2575a5d6836c5bd8160b8e965c622e358b2dc742 (diff)
downloadabc-ad67f4ef259db50a0eaa9debdbd80c40c0fac2d3.tar.gz
abc-ad67f4ef259db50a0eaa9debdbd80c40c0fac2d3.tar.bz2
abc-ad67f4ef259db50a0eaa9debdbd80c40c0fac2d3.zip
Assembling timing/hierarchy manager from input data.
Diffstat (limited to 'src/misc/tim')
-rw-r--r--src/misc/tim/tim.h1
-rw-r--r--src/misc/tim/timMan.c61
2 files changed, 62 insertions, 0 deletions
diff --git a/src/misc/tim/tim.h b/src/misc/tim/tim.h
index 5fda0e59..420398b6 100644
--- a/src/misc/tim/tim.h
+++ b/src/misc/tim/tim.h
@@ -127,6 +127,7 @@ extern Tim_Man_t * Tim_ManLoad( Vec_Str_t * p, int fHieOnly );
/*=== timMan.c ===========================================================*/
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_ManCreate( Tim_Man_t * p, void * pLib, Vec_Flt_t * vInArrs, Vec_Flt_t * vOutReqs );
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 6aa5034a..f3cd696e 100644
--- a/src/misc/tim/timMan.c
+++ b/src/misc/tim/timMan.c
@@ -19,6 +19,7 @@
***********************************************************************/
#include "timInt.h"
+#include "map/if/if.h"
ABC_NAMESPACE_IMPL_START
@@ -171,6 +172,66 @@ void Tim_ManStopP( Tim_Man_t ** p )
/**Function*************************************************************
+ Synopsis [Creates manager using hierarchy / box library / delay info.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+Tim_Man_t * Tim_ManCreate( Tim_Man_t * p, void * pLib, Vec_Flt_t * vInArrs, Vec_Flt_t * vOutReqs )
+{
+ Tim_Box_t * pBox;
+ If_LibBox_t * pLibBox = (If_LibBox_t *)pLib;
+ If_Box_t * pIfBox;
+ int i, k, * pTable;
+ float Entry;
+ assert( p->vDelayTables == NULL );
+ p->vDelayTables = Vec_PtrStart( Vec_PtrSize(pLibBox->vBoxes) );
+ Tim_ManForEachBox( p, pBox, i )
+ {
+ if ( pBox->iDelayTable == -1 )
+ {
+ // create table with constants
+ pTable = ABC_ALLOC( int, pBox->nInputs * pBox->nOutputs );
+ for ( k = 0; k < pBox->nInputs * pBox->nOutputs; k++ )
+ pTable[k] = 1;
+ continue;
+ }
+ assert( pBox->iDelayTable >= 0 && pBox->iDelayTable < Vec_PtrSize(pLibBox->vBoxes) );
+ pIfBox = (If_Box_t *)Vec_PtrEntry( pLibBox->vBoxes, pBox->iDelayTable );
+ assert( pIfBox != NULL );
+ assert( pIfBox->nPis == pBox->nInputs );
+ assert( pIfBox->nPos == pBox->nOutputs );
+ if ( Vec_PtrEntry( p->vDelayTables, pBox->iDelayTable ) != NULL )
+ continue;
+ // create table of boxes
+ pTable = ABC_ALLOC( int, pBox->nInputs * pBox->nOutputs );
+ for ( k = 0; k < pBox->nInputs * pBox->nOutputs; k++ )
+ pTable[k] = pIfBox->pDelays[k];
+ }
+ // create arrival times
+ if ( vInArrs )
+ {
+ assert( Vec_FltSize(vInArrs) == Tim_ManPiNum(p) );
+ Vec_FltForEachEntry( vInArrs, Entry, i )
+ Tim_ManInitPiArrival( p, i, Entry );
+ }
+ // create required times
+ if ( vOutReqs )
+ {
+ assert( Vec_FltSize(vOutReqs) == Tim_ManPoNum(p) );
+ Vec_FltForEachEntry( vOutReqs, Entry, i )
+ Tim_ManInitPoRequired( p, i, Entry );
+ }
+ return p;
+}
+
+
+/**Function*************************************************************
+
Synopsis [Prints the timing manager.]
Description []