abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
tim.h File Reference

Go to the source code of this file.

Macros

#define TIM_ETERNITY   1000000000
 MACRO DEFINITIONS ///. More...
 

Typedefs

typedef
typedefABC_NAMESPACE_HEADER_START
struct Tim_Man_t_ 
Tim_Man_t
 INCLUDES ///. More...
 

Functions

void Tim_ManCreateBox (Tim_Man_t *p, int firstIn, int nIns, int firstOut, int nOuts, int iDelayTable)
 ITERATORS ///. More...
 
int Tim_ManBoxForCi (Tim_Man_t *p, int iCo)
 
int Tim_ManBoxForCo (Tim_Man_t *p, int iCi)
 
int Tim_ManBoxInputFirst (Tim_Man_t *p, int iBox)
 
int Tim_ManBoxInputLast (Tim_Man_t *p, int iBox)
 
int Tim_ManBoxOutputFirst (Tim_Man_t *p, int iBox)
 
int Tim_ManBoxOutputLast (Tim_Man_t *p, int iBox)
 
int Tim_ManBoxInputNum (Tim_Man_t *p, int iBox)
 
int Tim_ManBoxOutputNum (Tim_Man_t *p, int iBox)
 
int Tim_ManBoxDelayTableId (Tim_Man_t *p, int iBox)
 
float * Tim_ManBoxDelayTable (Tim_Man_t *p, int iBox)
 
int Tim_ManBoxIsBlack (Tim_Man_t *p, int iBox)
 
int Tim_ManBoxCopy (Tim_Man_t *p, int iBox)
 
void Tim_ManBoxSetCopy (Tim_Man_t *p, int iBox, int iCopy)
 
int Tim_ManBoxFindFromCiNum (Tim_Man_t *p, int iCiNum)
 
Vec_Str_tTim_ManSave (Tim_Man_t *p, int fHieOnly)
 FUNCTION DEFINITIONS ///. More...
 
Tim_Man_tTim_ManLoad (Vec_Str_t *p, int fHieOnly)
 
Tim_Man_tTim_ManStart (int nCis, int nCos)
 DECLARATIONS ///. More...
 
Tim_Man_tTim_ManDup (Tim_Man_t *p, int fUnitDelay)
 
Tim_Man_tTim_ManTrim (Tim_Man_t *p, Vec_Int_t *vBoxPres)
 
Tim_Man_tTim_ManReduce (Tim_Man_t *p, Vec_Int_t *vBoxesLeft, int nTermsDiff)
 
Vec_Int_tTim_ManAlignTwo (Tim_Man_t *pSpec, Tim_Man_t *pImpl)
 
void Tim_ManCreate (Tim_Man_t *p, void *pLib, Vec_Flt_t *vInArrs, Vec_Flt_t *vOutReqs)
 
float * Tim_ManGetArrTimes (Tim_Man_t *p)
 
float * Tim_ManGetReqTimes (Tim_Man_t *p)
 
void Tim_ManStop (Tim_Man_t *p)
 
void Tim_ManStopP (Tim_Man_t **p)
 
void Tim_ManPrint (Tim_Man_t *p)
 
void Tim_ManPrintStats (Tim_Man_t *p, int nAnd2Delay)
 
int Tim_ManCiNum (Tim_Man_t *p)
 
int Tim_ManCoNum (Tim_Man_t *p)
 
int Tim_ManPiNum (Tim_Man_t *p)
 
int Tim_ManPoNum (Tim_Man_t *p)
 
int Tim_ManBoxNum (Tim_Man_t *p)
 
int Tim_ManBlackBoxNum (Tim_Man_t *p)
 
int Tim_ManDelayTableNum (Tim_Man_t *p)
 
void Tim_ManSetDelayTables (Tim_Man_t *p, Vec_Ptr_t *vDelayTables)
 
void Tim_ManTravIdDisable (Tim_Man_t *p)
 
void Tim_ManTravIdEnable (Tim_Man_t *p)
 
void Tim_ManInitPiArrival (Tim_Man_t *p, int iPi, float Delay)
 DECLARATIONS ///. More...
 
void Tim_ManInitPoRequired (Tim_Man_t *p, int iPo, float Delay)
 
void Tim_ManInitPiArrivalAll (Tim_Man_t *p, float Delay)
 
void Tim_ManInitPoRequiredAll (Tim_Man_t *p, float Delay)
 
void Tim_ManSetCoArrival (Tim_Man_t *p, int iCo, float Delay)
 
void Tim_ManSetCiRequired (Tim_Man_t *p, int iCi, float Delay)
 
void Tim_ManSetCoRequired (Tim_Man_t *p, int iCo, float Delay)
 
float Tim_ManGetCiArrival (Tim_Man_t *p, int iCi)
 
float Tim_ManGetCoRequired (Tim_Man_t *p, int iCo)
 
void Tim_ManIncrementTravId (Tim_Man_t *p)
 DECLARATIONS ///. More...
 
void Tim_ManSetCurrentTravIdBoxInputs (Tim_Man_t *p, int iBox)
 
void Tim_ManSetCurrentTravIdBoxOutputs (Tim_Man_t *p, int iBox)
 
void Tim_ManSetPreviousTravIdBoxInputs (Tim_Man_t *p, int iBox)
 
void Tim_ManSetPreviousTravIdBoxOutputs (Tim_Man_t *p, int iBox)
 
int Tim_ManIsCiTravIdCurrent (Tim_Man_t *p, int iCi)
 
int Tim_ManIsCoTravIdCurrent (Tim_Man_t *p, int iCo)
 

Macro Definition Documentation

#define TIM_ETERNITY   1000000000

MACRO DEFINITIONS ///.

Definition at line 98 of file tim.h.

Typedef Documentation

typedef typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t

INCLUDES ///.

CFile****************************************************************

FileName [tim.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Hierarchy/timing manager.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - April 28, 2007.]

Revision [

Id:
tim.h,v 1.00 2007/04/28 00:00:00 alanmi Exp

]PARAMETERS ///BASIC TYPES ///

Definition at line 92 of file tim.h.

Function Documentation

Vec_Int_t* Tim_ManAlignTwo ( Tim_Man_t pSpec,
Tim_Man_t pImpl 
)

Function*************************************************************

Synopsis [Aligns two sets of boxes using the copy field.]

Description []

SideEffects []

SeeAlso []

Definition at line 344 of file timMan.c.

345 {
346  Vec_Int_t * vBoxPres;
347  Tim_Box_t * pBox;
348  int i;
349  assert( Tim_ManBoxNum(pSpec) > Tim_ManBoxNum(pImpl) );
350  // check if boxes of pImpl can be aligned
351  Tim_ManForEachBox( pImpl, pBox, i )
352  if ( pBox->iCopy < 0 || pBox->iCopy >= Tim_ManBoxNum(pSpec) )
353  return NULL;
354  // map dropped boxes into 1, others into 0
355  vBoxPres = Vec_IntStart( Tim_ManBoxNum(pSpec) );
356  Tim_ManForEachBox( pImpl, pBox, i )
357  {
358  assert( !Vec_IntEntry(vBoxPres, pBox->iCopy) );
359  Vec_IntWriteEntry( vBoxPres, pBox->iCopy, 1 );
360  }
361  return vBoxPres;
362 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
#define Tim_ManForEachBox(p, pBox, i)
Definition: timInt.h:117
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
int Tim_ManBoxNum(Tim_Man_t *p)
Definition: timMan.c:702
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Box_t_ Tim_Box_t
INCLUDES ///.
Definition: timInt.h:48
int Tim_ManBlackBoxNum ( Tim_Man_t p)

Definition at line 706 of file timMan.c.

707 {
708  Tim_Box_t * pBox;
709  int i, Counter = 0;
710  if ( Tim_ManBoxNum(p) )
711  Tim_ManForEachBox( p, pBox, i )
712  Counter += pBox->fBlack;
713  return Counter;
714 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Tim_ManForEachBox(p, pBox, i)
Definition: timInt.h:117
int Tim_ManBoxNum(Tim_Man_t *p)
Definition: timMan.c:702
static int Counter
typedefABC_NAMESPACE_HEADER_START struct Tim_Box_t_ Tim_Box_t
INCLUDES ///.
Definition: timInt.h:48
int Tim_ManBoxCopy ( Tim_Man_t p,
int  iBox 
)

Function*************************************************************

Synopsis [Returns the copy of the box.]

Description []

SideEffects []

SeeAlso []

Definition at line 274 of file timBox.c.

275 {
276  return Tim_ManBox(p, iBox)->iCopy;
277 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
float* Tim_ManBoxDelayTable ( Tim_Man_t p,
int  iBox 
)

Function*************************************************************

Synopsis [Return the delay table.]

Description []

SideEffects []

SeeAlso []

Definition at line 234 of file timBox.c.

235 {
236  float * pTable;
237  Tim_Box_t * pBox = Tim_ManBox(p, iBox);
238  if ( pBox->iDelayTable < 0 )
239  return NULL;
240  pTable = (float *)Vec_PtrEntry( p->vDelayTables, pBox->iDelayTable );
241  assert( (int)pTable[1] == pBox->nInputs );
242  assert( (int)pTable[2] == pBox->nOutputs );
243  return pTable;
244 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Box_t_ Tim_Box_t
INCLUDES ///.
Definition: timInt.h:48
int Tim_ManBoxDelayTableId ( Tim_Man_t p,
int  iBox 
)

Function*************************************************************

Synopsis [Return the delay table id.]

Description []

SideEffects []

SeeAlso []

Definition at line 218 of file timBox.c.

219 {
220  return Tim_ManBox(p, iBox)->iDelayTable;
221 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
int Tim_ManBoxFindFromCiNum ( Tim_Man_t p,
int  iCiNum 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 306 of file timBox.c.

307 {
308  Tim_Box_t * pBox;
309  int i;
310  assert( iCiNum >= 0 && iCiNum < Tim_ManCiNum(p) );
311  if ( iCiNum < Tim_ManPiNum(p) )
312  return -1;
313  Tim_ManForEachBox( p, pBox, i )
314  if ( iCiNum < Tim_ManBoxOutputFirst(p, i) )
315  return i - 1;
316  return -2;
317 }
int Tim_ManBoxOutputFirst(Tim_Man_t *p, int iBox)
Definition: timBox.c:154
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Tim_ManForEachBox(p, pBox, i)
Definition: timInt.h:117
int Tim_ManPiNum(Tim_Man_t *p)
Definition: timMan.c:688
int Tim_ManCiNum(Tim_Man_t *p)
Definition: timMan.c:680
if(last==0)
Definition: sparse_int.h:34
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Box_t_ Tim_Box_t
INCLUDES ///.
Definition: timInt.h:48
int Tim_ManBoxForCi ( Tim_Man_t p,
int  iCi 
)

Function*************************************************************

Synopsis [Returns the box number for the given input.]

Description []

SideEffects []

SeeAlso []

Definition at line 86 of file timBox.c.

87 {
88  if ( iCi >= p->nCis )
89  return -1;
90  return p->pCis[iCi].iObj2Box;
91 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Tim_ManBoxForCo ( Tim_Man_t p,
int  iCo 
)

Function*************************************************************

Synopsis [Returns the box number for the given output.]

Description []

SideEffects []

SeeAlso []

Definition at line 104 of file timBox.c.

105 {
106  if ( iCo >= p->nCos )
107  return -1;
108  return p->pCos[iCo].iObj2Box;
109 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Tim_ManBoxInputFirst ( Tim_Man_t p,
int  iBox 
)

Function*************************************************************

Synopsis [Returns the first input of the box.]

Description []

SideEffects []

SeeAlso []

Definition at line 122 of file timBox.c.

123 {
124  return Tim_ManBox(p, iBox)->Inouts[0];
125 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
int Tim_ManBoxInputLast ( Tim_Man_t p,
int  iBox 
)

Function*************************************************************

Synopsis [Returns the last input of the box.]

Description []

SideEffects []

SeeAlso []

Definition at line 138 of file timBox.c.

139 {
140  return Tim_ManBox(p, iBox)->Inouts[0] + Tim_ManBoxInputNum(p, iBox) - 1;
141 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Tim_ManBoxInputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:186
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
int Tim_ManBoxInputNum ( Tim_Man_t p,
int  iBox 
)

Function*************************************************************

Synopsis [Returns the number of box inputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 186 of file timBox.c.

187 {
188  return Tim_ManBox(p, iBox)->nInputs;
189 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
int Tim_ManBoxIsBlack ( Tim_Man_t p,
int  iBox 
)

Function*************************************************************

Synopsis [Return 1 if the box is black.]

Description []

SideEffects []

SeeAlso []

Definition at line 257 of file timBox.c.

258 {
259  return Tim_ManBox(p, iBox)->fBlack;
260 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
int Tim_ManBoxNum ( Tim_Man_t p)

Definition at line 702 of file timMan.c.

703 {
704  return p->vBoxes ? Vec_PtrSize(p->vBoxes) : 0;
705 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int Tim_ManBoxOutputFirst ( Tim_Man_t p,
int  iBox 
)

Function*************************************************************

Synopsis [Returns the first output of the box.]

Description []

SideEffects []

SeeAlso []

Definition at line 154 of file timBox.c.

155 {
156  return Tim_ManBox(p, iBox)->Inouts[Tim_ManBox(p, iBox)->nInputs];
157 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
int Tim_ManBoxOutputLast ( Tim_Man_t p,
int  iBox 
)

Function*************************************************************

Synopsis [Returns the last output of the box.]

Description []

SideEffects []

SeeAlso []

Definition at line 170 of file timBox.c.

171 {
172  return Tim_ManBox(p, iBox)->Inouts[Tim_ManBox(p, iBox)->nInputs] + Tim_ManBoxOutputNum(p, iBox) - 1;
173 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
int Tim_ManBoxOutputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:202
int Tim_ManBoxOutputNum ( Tim_Man_t p,
int  iBox 
)

Function*************************************************************

Synopsis [Returns the number of box outputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 202 of file timBox.c.

203 {
204  return Tim_ManBox(p, iBox)->nOutputs;
205 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
void Tim_ManBoxSetCopy ( Tim_Man_t p,
int  iBox,
int  iCopy 
)

Function*************************************************************

Synopsis [Sets the copy of the box.]

Description []

SideEffects []

SeeAlso []

Definition at line 290 of file timBox.c.

291 {
292  Tim_ManBox(p, iBox)->iCopy = iCopy;
293 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
int Tim_ManCiNum ( Tim_Man_t p)

Function*************************************************************

Synopsis [Read parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 680 of file timMan.c.

681 {
682  return p->nCis;
683 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Tim_ManCoNum ( Tim_Man_t p)

Definition at line 684 of file timMan.c.

685 {
686  return p->nCos;
687 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Tim_ManCreate ( Tim_Man_t p,
void *  pLib,
Vec_Flt_t vInArrs,
Vec_Flt_t vOutReqs 
)

Function*************************************************************

Synopsis [Creates manager using hierarchy / box library / delay info.]

Description []

SideEffects []

SeeAlso []

Definition at line 403 of file timMan.c.

404 {
405  If_LibBox_t * pLibBox = (If_LibBox_t *)pLib;
406  If_Box_t * pIfBox;
407  Tim_Box_t * pBox;
408  Tim_Obj_t * pObj;
409  float * pTable;
410  int i, k;
411  assert( p->vDelayTables == NULL );
412  p->vDelayTables = pLibBox ? Vec_PtrStart( Vec_PtrSize(pLibBox->vBoxes) ) : Vec_PtrAlloc( 100 );
413  if ( p->vBoxes )
414  Tim_ManForEachBox( p, pBox, i )
415  {
416  if ( pBox->iDelayTable == -1 || pLibBox == NULL )
417  {
418  // create table with constants
419  pTable = ABC_ALLOC( float, 3 + pBox->nInputs * pBox->nOutputs );
420  pTable[0] = pBox->iDelayTable;
421  pTable[1] = pBox->nInputs;
422  pTable[2] = pBox->nOutputs;
423  for ( k = 0; k < pBox->nInputs * pBox->nOutputs; k++ )
424  pTable[3 + k] = 1.0;
425  // save table
426  pBox->iDelayTable = Vec_PtrSize(p->vDelayTables);
427  Vec_PtrPush( p->vDelayTables, pTable );
428  continue;
429  }
430  assert( pBox->iDelayTable >= 0 && pBox->iDelayTable < Vec_PtrSize(pLibBox->vBoxes) );
431  pIfBox = (If_Box_t *)Vec_PtrEntry( pLibBox->vBoxes, pBox->iDelayTable );
432  assert( pIfBox != NULL );
433  assert( pIfBox->nPis == pBox->nInputs );
434  assert( pIfBox->nPos == pBox->nOutputs );
435  pBox->fBlack = pIfBox->fBlack;
436  if ( Vec_PtrEntry( p->vDelayTables, pBox->iDelayTable ) != NULL )
437  continue;
438  // create table of boxes
439  pTable = ABC_ALLOC( float, 3 + pBox->nInputs * pBox->nOutputs );
440  pTable[0] = pBox->iDelayTable;
441  pTable[1] = pBox->nInputs;
442  pTable[2] = pBox->nOutputs;
443  for ( k = 0; k < pBox->nInputs * pBox->nOutputs; k++ )
444  pTable[3 + k] = pIfBox->pDelays[k];
445  // save table
446  Vec_PtrWriteEntry( p->vDelayTables, pBox->iDelayTable, pTable );
447  }
448  // create arrival times
449  if ( vInArrs )
450  {
451  assert( Vec_FltSize(vInArrs) == Tim_ManPiNum(p) );
452  Tim_ManForEachPi( p, pObj, i )
453  pObj->timeArr = Vec_FltEntry(vInArrs, i);
454 
455  }
456  // create required times
457  if ( vOutReqs )
458  {
459  k = 0;
460  assert( Vec_FltSize(vOutReqs) == Tim_ManPoNum(p) );
461  Tim_ManForEachPo( p, pObj, i )
462  pObj->timeReq = Vec_FltEntry(vOutReqs, k++);
463  assert( k == Tim_ManPoNum(p) );
464  }
465 }
char fBlack
Definition: if.h:341
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
int * pDelays
Definition: if.h:347
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Tim_ManForEachBox(p, pBox, i)
Definition: timInt.h:117
int Tim_ManPiNum(Tim_Man_t *p)
Definition: timMan.c:688
#define Tim_ManForEachPo(p, pObj, i)
Definition: timInt.h:114
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int Tim_ManPoNum(Tim_Man_t *p)
Definition: timMan.c:694
if(last==0)
Definition: sparse_int.h:34
int nPis
Definition: if.h:345
Vec_Ptr_t * vBoxes
Definition: if.h:352
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
Definition: if.h:337
#define Tim_ManForEachPi(p, pObj, i)
Definition: timInt.h:112
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
static float Vec_FltEntry(Vec_Flt_t *p, int i)
Definition: vecFlt.h:342
static int Vec_FltSize(Vec_Flt_t *p)
Definition: vecFlt.h:294
typedefABC_NAMESPACE_HEADER_START struct Tim_Box_t_ Tim_Box_t
INCLUDES ///.
Definition: timInt.h:48
int nPos
Definition: if.h:346
void Tim_ManCreateBox ( Tim_Man_t p,
int  firstIn,
int  nIns,
int  firstOut,
int  nOuts,
int  iDelayTable 
)

ITERATORS ///.

SEQUENTIAL ITERATORS ///FUNCTION DECLARATIONS ///

ITERATORS ///.

CFile****************************************************************

FileName [timBox.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Hierarchy/timing manager.]

Synopsis [Manipulation of timing boxes.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - April 28, 2007.]

Revision [

Id:
timBox.c,v 1.00 2007/04/28 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Creates the new timing box.]

Description []

SideEffects []

SeeAlso []

Definition at line 44 of file timBox.c.

45 {
46  Tim_Box_t * pBox;
47  int i;
48  if ( p->vBoxes == NULL )
49  p->vBoxes = Vec_PtrAlloc( 100 );
50  pBox = (Tim_Box_t *)Mem_FlexEntryFetch( p->pMemObj, sizeof(Tim_Box_t) + sizeof(int) * (nIns+nOuts) );
51  memset( pBox, 0, sizeof(Tim_Box_t) );
52  pBox->iBox = Vec_PtrSize( p->vBoxes );
53  Vec_PtrPush( p->vBoxes, pBox );
54  pBox->iDelayTable = iDelayTable;
55  pBox->nInputs = nIns;
56  pBox->nOutputs = nOuts;
57  for ( i = 0; i < nIns; i++ )
58  {
59  assert( firstIn+i < p->nCos );
60  pBox->Inouts[i] = firstIn+i;
61  p->pCos[firstIn+i].iObj2Box = pBox->iBox;
62  p->pCos[firstIn+i].iObj2Num = i;
63  }
64  for ( i = 0; i < nOuts; i++ )
65  {
66  assert( firstOut+i < p->nCis );
67  pBox->Inouts[nIns+i] = firstOut+i;
68  p->pCis[firstOut+i].iObj2Box = pBox->iBox;
69  p->pCis[firstOut+i].iObj2Num = i;
70  }
71 // if ( pBox->iBox < 20 )
72 // printf( "%4d %4d %4d %4d \n", firstIn, nIns, firstOut, nOuts );
73 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
char * Mem_FlexEntryFetch(Mem_Flex_t *p, int nBytes)
Definition: mem.c:372
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Box_t_ Tim_Box_t
INCLUDES ///.
Definition: timInt.h:48
int Tim_ManDelayTableNum ( Tim_Man_t p)

Definition at line 715 of file timMan.c.

716 {
717  return p->vDelayTables ? Vec_PtrSize(p->vDelayTables) : 0;
718 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Tim_Man_t* Tim_ManDup ( Tim_Man_t p,
int  fUnitDelay 
)

Function*************************************************************

Synopsis [Duplicates the timing manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 86 of file timMan.c.

87 {
88  Tim_Man_t * pNew;
89  Tim_Box_t * pBox;
90  Tim_Obj_t * pObj;
91  float * pDelayTable, * pDelayTableNew;
92  int i, k, nInputs, nOutputs;
93  // clear traversal IDs
94  Tim_ManForEachCi( p, pObj, i )
95  pObj->TravId = 0;
96  Tim_ManForEachCo( p, pObj, i )
97  pObj->TravId = 0;
98  // create new manager
99  pNew = Tim_ManStart( p->nCis, p->nCos );
100  // copy box connectivity information
101  memcpy( pNew->pCis, p->pCis, sizeof(Tim_Obj_t) * p->nCis );
102  memcpy( pNew->pCos, p->pCos, sizeof(Tim_Obj_t) * p->nCos );
103  if ( fUnitDelay )
104  {
105  // discretize PI arrival times
106 // Tim_ManForEachPi( pNew, pObj, k )
107 // pObj->timeArr = (int)pObj->timeArr;
108  // discretize PO required times
109 // Tim_ManForEachPo( pNew, pObj, k )
110 // pObj->timeReq = 1 + (int)pObj->timeReq;
111  // clear PI arrival and PO required
112  Tim_ManInitPiArrivalAll( p, 0.0 );
114  }
115  // duplicate delay tables
116  if ( Tim_ManDelayTableNum(p) > 0 )
117  {
118  pNew->vDelayTables = Vec_PtrStart( Vec_PtrSize(p->vDelayTables) );
119  Tim_ManForEachTable( p, pDelayTable, i )
120  {
121  if ( pDelayTable == NULL )
122  continue;
123  assert( i == (int)pDelayTable[0] );
124  nInputs = (int)pDelayTable[1];
125  nOutputs = (int)pDelayTable[2];
126  pDelayTableNew = ABC_ALLOC( float, 3 + nInputs * nOutputs );
127  pDelayTableNew[0] = (int)pDelayTable[0];
128  pDelayTableNew[1] = (int)pDelayTable[1];
129  pDelayTableNew[2] = (int)pDelayTable[2];
130  for ( k = 0; k < nInputs * nOutputs; k++ )
131  if ( pDelayTable[3+k] == -ABC_INFINITY )
132  pDelayTableNew[3+k] = -ABC_INFINITY;
133  else
134  pDelayTableNew[3+k] = fUnitDelay ? (float)fUnitDelay : pDelayTable[3+k];
135 // assert( (int)pDelayTableNew[0] == Vec_PtrSize(pNew->vDelayTables) );
136  assert( Vec_PtrEntry(pNew->vDelayTables, i) == NULL );
137  Vec_PtrWriteEntry( pNew->vDelayTables, i, pDelayTableNew );
138 //printf( "Finished duplicating delay table %d.\n", i );
139  }
140  }
141  // duplicate boxes
142  if ( Tim_ManBoxNum(p) > 0 )
143  {
144  pNew->vBoxes = Vec_PtrAlloc( Tim_ManBoxNum(p) );
145  Tim_ManForEachBox( p, pBox, i )
146  Tim_ManCreateBox( pNew, pBox->Inouts[0], pBox->nInputs,
147  pBox->Inouts[pBox->nInputs], pBox->nOutputs, pBox->iDelayTable );
148  }
149  return pNew;
150 }
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
#define Tim_ManForEachTable(p, pTable, i)
Definition: timInt.h:125
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Tim_ManForEachBox(p, pBox, i)
Definition: timInt.h:117
char * memcpy()
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int Tim_ManDelayTableNum(Tim_Man_t *p)
Definition: timMan.c:715
void Tim_ManCreateBox(Tim_Man_t *p, int firstIn, int nIns, int firstOut, int nOuts, int iDelayTable)
ITERATORS ///.
Definition: timBox.c:44
int Tim_ManBoxNum(Tim_Man_t *p)
Definition: timMan.c:702
ABC_NAMESPACE_IMPL_START Tim_Man_t * Tim_ManStart(int nCis, int nCos)
DECLARATIONS ///.
Definition: timMan.c:45
#define Tim_ManForEachCo(p, pObj, i)
Definition: timInt.h:109
if(last==0)
Definition: sparse_int.h:34
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
void Tim_ManInitPiArrivalAll(Tim_Man_t *p, float Delay)
Definition: timTime.c:78
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define TIM_ETERNITY
MACRO DEFINITIONS ///.
Definition: tim.h:98
#define Tim_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: timInt.h:107
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
typedefABC_NAMESPACE_HEADER_START struct Tim_Box_t_ Tim_Box_t
INCLUDES ///.
Definition: timInt.h:48
void Tim_ManInitPoRequiredAll(Tim_Man_t *p, float Delay)
Definition: timTime.c:97
float* Tim_ManGetArrTimes ( Tim_Man_t p)

Function*************************************************************

Synopsis [Get arrival and required times if they are non-trivial.]

Description []

SideEffects []

SeeAlso []

Definition at line 479 of file timMan.c.

480 {
481  float * pTimes;
482  Tim_Obj_t * pObj;
483  int i;
484  Tim_ManForEachPi( p, pObj, i )
485  if ( pObj->timeArr != 0.0 )
486  break;
487  if ( i == Tim_ManPiNum(p) )
488  return NULL;
489  pTimes = ABC_FALLOC( float, Tim_ManCiNum(p) );
490  Tim_ManForEachPi( p, pObj, i )
491  pTimes[i] = pObj->timeArr;
492  return pTimes;
493 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Tim_ManPiNum(Tim_Man_t *p)
Definition: timMan.c:688
if(last==0)
Definition: sparse_int.h:34
#define Tim_ManForEachPi(p, pObj, i)
Definition: timInt.h:112
int Tim_ManCiNum(Tim_Man_t *p)
Definition: timMan.c:680
#define ABC_FALLOC(type, num)
Definition: abc_global.h:231
float Tim_ManGetCiArrival ( Tim_Man_t p,
int  iCi 
)

Function*************************************************************

Synopsis [Returns CO arrival time.]

Description []

SideEffects []

SeeAlso []

Definition at line 174 of file timTime.c.

175 {
176  Tim_Box_t * pBox;
177  Tim_Obj_t * pObjThis, * pObj, * pObjRes;
178  float * pTable, * pDelays, DelayBest;
179  int i, k;
180  // consider the already processed PI
181  pObjThis = Tim_ManCi( p, iCi );
182  if ( p->fUseTravId && pObjThis->TravId == p->nTravIds )
183  return pObjThis->timeArr;
184  pObjThis->TravId = p->nTravIds;
185  // consider the main PI
186  pBox = Tim_ManCiBox( p, iCi );
187  if ( pBox == NULL )
188  return pObjThis->timeArr;
189  // update box timing
190  pBox->TravId = p->nTravIds;
191  // get the arrival times of the inputs of the box (POs)
192  if ( p->fUseTravId )
193  Tim_ManBoxForEachInput( p, pBox, pObj, i )
194  if ( pObj->TravId != p->nTravIds )
195  printf( "Tim_ManGetCiArrival(): Input arrival times of the box are not up to date!\n" );
196  // compute the arrival times for each output of the box (PIs)
197  pTable = Tim_ManBoxDelayTable( p, pBox->iBox );
198  Tim_ManBoxForEachOutput( p, pBox, pObjRes, i )
199  {
200  pDelays = pTable + 3 + i * pBox->nInputs;
201  DelayBest = -TIM_ETERNITY;
202  Tim_ManBoxForEachInput( p, pBox, pObj, k )
203  if ( pDelays[k] != -ABC_INFINITY )
204  DelayBest = Abc_MaxInt( DelayBest, pObj->timeArr + pDelays[k] );
205  pObjRes->timeArr = DelayBest;
206  pObjRes->TravId = p->nTravIds;
207  }
208  return pObjThis->timeArr;
209 }
float timeArr
Definition: timInt.h:85
#define Tim_ManBoxForEachOutput(p, pBox, pObj, i)
Definition: timInt.h:122
static Llb_Mgr_t * p
Definition: llb3Image.c:950
float Tim_ManGetCiArrival(Tim_Man_t *p, int iCi)
Definition: timTime.c:174
static Tim_Box_t * Tim_ManCiBox(Tim_Man_t *p, int i)
Definition: timInt.h:97
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
#define Tim_ManBoxForEachInput(p, pBox, pObj, i)
Definition: timInt.h:120
if(last==0)
Definition: sparse_int.h:34
static Tim_Obj_t * Tim_ManCi(Tim_Man_t *p, int i)
MACRO DEFINITIONS ///.
Definition: timInt.h:93
int TravId
Definition: timInt.h:82
#define TIM_ETERNITY
MACRO DEFINITIONS ///.
Definition: tim.h:98
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
typedefABC_NAMESPACE_HEADER_START struct Tim_Box_t_ Tim_Box_t
INCLUDES ///.
Definition: timInt.h:48
float * Tim_ManBoxDelayTable(Tim_Man_t *p, int iBox)
Definition: timBox.c:234
float Tim_ManGetCoRequired ( Tim_Man_t p,
int  iCo 
)

Function*************************************************************

Synopsis [Returns CO required time.]

Description []

SideEffects []

SeeAlso []

Definition at line 222 of file timTime.c.

223 {
224  Tim_Box_t * pBox;
225  Tim_Obj_t * pObjThis, * pObj, * pObjRes;
226  float * pTable, * pDelays, DelayBest;
227  int i, k;
228  // consider the already processed PO
229  pObjThis = Tim_ManCo( p, iCo );
230  if ( p->fUseTravId && pObjThis->TravId == p->nTravIds )
231  return pObjThis->timeReq;
232  pObjThis->TravId = p->nTravIds;
233  // consider the main PO
234  pBox = Tim_ManCoBox( p, iCo );
235  if ( pBox == NULL )
236  return pObjThis->timeReq;
237  // update box timing
238  pBox->TravId = p->nTravIds;
239  // get the required times of the outputs of the box (PIs)
240  if ( p->fUseTravId )
241  Tim_ManBoxForEachOutput( p, pBox, pObj, i )
242  if ( pObj->TravId != p->nTravIds )
243  printf( "Tim_ManGetCoRequired(): Output required times of output %d the box %d are not up to date!\n", i, pBox->iBox );
244  // compute the required times for each input of the box (POs)
245  pTable = Tim_ManBoxDelayTable( p, pBox->iBox );
246  Tim_ManBoxForEachInput( p, pBox, pObjRes, i )
247  {
248  DelayBest = TIM_ETERNITY;
249  Tim_ManBoxForEachOutput( p, pBox, pObj, k )
250  {
251  pDelays = pTable + 3 + k * pBox->nInputs;
252  if ( pDelays[k] != -ABC_INFINITY )
253  DelayBest = Abc_MinFloat( DelayBest, pObj->timeReq - pDelays[i] );
254  }
255  pObjRes->timeReq = DelayBest;
256  pObjRes->TravId = p->nTravIds;
257  }
258  return pObjThis->timeReq;
259 }
static float Abc_MinFloat(float a, float b)
Definition: abc_global.h:244
#define Tim_ManBoxForEachOutput(p, pBox, pObj, i)
Definition: timInt.h:122
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Tim_Box_t * Tim_ManCoBox(Tim_Man_t *p, int i)
Definition: timInt.h:98
float timeReq
Definition: timInt.h:86
#define Tim_ManBoxForEachInput(p, pBox, pObj, i)
Definition: timInt.h:120
if(last==0)
Definition: sparse_int.h:34
int TravId
Definition: timInt.h:82
float Tim_ManGetCoRequired(Tim_Man_t *p, int iCo)
Definition: timTime.c:222
#define TIM_ETERNITY
MACRO DEFINITIONS ///.
Definition: tim.h:98
static Tim_Obj_t * Tim_ManCo(Tim_Man_t *p, int i)
Definition: timInt.h:94
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
typedefABC_NAMESPACE_HEADER_START struct Tim_Box_t_ Tim_Box_t
INCLUDES ///.
Definition: timInt.h:48
float * Tim_ManBoxDelayTable(Tim_Man_t *p, int iBox)
Definition: timBox.c:234
float* Tim_ManGetReqTimes ( Tim_Man_t p)

Definition at line 494 of file timMan.c.

495 {
496  float * pTimes;
497  Tim_Obj_t * pObj;
498  int i, k = 0;
499  Tim_ManForEachPo( p, pObj, i )
500  if ( pObj->timeReq != TIM_ETERNITY )
501  break;
502  if ( i == Tim_ManPoNum(p) )
503  return NULL;
504  pTimes = ABC_FALLOC( float, Tim_ManCoNum(p) );
505  Tim_ManForEachPo( p, pObj, i )
506  pTimes[k++] = pObj->timeArr;
507  assert( k == Tim_ManPoNum(p) );
508  return pTimes;
509 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Tim_ManForEachPo(p, pObj, i)
Definition: timInt.h:114
int Tim_ManPoNum(Tim_Man_t *p)
Definition: timMan.c:694
if(last==0)
Definition: sparse_int.h:34
#define TIM_ETERNITY
MACRO DEFINITIONS ///.
Definition: tim.h:98
int Tim_ManCoNum(Tim_Man_t *p)
Definition: timMan.c:684
#define assert(ex)
Definition: util_old.h:213
#define ABC_FALLOC(type, num)
Definition: abc_global.h:231
void Tim_ManIncrementTravId ( Tim_Man_t p)

DECLARATIONS ///.

CFile****************************************************************

FileName [timTrav.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Hierarchy/timing manager.]

Synopsis [Manipulation of traversal IDs.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - April 28, 2007.]

Revision [

Id:
timTrav.c,v 1.00 2007/04/28 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Increments the trav ID of the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 44 of file timTrav.c.

45 {
46  int i;
47  if ( p->nTravIds >= (1<<30)-1 )
48  {
49  p->nTravIds = 0;
50  for ( i = 0; i < p->nCis; i++ )
51  p->pCis[i].TravId = 0;
52  for ( i = 0; i < p->nCos; i++ )
53  p->pCos[i].TravId = 0;
54  }
55  assert( p->nTravIds < (1<<30)-1 );
56  p->nTravIds++;
57 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
for(p=first;p->value< newval;p=p->next)
#define assert(ex)
Definition: util_old.h:213
void Tim_ManInitPiArrival ( Tim_Man_t p,
int  iPi,
float  Delay 
)

DECLARATIONS ///.

CFile****************************************************************

FileName [timTime.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Hierarchy/timing manager.]

Synopsis [Setting and resetting timing information of the boxes.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - April 28, 2007.]

Revision [

Id:
timTime.c,v 1.00 2007/04/28 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Initializes arrival time of the PI.]

Description []

SideEffects []

SeeAlso []

Definition at line 44 of file timTime.c.

45 {
46  assert( iPi < p->nCis );
47  p->pCis[iPi].timeArr = Delay;
48 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
void Tim_ManInitPiArrivalAll ( Tim_Man_t p,
float  Delay 
)

Function*************************************************************

Synopsis [Sets arrival times of all PIs.]

Description []

SideEffects []

SeeAlso []

Definition at line 78 of file timTime.c.

79 {
80  Tim_Obj_t * pObj;
81  int i;
82  Tim_ManForEachPi( p, pObj, i )
83  Tim_ManInitPiArrival( p, i, Delay );
84 }
ABC_NAMESPACE_IMPL_START void Tim_ManInitPiArrival(Tim_Man_t *p, int iPi, float Delay)
DECLARATIONS ///.
Definition: timTime.c:44
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Tim_ManForEachPi(p, pObj, i)
Definition: timInt.h:112
void Tim_ManInitPoRequired ( Tim_Man_t p,
int  iPo,
float  Delay 
)

Function*************************************************************

Synopsis [Initializes required time of the PO.]

Description []

SideEffects []

SeeAlso []

Definition at line 61 of file timTime.c.

62 {
63  assert( iPo < p->nCos );
64  p->pCos[iPo].timeReq = Delay;
65 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
void Tim_ManInitPoRequiredAll ( Tim_Man_t p,
float  Delay 
)

Function*************************************************************

Synopsis [Sets required times of all POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 97 of file timTime.c.

98 {
99  Tim_Obj_t * pObj;
100  int i;
101  Tim_ManForEachPo( p, pObj, i )
102  Tim_ManSetCoRequired( p, i, Delay );
103 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Tim_ManForEachPo(p, pObj, i)
Definition: timInt.h:114
void Tim_ManSetCoRequired(Tim_Man_t *p, int iCo, float Delay)
Definition: timTime.c:154
int Tim_ManIsCiTravIdCurrent ( Tim_Man_t p,
int  iCi 
)

Function*************************************************************

Synopsis [Updates required time of the CI.]

Description []

SideEffects []

SeeAlso []

Definition at line 154 of file timTrav.c.

155 {
156  assert( iCi < p->nCis );
157  assert( p->fUseTravId );
158  return p->pCis[iCi].TravId == p->nTravIds;
159 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
int Tim_ManIsCoTravIdCurrent ( Tim_Man_t p,
int  iCo 
)

Function*************************************************************

Synopsis [Updates required time of the CO.]

Description []

SideEffects []

SeeAlso []

Definition at line 172 of file timTrav.c.

173 {
174  assert( iCo < p->nCos );
175  assert( p->fUseTravId );
176  return p->pCos[iCo].TravId == p->nTravIds;
177 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
Tim_Man_t* Tim_ManLoad ( Vec_Str_t p,
int  fHieOnly 
)

Function*************************************************************

Synopsis [Restores the timing manager from the char stream.]

Description []

SideEffects []

SeeAlso []

Definition at line 112 of file timDump.c.

113 {
114  Tim_Man_t * pMan;
115  Tim_Obj_t * pObj;
116  int VerNum, nCis, nCos, nPis, nPos;
117  int nBoxes, nBoxIns, nBoxOuts, CopyBox;
118  int TableId, nTables, TableSize, TableX, TableY;
119  int i, k, curPi, curPo, iStr = 0;
120  float * pDelayTable;
121  // get version number
122  VerNum = Vec_StrGetI_ne( p, &iStr );
123  assert( VerNum == TIM_DUMP_VER_NUM );
124  // get the number of CIs/COs
125  nCis = Vec_StrGetI_ne( p, &iStr );
126  nCos = Vec_StrGetI_ne( p, &iStr );
127  // get the number of PIs/POs
128  nPis = Vec_StrGetI_ne( p, &iStr );
129  nPos = Vec_StrGetI_ne( p, &iStr );
130  // start the timing manager
131  pMan = Tim_ManStart( nCis, nCos );
132  // start boxes
133  nBoxes = Vec_StrGetI_ne( p, &iStr );
134  assert( pMan->vBoxes == NULL );
135  if ( nBoxes > 0 )
136  pMan->vBoxes = Vec_PtrAlloc( nBoxes );
137  // create boxes
138  curPi = nPis;
139  curPo = 0;
140  for ( i = 0; i < nBoxes; i++ )
141  {
142  nBoxIns = Vec_StrGetI_ne( p, &iStr );
143  nBoxOuts = Vec_StrGetI_ne( p, &iStr );
144  TableId = Vec_StrGetI_ne( p, &iStr );
145  CopyBox = Vec_StrGetI_ne( p, &iStr );
146  Tim_ManCreateBox( pMan, curPo, nBoxIns, curPi, nBoxOuts, TableId );
147  Tim_ManBoxSetCopy( pMan, i, CopyBox );
148  curPi += nBoxOuts;
149  curPo += nBoxIns;
150  }
151  curPo += nPos;
152  assert( curPi == nCis );
153  assert( curPo == nCos );
154  if ( fHieOnly )
155  return pMan;
156  // create delay tables
157  nTables = Vec_StrGetI_ne( p, &iStr );
158  assert( pMan->vDelayTables == NULL );
159  if ( nTables > 0 )
160  pMan->vDelayTables = Vec_PtrAlloc( nTables );
161  // read delay tables
162  for ( i = 0; i < nTables; i++ )
163  {
164  // read table ID and dimensions
165  TableId = Vec_StrGetI_ne( p, &iStr );
166  TableX = Vec_StrGetI_ne( p, &iStr );
167  TableY = Vec_StrGetI_ne( p, &iStr );
168  assert( TableId == i );
169  // create new table
170  TableSize = TableX * TableY;
171  pDelayTable = ABC_ALLOC( float, TableSize + 3 );
172  pDelayTable[0] = TableId;
173  pDelayTable[1] = TableX;
174  pDelayTable[2] = TableY;
175  // read table contents
176  for ( k = 0; k < TableSize; k++ )
177  pDelayTable[k+3] = Vec_StrGetF( p, &iStr );
178  assert( Vec_PtrSize(pMan->vDelayTables) == TableId );
179  Vec_PtrPush( pMan->vDelayTables, pDelayTable );
180  }
181  assert( Tim_ManDelayTableNum(pMan) == nTables );
182  // read PI arrival times
183  Tim_ManForEachPi( pMan, pObj, i )
184  Tim_ManInitPiArrival( pMan, i, Vec_StrGetF(p, &iStr) );
185  // read PO required times
186  Tim_ManForEachPo( pMan, pObj, i )
187  Tim_ManInitPoRequired( pMan, i, Vec_StrGetF(p, &iStr) );
188  assert( Vec_StrSize(p) == iStr );
189 // Tim_ManPrint( pMan );
190  return pMan;
191 }
static int Vec_StrGetI_ne(Vec_Str_t *vOut, int *pPos)
Definition: vecStr.h:821
static float Vec_StrGetF(Vec_Str_t *vOut, int *pPos)
Definition: vecStr.h:870
#define Tim_ManForEachPo(p, pObj, i)
Definition: timInt.h:114
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
void Tim_ManCreateBox(Tim_Man_t *p, int firstIn, int nIns, int firstOut, int nOuts, int iDelayTable)
ITERATORS ///.
Definition: timBox.c:44
void Tim_ManInitPoRequired(Tim_Man_t *p, int iPo, float Delay)
Definition: timTime.c:61
int Tim_ManDelayTableNum(Tim_Man_t *p)
Definition: timMan.c:715
void Tim_ManInitPiArrival(Tim_Man_t *p, int iPi, float Delay)
DECLARATIONS ///.
Definition: timTime.c:44
Tim_Man_t * Tim_ManStart(int nCis, int nCos)
DECLARATIONS ///.
Definition: timMan.c:45
static int Vec_StrSize(Vec_Str_t *p)
Definition: bblif.c:600
#define Tim_ManForEachPi(p, pObj, i)
Definition: timInt.h:112
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
void Tim_ManBoxSetCopy(Tim_Man_t *p, int iBox, int iCopy)
Definition: timBox.c:290
#define TIM_DUMP_VER_NUM
DECLARATIONS ///.
Definition: timDump.c:29
int Tim_ManPiNum ( Tim_Man_t p)

Definition at line 688 of file timMan.c.

689 {
690  if ( Tim_ManBoxNum(p) == 0 )
691  return Tim_ManCiNum(p);
692  return Tim_ManBoxOutputFirst(p, 0);
693 }
int Tim_ManBoxOutputFirst(Tim_Man_t *p, int iBox)
Definition: timBox.c:154
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Tim_ManBoxNum(Tim_Man_t *p)
Definition: timMan.c:702
int Tim_ManCiNum(Tim_Man_t *p)
Definition: timMan.c:680
int Tim_ManPoNum ( Tim_Man_t p)

Definition at line 694 of file timMan.c.

695 {
696  int iLastBoxId;
697  if ( Tim_ManBoxNum(p) == 0 )
698  return Tim_ManCoNum(p);
699  iLastBoxId = Tim_ManBoxNum(p) - 1;
700  return Tim_ManCoNum(p) - (Tim_ManBoxInputFirst(p, iLastBoxId) + Tim_ManBoxInputNum(p, iLastBoxId));
701 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Tim_ManBoxNum(Tim_Man_t *p)
Definition: timMan.c:702
int Tim_ManBoxInputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:186
int Tim_ManCoNum(Tim_Man_t *p)
Definition: timMan.c:684
int Tim_ManBoxInputFirst(Tim_Man_t *p, int iBox)
Definition: timBox.c:122
void Tim_ManPrint ( Tim_Man_t p)

Function*************************************************************

Synopsis [Prints the timing manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 523 of file timMan.c.

524 {
525  Tim_Box_t * pBox;
526  Tim_Obj_t * pObj, * pPrev;
527  float * pTable;
528  int i, j, k, TableX, TableY;
529  if ( p == NULL )
530  return;
531  printf( "TIMING MANAGER:\n" );
532  printf( "PI = %d. CI = %d. PO = %d. CO = %d. Box = %d.\n",
534 
535  // print CI info
536  pPrev = p->pCis;
537  Tim_ManForEachPi( p, pObj, i )
538  if ( pPrev->timeArr != pObj->timeArr || pPrev->timeReq != pObj->timeReq )
539  break;
540  if ( i == Tim_ManCiNum(p) )
541  printf( "All PIs : arrival = %5.3f required = %5.3f\n", pPrev->timeArr, pPrev->timeReq );
542  else
543  Tim_ManForEachPi( p, pObj, i )
544  printf( "PI%5d : arrival = %5.3f required = %5.3f\n", i, pObj->timeArr, pObj->timeReq );
545 
546  // print CO info
547  pPrev = p->pCos;
548  Tim_ManForEachPo( p, pObj, i )
549  if ( pPrev->timeArr != pObj->timeArr || pPrev->timeReq != pObj->timeReq )
550  break;
551  if ( i == Tim_ManCoNum(p) )
552  printf( "All POs : arrival = %5.3f required = %5.3f\n", pPrev->timeArr, pPrev->timeReq );
553  else
554  {
555  int k = 0;
556  Tim_ManForEachPo( p, pObj, i )
557  printf( "PO%5d : arrival = %5.3f required = %5.3f\n", k++, pObj->timeArr, pObj->timeReq );
558  }
559 
560  // print box info
561  if ( Tim_ManBoxNum(p) > 0 )
562  Tim_ManForEachBox( p, pBox, i )
563  {
564  printf( "*** Box %5d : I =%4d. O =%4d. I1 =%6d. O1 =%6d. Table =%4d\n",
565  i, pBox->nInputs, pBox->nOutputs,
567  pBox->iDelayTable );
568 
569  // print box inputs
570  pPrev = Tim_ManBoxInput( p, pBox, 0 );
571  Tim_ManBoxForEachInput( p, pBox, pObj, k )
572  if ( pPrev->timeArr != pObj->timeArr || pPrev->timeReq != pObj->timeReq )
573  break;
574  if ( k == Tim_ManBoxInputNum(p, pBox->iBox) )
575  printf( "Box inputs : arrival = %5.3f required = %5.3f\n", pPrev->timeArr, pPrev->timeReq );
576  else
577  Tim_ManBoxForEachInput( p, pBox, pObj, k )
578  printf( "box-in%4d : arrival = %5.3f required = %5.3f\n", k, pObj->timeArr, pObj->timeReq );
579 
580  // print box outputs
581  pPrev = Tim_ManBoxOutput( p, pBox, 0 );
582  Tim_ManBoxForEachOutput( p, pBox, pObj, k )
583  if ( pPrev->timeArr != pObj->timeArr || pPrev->timeReq != pObj->timeReq )
584  break;
585  if ( k == Tim_ManBoxOutputNum(p, pBox->iBox) )
586  printf( "Box outputs : arrival = %5.3f required = %5.3f\n", pPrev->timeArr, pPrev->timeReq );
587  else
588  Tim_ManBoxForEachOutput( p, pBox, pObj, k )
589  printf( "box-out%3d : arrival = %5.3f required = %5.3f\n", k, pObj->timeArr, pObj->timeReq );
590 
591  if ( i > 2 )
592  break;
593  }
594 
595  // print delay tables
596  if ( Tim_ManDelayTableNum(p) > 0 )
597  Tim_ManForEachTable( p, pTable, i )
598  {
599  if ( pTable == NULL )
600  continue;
601  printf( "Delay table %d:\n", i );
602  assert( i == (int)pTable[0] );
603  TableX = (int)pTable[1];
604  TableY = (int)pTable[2];
605  for ( j = 0; j < TableY; j++, printf( "\n" ) )
606  for ( k = 0; k < TableX; k++ )
607  if ( pTable[3+j*TableX+k] == -ABC_INFINITY )
608  printf( "%5s", "-" );
609  else
610  printf( "%5.0f", pTable[3+j*TableX+k] );
611  }
612  printf( "\n" );
613 }
int Tim_ManBoxOutputFirst(Tim_Man_t *p, int iBox)
Definition: timBox.c:154
#define Tim_ManForEachTable(p, pTable, i)
Definition: timInt.h:125
#define Tim_ManBoxForEachOutput(p, pBox, pObj, i)
Definition: timInt.h:122
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Tim_ManForEachBox(p, pBox, i)
Definition: timInt.h:117
int Tim_ManPiNum(Tim_Man_t *p)
Definition: timMan.c:688
#define Tim_ManForEachPo(p, pObj, i)
Definition: timInt.h:114
int Tim_ManBoxOutputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:202
int Tim_ManDelayTableNum(Tim_Man_t *p)
Definition: timMan.c:715
static Tim_Obj_t * Tim_ManBoxOutput(Tim_Man_t *p, Tim_Box_t *pBox, int i)
Definition: timInt.h:101
int Tim_ManPoNum(Tim_Man_t *p)
Definition: timMan.c:694
int Tim_ManBoxNum(Tim_Man_t *p)
Definition: timMan.c:702
#define Tim_ManBoxForEachInput(p, pBox, pObj, i)
Definition: timInt.h:120
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
int Tim_ManBoxInputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:186
#define Tim_ManForEachPi(p, pObj, i)
Definition: timInt.h:112
int Tim_ManCoNum(Tim_Man_t *p)
Definition: timMan.c:684
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
#define assert(ex)
Definition: util_old.h:213
static Tim_Obj_t * Tim_ManBoxInput(Tim_Man_t *p, Tim_Box_t *pBox, int i)
Definition: timInt.h:100
int Tim_ManBoxInputFirst(Tim_Man_t *p, int iBox)
Definition: timBox.c:122
typedefABC_NAMESPACE_HEADER_START struct Tim_Box_t_ Tim_Box_t
INCLUDES ///.
Definition: timInt.h:48
int Tim_ManCiNum(Tim_Man_t *p)
Definition: timMan.c:680
void Tim_ManPrintStats ( Tim_Man_t p,
int  nAnd2Delay 
)

Function*************************************************************

Synopsis [Prints statistics of the timing manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 626 of file timMan.c.

627 {
628  Tim_Box_t * pBox;
629  Vec_Int_t * vCounts;
630  Vec_Ptr_t * vBoxes;
631  int i, Count, IdMax;
632  if ( p == NULL )
633  return;
634  Abc_Print( 1, "Hierarchy : " );
635  printf( "PI/CI = %d/%d PO/CO = %d/%d Box = %d ",
638  Tim_ManBoxNum(p) );
639  if ( nAnd2Delay )
640  printf( "delay(AND2) = %d", nAnd2Delay );
641  printf( "\n" );
642  if ( Tim_ManBoxNum(p) == 0 )
643  return;
644  IdMax = 0;
645  Tim_ManForEachBox( p, pBox, i )
646  IdMax = Abc_MaxInt( IdMax, pBox->iDelayTable );
647  vCounts = Vec_IntStart( IdMax+1 );
648  vBoxes = Vec_PtrStart( IdMax+1 );
649  Tim_ManForEachBox( p, pBox, i )
650  {
651  Vec_IntAddToEntry( vCounts, pBox->iDelayTable, 1 );
652  Vec_PtrWriteEntry( vBoxes, pBox->iDelayTable, pBox );
653  }
654  // print statistics about boxes
655  Vec_IntForEachEntry( vCounts, Count, i )
656  {
657  if ( Count == 0 ) continue;
658  pBox = (Tim_Box_t *)Vec_PtrEntry( vBoxes, i );
659  printf( " Box %4d ", i );
660  printf( "Num = %4d ", Count );
661  printf( "Ins = %4d ", pBox->nInputs );
662  printf( "Outs = %4d", pBox->nOutputs );
663  printf( "\n" );
664  }
665  Vec_IntFree( vCounts );
666  Vec_PtrFree( vBoxes );
667 }
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
#define Tim_ManForEachBox(p, pBox, i)
Definition: timInt.h:117
int Tim_ManPiNum(Tim_Man_t *p)
Definition: timMan.c:688
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
int Tim_ManPoNum(Tim_Man_t *p)
Definition: timMan.c:694
int Tim_ManBoxNum(Tim_Man_t *p)
Definition: timMan.c:702
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static void Vec_IntAddToEntry(Vec_Int_t *p, int i, int Addition)
Definition: bblif.c:302
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
int Tim_ManCoNum(Tim_Man_t *p)
Definition: timMan.c:684
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
typedefABC_NAMESPACE_HEADER_START struct Tim_Box_t_ Tim_Box_t
INCLUDES ///.
Definition: timInt.h:48
int Tim_ManCiNum(Tim_Man_t *p)
Definition: timMan.c:680
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Tim_Man_t* Tim_ManReduce ( Tim_Man_t p,
Vec_Int_t vBoxesLeft,
int  nTermsDiff 
)

Function*************************************************************

Synopsis [Reduces the timing manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 251 of file timMan.c.

252 {
253  Tim_Man_t * pNew;
254  Tim_Box_t * pBox;
255  Tim_Obj_t * pObj;
256  float * pDelayTable, * pDelayTableNew;
257  int i, k, iBox, nNewCis, nNewCos, nInputs, nOutputs;
258  int nNewPiNum = Tim_ManPiNum(p) - nTermsDiff;
259  int nNewPoNum = Tim_ManPoNum(p) - nTermsDiff;
260  assert( Vec_IntSize(vBoxesLeft) <= Tim_ManBoxNum(p) );
261  // count the number of CIs and COs in the trimmed manager
262  nNewCis = nNewPiNum;
263  nNewCos = nNewPoNum;
264  Vec_IntForEachEntry( vBoxesLeft, iBox, i )
265  {
266  pBox = Tim_ManBox( p, iBox );
267  nNewCis += pBox->nOutputs;
268  nNewCos += pBox->nInputs;
269  }
270  assert( nNewCis <= Tim_ManCiNum(p) - nTermsDiff );
271  assert( nNewCos <= Tim_ManCoNum(p) - nTermsDiff );
272  // clear traversal IDs
273  Tim_ManForEachCi( p, pObj, i )
274  pObj->TravId = 0;
275  Tim_ManForEachCo( p, pObj, i )
276  pObj->TravId = 0;
277  // create new manager
278  pNew = Tim_ManStart( nNewCis, nNewCos );
279  // copy box connectivity information
280  memcpy( pNew->pCis, p->pCis, sizeof(Tim_Obj_t) * nNewPiNum );
281  memcpy( pNew->pCos + nNewCos - nNewPoNum,
282  p->pCos + Tim_ManCoNum(p) - Tim_ManPoNum(p),
283  sizeof(Tim_Obj_t) * nNewPoNum );
284  // duplicate delay tables
285  if ( Tim_ManDelayTableNum(p) > 0 )
286  {
287  int fWarning = 0;
288  pNew->vDelayTables = Vec_PtrStart( Vec_PtrSize(p->vDelayTables) );
289  Tim_ManForEachTable( p, pDelayTable, i )
290  {
291  if ( pDelayTable == NULL )
292  continue;
293  if ( i != (int)pDelayTable[0] && fWarning == 0 )
294  {
295  printf( "Warning: Mismatch in delay-table number between the manager and the box.\n" );
296  fWarning = 1;
297  }
298  //assert( i == (int)pDelayTable[0] );
299  nInputs = (int)pDelayTable[1];
300  nOutputs = (int)pDelayTable[2];
301  pDelayTableNew = ABC_ALLOC( float, 3 + nInputs * nOutputs );
302  pDelayTableNew[0] = i;//(int)pDelayTable[0];
303  pDelayTableNew[1] = (int)pDelayTable[1];
304  pDelayTableNew[2] = (int)pDelayTable[2];
305  for ( k = 0; k < nInputs * nOutputs; k++ )
306  pDelayTableNew[3+k] = pDelayTable[3+k];
307 // assert( (int)pDelayTableNew[0] == Vec_PtrSize(pNew->vDelayTables) );
308  assert( Vec_PtrEntry(pNew->vDelayTables, i) == NULL );
309  Vec_PtrWriteEntry( pNew->vDelayTables, i, pDelayTableNew );
310  }
311  }
312  // duplicate boxes
313  if ( Tim_ManBoxNum(p) > 0 )
314  {
315  int curPi = nNewPiNum;
316  int curPo = 0;
317  pNew->vBoxes = Vec_PtrAlloc( Tim_ManBoxNum(p) );
318  Vec_IntForEachEntry( vBoxesLeft, iBox, i )
319  {
320  pBox = Tim_ManBox( p, iBox );
321  Tim_ManCreateBox( pNew, curPo, pBox->nInputs, curPi, pBox->nOutputs, pBox->iDelayTable );
322  Tim_ManBoxSetCopy( pNew, Tim_ManBoxNum(pNew) - 1, iBox );
323  curPi += pBox->nOutputs;
324  curPo += pBox->nInputs;
325  }
326  curPo += nNewPoNum;
327  assert( curPi == Tim_ManCiNum(pNew) );
328  assert( curPo == Tim_ManCoNum(pNew) );
329  }
330  return pNew;
331 }
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
#define Tim_ManForEachTable(p, pTable, i)
Definition: timInt.h:125
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Tim_ManPiNum(Tim_Man_t *p)
Definition: timMan.c:688
char * memcpy()
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int Tim_ManDelayTableNum(Tim_Man_t *p)
Definition: timMan.c:715
void Tim_ManCreateBox(Tim_Man_t *p, int firstIn, int nIns, int firstOut, int nOuts, int iDelayTable)
ITERATORS ///.
Definition: timBox.c:44
int Tim_ManPoNum(Tim_Man_t *p)
Definition: timMan.c:694
int Tim_ManBoxNum(Tim_Man_t *p)
Definition: timMan.c:702
ABC_NAMESPACE_IMPL_START Tim_Man_t * Tim_ManStart(int nCis, int nCos)
DECLARATIONS ///.
Definition: timMan.c:45
#define Tim_ManForEachCo(p, pObj, i)
Definition: timInt.h:109
if(last==0)
Definition: sparse_int.h:34
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define Tim_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: timInt.h:107
int Tim_ManCoNum(Tim_Man_t *p)
Definition: timMan.c:684
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
typedefABC_NAMESPACE_HEADER_START struct Tim_Box_t_ Tim_Box_t
INCLUDES ///.
Definition: timInt.h:48
void Tim_ManBoxSetCopy(Tim_Man_t *p, int iBox, int iCopy)
Definition: timBox.c:290
int Tim_ManCiNum(Tim_Man_t *p)
Definition: timMan.c:680
Vec_Str_t* Tim_ManSave ( Tim_Man_t p,
int  fHieOnly 
)

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis [Transform the timing manager into the char stream.]

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file timDump.c.

47 {
48  Tim_Box_t * pBox;
49  Tim_Obj_t * pObj;
50  Vec_Str_t * vStr;
51  float * pDelayTable;
52  int i, k, TableSize;
53  // create output stream
54  vStr = Vec_StrAlloc( 10000 );
55  // dump version number
57  // save CI/CO counts
58  Vec_StrPutI_ne( vStr, Tim_ManCiNum(p) );
59  Vec_StrPutI_ne( vStr, Tim_ManCoNum(p) );
60  // save PI/PO counts
61  Vec_StrPutI_ne( vStr, Tim_ManPiNum(p) );
62  Vec_StrPutI_ne( vStr, Tim_ManPoNum(p) );
63  // save number of boxes
64  Vec_StrPutI_ne( vStr, Tim_ManBoxNum(p) );
65  // for each box, save num_inputs, num_outputs, delay table ID, and copy field
66  if ( Tim_ManBoxNum(p) > 0 )
67  Tim_ManForEachBox( p, pBox, i )
68  {
69  Vec_StrPutI_ne( vStr, Tim_ManBoxInputNum(p, pBox->iBox) );
70  Vec_StrPutI_ne( vStr, Tim_ManBoxOutputNum(p, pBox->iBox) );
71  Vec_StrPutI_ne( vStr, Tim_ManBoxDelayTableId(p, pBox->iBox) ); // can be -1 if delay table is not given
72  Vec_StrPutI_ne( vStr, Tim_ManBoxCopy(p, pBox->iBox) ); // can be -1 if the copy is node defined
73  }
74  if ( fHieOnly )
75  return vStr;
76  // save the number of delay tables
78  // save the delay tables
79  if ( Tim_ManDelayTableNum(p) > 0 )
80  Tim_ManForEachTable( p, pDelayTable, i )
81  {
82  assert( (int)pDelayTable[0] == i );
83  // save table ID and dimensions (inputs x outputs)
84  Vec_StrPutI_ne( vStr, (int)pDelayTable[0] );
85  Vec_StrPutI_ne( vStr, (int)pDelayTable[1] );
86  Vec_StrPutI_ne( vStr, (int)pDelayTable[2] );
87  // save table contents
88  TableSize = (int)pDelayTable[1] * (int)pDelayTable[2];
89  for ( k = 0; k < TableSize; k++ )
90  Vec_StrPutF( vStr, pDelayTable[k+3] );
91  }
92  // save PI arrival times
93  Tim_ManForEachPi( p, pObj, i )
94  Vec_StrPutF( vStr, Tim_ManGetCiArrival(p, pObj->Id) );
95  // save PO required times
96  Tim_ManForEachPo( p, pObj, i )
97  Vec_StrPutF( vStr, Tim_ManGetCoRequired(p, pObj->Id) );
98  return vStr;
99 }
int Tim_ManCoNum(Tim_Man_t *p)
Definition: timMan.c:684
#define Tim_ManForEachTable(p, pTable, i)
Definition: timInt.h:125
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Tim_ManForEachBox(p, pBox, i)
Definition: timInt.h:117
#define Tim_ManForEachPo(p, pObj, i)
Definition: timInt.h:114
int Tim_ManBoxOutputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:202
int Tim_ManBoxDelayTableId(Tim_Man_t *p, int iBox)
Definition: timBox.c:218
static Vec_Str_t * Vec_StrAlloc(int nCap)
Definition: bblif.c:495
int Tim_ManPiNum(Tim_Man_t *p)
Definition: timMan.c:688
int Tim_ManDelayTableNum(Tim_Man_t *p)
Definition: timMan.c:715
static void Vec_StrPutI_ne(Vec_Str_t *vOut, int Val)
Definition: vecStr.h:814
int Tim_ManCiNum(Tim_Man_t *p)
Definition: timMan.c:680
int Tim_ManBoxNum(Tim_Man_t *p)
Definition: timMan.c:702
static void Vec_StrPutF(Vec_Str_t *vOut, float Val)
Definition: vecStr.h:861
int Tim_ManBoxInputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:186
#define Tim_ManForEachPi(p, pObj, i)
Definition: timInt.h:112
int Tim_ManBoxCopy(Tim_Man_t *p, int iBox)
Definition: timBox.c:274
float Tim_ManGetCoRequired(Tim_Man_t *p, int iCo)
Definition: timTime.c:222
#define assert(ex)
Definition: util_old.h:213
float Tim_ManGetCiArrival(Tim_Man_t *p, int iCi)
Definition: timTime.c:174
typedefABC_NAMESPACE_HEADER_START struct Tim_Box_t_ Tim_Box_t
INCLUDES ///.
Definition: timInt.h:48
int Tim_ManPoNum(Tim_Man_t *p)
Definition: timMan.c:694
#define TIM_DUMP_VER_NUM
DECLARATIONS ///.
Definition: timDump.c:29
void Tim_ManSetCiRequired ( Tim_Man_t p,
int  iCi,
float  Delay 
)

Function*************************************************************

Synopsis [Updates required time of the CI.]

Description []

SideEffects []

SeeAlso []

Definition at line 135 of file timTime.c.

136 {
137  assert( iCi < p->nCis );
138  assert( !p->fUseTravId || p->pCis[iCi].TravId != p->nTravIds );
139  p->pCis[iCi].timeReq = Delay;
140  p->pCis[iCi].TravId = p->nTravIds;
141 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
void Tim_ManSetCoArrival ( Tim_Man_t p,
int  iCo,
float  Delay 
)

Function*************************************************************

Synopsis [Updates arrival time of the CO.]

Description []

SideEffects []

SeeAlso []

Definition at line 116 of file timTime.c.

117 {
118  assert( iCo < p->nCos );
119  assert( !p->fUseTravId || p->pCos[iCo].TravId != p->nTravIds );
120  p->pCos[iCo].timeArr = Delay;
121  p->pCos[iCo].TravId = p->nTravIds;
122 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
void Tim_ManSetCoRequired ( Tim_Man_t p,
int  iCo,
float  Delay 
)

Function*************************************************************

Synopsis [Updates required time of the CO.]

Description []

SideEffects []

SeeAlso []

Definition at line 154 of file timTime.c.

155 {
156  assert( iCo < p->nCos );
157  assert( !p->fUseTravId || !p->nTravIds || p->pCos[iCo].TravId != p->nTravIds );
158  p->pCos[iCo].timeReq = Delay;
159  p->pCos[iCo].TravId = p->nTravIds;
160 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
void Tim_ManSetCurrentTravIdBoxInputs ( Tim_Man_t p,
int  iBox 
)

Function*************************************************************

Synopsis [Label box inputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 70 of file timTrav.c.

71 {
72  Tim_Box_t * pBox;
73  Tim_Obj_t * pObj;
74  int i;
75  pBox = Tim_ManBox( p, iBox );
76  Tim_ManBoxForEachInput( p, pBox, pObj, i )
77  pObj->TravId = p->nTravIds;
78 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Tim_ManBoxForEachInput(p, pBox, pObj, i)
Definition: timInt.h:120
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
typedefABC_NAMESPACE_HEADER_START struct Tim_Box_t_ Tim_Box_t
INCLUDES ///.
Definition: timInt.h:48
void Tim_ManSetCurrentTravIdBoxOutputs ( Tim_Man_t p,
int  iBox 
)

Function*************************************************************

Synopsis [Label box outputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 91 of file timTrav.c.

92 {
93  Tim_Box_t * pBox;
94  Tim_Obj_t * pObj;
95  int i;
96  pBox = Tim_ManBox( p, iBox );
97  Tim_ManBoxForEachOutput( p, pBox, pObj, i )
98  pObj->TravId = p->nTravIds;
99 }
#define Tim_ManBoxForEachOutput(p, pBox, pObj, i)
Definition: timInt.h:122
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
typedefABC_NAMESPACE_HEADER_START struct Tim_Box_t_ Tim_Box_t
INCLUDES ///.
Definition: timInt.h:48
void Tim_ManSetDelayTables ( Tim_Man_t p,
Vec_Ptr_t vDelayTables 
)

Function*************************************************************

Synopsis [Sets the vector of timing tables associated with the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 731 of file timMan.c.

732 {
733  assert( p->vDelayTables == NULL );
734  p->vDelayTables = vDelayTables;
735 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
void Tim_ManSetPreviousTravIdBoxInputs ( Tim_Man_t p,
int  iBox 
)

Function*************************************************************

Synopsis [Label box inputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 112 of file timTrav.c.

113 {
114  Tim_Box_t * pBox;
115  Tim_Obj_t * pObj;
116  int i;
117  pBox = Tim_ManBox( p, iBox );
118  Tim_ManBoxForEachInput( p, pBox, pObj, i )
119  pObj->TravId = p->nTravIds - 1;
120 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Tim_ManBoxForEachInput(p, pBox, pObj, i)
Definition: timInt.h:120
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
typedefABC_NAMESPACE_HEADER_START struct Tim_Box_t_ Tim_Box_t
INCLUDES ///.
Definition: timInt.h:48
void Tim_ManSetPreviousTravIdBoxOutputs ( Tim_Man_t p,
int  iBox 
)

Function*************************************************************

Synopsis [Label box outputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 133 of file timTrav.c.

134 {
135  Tim_Box_t * pBox;
136  Tim_Obj_t * pObj;
137  int i;
138  pBox = Tim_ManBox( p, iBox );
139  Tim_ManBoxForEachOutput( p, pBox, pObj, i )
140  pObj->TravId = p->nTravIds - 1;
141 }
#define Tim_ManBoxForEachOutput(p, pBox, pObj, i)
Definition: timInt.h:122
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
typedefABC_NAMESPACE_HEADER_START struct Tim_Box_t_ Tim_Box_t
INCLUDES ///.
Definition: timInt.h:48
Tim_Man_t* Tim_ManStart ( int  nCis,
int  nCos 
)

DECLARATIONS ///.

CFile****************************************************************

FileName [timMan.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Hierarchy/timing manager.]

Synopsis [Manipulation of manager data-structure.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - April 28, 2007.]

Revision [

Id:
timMan.c,v 1.00 2007/04/28 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Starts the timing manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file timMan.c.

46 {
47  Tim_Man_t * p;
48  Tim_Obj_t * pObj;
49  int i;
50  p = ABC_ALLOC( Tim_Man_t, 1 );
51  memset( p, 0, sizeof(Tim_Man_t) );
52  p->pMemObj = Mem_FlexStart();
53  p->nCis = nCis;
54  p->nCos = nCos;
55  p->pCis = ABC_ALLOC( Tim_Obj_t, nCis );
56  memset( p->pCis, 0, sizeof(Tim_Obj_t) * nCis );
57  p->pCos = ABC_ALLOC( Tim_Obj_t, nCos );
58  memset( p->pCos, 0, sizeof(Tim_Obj_t) * nCos );
59  Tim_ManForEachCi( p, pObj, i )
60  {
61  pObj->Id = i;
62  pObj->iObj2Box = pObj->iObj2Num = -1;
63  pObj->timeReq = TIM_ETERNITY;
64  }
65  Tim_ManForEachCo( p, pObj, i )
66  {
67  pObj->Id = i;
68  pObj->iObj2Box = pObj->iObj2Num = -1;
69  pObj->timeReq = TIM_ETERNITY;
70  }
71  p->fUseTravId = 1;
72  return p;
73 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Mem_Flex_t * Mem_FlexStart()
Definition: mem.c:311
float timeReq
Definition: timInt.h:86
#define Tim_ManForEachCo(p, pObj, i)
Definition: timInt.h:109
int iObj2Num
Definition: timInt.h:84
int Id
Definition: timInt.h:81
#define TIM_ETERNITY
MACRO DEFINITIONS ///.
Definition: tim.h:98
#define Tim_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: timInt.h:107
int iObj2Box
Definition: timInt.h:83
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
void Tim_ManStop ( Tim_Man_t p)

Function*************************************************************

Synopsis [Stops the timing manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 375 of file timMan.c.

376 {
377  Vec_PtrFreeFree( p->vDelayTables );
378  Vec_PtrFreeP( &p->vBoxes );
379  Mem_FlexStop( p->pMemObj, 0 );
380  ABC_FREE( p->pCis );
381  ABC_FREE( p->pCos );
382  ABC_FREE( p );
383 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrFreeFree(Vec_Ptr_t *p)
Definition: vecPtr.h:569
void Mem_FlexStop(Mem_Flex_t *p, int fVerbose)
Definition: mem.c:343
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_PtrFreeP(Vec_Ptr_t **p)
Definition: vecPtr.h:240
void Tim_ManStopP ( Tim_Man_t **  p)

Definition at line 384 of file timMan.c.

385 {
386  if ( *p == NULL )
387  return;
388  Tim_ManStop( *p );
389  *p = NULL;
390 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Tim_ManStop(Tim_Man_t *p)
Definition: timMan.c:375
void Tim_ManTravIdDisable ( Tim_Man_t p)

Function*************************************************************

Synopsis [Disables the use of the traversal ID.]

Description []

SideEffects []

SeeAlso []

Definition at line 748 of file timMan.c.

749 {
750  p->fUseTravId = 0;
751 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Tim_ManTravIdEnable ( Tim_Man_t p)

Function*************************************************************

Synopsis [Enables the use of the traversal ID.]

Description []

SideEffects []

SeeAlso []

Definition at line 764 of file timMan.c.

765 {
766  p->fUseTravId = 1;
767 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Tim_Man_t* Tim_ManTrim ( Tim_Man_t p,
Vec_Int_t vBoxPres 
)

Function*************************************************************

Synopsis [Trims the timing manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 163 of file timMan.c.

164 {
165  Tim_Man_t * pNew;
166  Tim_Box_t * pBox;
167  Tim_Obj_t * pObj;
168  float * pDelayTable, * pDelayTableNew;
169  int i, k, nNewCis, nNewCos, nInputs, nOutputs;
170  assert( Vec_IntSize(vBoxPres) == Tim_ManBoxNum(p) );
171  // count the number of CIs and COs in the trimmed manager
172  nNewCis = Tim_ManPiNum(p);
173  nNewCos = Tim_ManPoNum(p);
174  if ( Tim_ManBoxNum(p) )
175  Tim_ManForEachBox( p, pBox, i )
176  if ( Vec_IntEntry(vBoxPres, i) )
177  {
178  nNewCis += pBox->nOutputs;
179  nNewCos += pBox->nInputs;
180  }
181  if ( nNewCis == Tim_ManCiNum(p) && nNewCos == Tim_ManCoNum(p) )
182  return Tim_ManDup( p, 0 );
183  assert( nNewCis < Tim_ManCiNum(p) );
184  assert( nNewCos < Tim_ManCoNum(p) );
185  // clear traversal IDs
186  Tim_ManForEachCi( p, pObj, i )
187  pObj->TravId = 0;
188  Tim_ManForEachCo( p, pObj, i )
189  pObj->TravId = 0;
190  // create new manager
191  pNew = Tim_ManStart( nNewCis, nNewCos );
192  // copy box connectivity information
193  memcpy( pNew->pCis, p->pCis, sizeof(Tim_Obj_t) * Tim_ManPiNum(p) );
194  memcpy( pNew->pCos + nNewCos - Tim_ManPoNum(p),
195  p->pCos + Tim_ManCoNum(p) - Tim_ManPoNum(p),
196  sizeof(Tim_Obj_t) * Tim_ManPoNum(p) );
197  // duplicate delay tables
198  if ( Tim_ManDelayTableNum(p) > 0 )
199  {
200  pNew->vDelayTables = Vec_PtrStart( Vec_PtrSize(p->vDelayTables) );
201  Tim_ManForEachTable( p, pDelayTable, i )
202  {
203  if ( pDelayTable == NULL )
204  continue;
205  assert( i == (int)pDelayTable[0] );
206  nInputs = (int)pDelayTable[1];
207  nOutputs = (int)pDelayTable[2];
208  pDelayTableNew = ABC_ALLOC( float, 3 + nInputs * nOutputs );
209  pDelayTableNew[0] = (int)pDelayTable[0];
210  pDelayTableNew[1] = (int)pDelayTable[1];
211  pDelayTableNew[2] = (int)pDelayTable[2];
212  for ( k = 0; k < nInputs * nOutputs; k++ )
213  pDelayTableNew[3+k] = pDelayTable[3+k];
214 // assert( (int)pDelayTableNew[0] == Vec_PtrSize(pNew->vDelayTables) );
215  assert( Vec_PtrEntry(pNew->vDelayTables, i) == NULL );
216  Vec_PtrWriteEntry( pNew->vDelayTables, i, pDelayTableNew );
217  }
218  }
219  // duplicate boxes
220  if ( Tim_ManBoxNum(p) > 0 )
221  {
222  int curPi = Tim_ManPiNum(p);
223  int curPo = 0;
224  pNew->vBoxes = Vec_PtrAlloc( Tim_ManBoxNum(p) );
225  Tim_ManForEachBox( p, pBox, i )
226  if ( Vec_IntEntry(vBoxPres, i) )
227  {
228  Tim_ManCreateBox( pNew, curPo, pBox->nInputs, curPi, pBox->nOutputs, pBox->iDelayTable );
229  Tim_ManBoxSetCopy( pNew, Tim_ManBoxNum(pNew) - 1, i );
230  curPi += pBox->nOutputs;
231  curPo += pBox->nInputs;
232  }
233  curPo += Tim_ManPoNum(p);
234  assert( curPi == Tim_ManCiNum(pNew) );
235  assert( curPo == Tim_ManCoNum(pNew) );
236  }
237  return pNew;
238 }
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition: timMan.c:86
#define Tim_ManForEachTable(p, pTable, i)
Definition: timInt.h:125
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Tim_ManForEachBox(p, pBox, i)
Definition: timInt.h:117
int Tim_ManPiNum(Tim_Man_t *p)
Definition: timMan.c:688
char * memcpy()
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int Tim_ManDelayTableNum(Tim_Man_t *p)
Definition: timMan.c:715
void Tim_ManCreateBox(Tim_Man_t *p, int firstIn, int nIns, int firstOut, int nOuts, int iDelayTable)
ITERATORS ///.
Definition: timBox.c:44
int Tim_ManPoNum(Tim_Man_t *p)
Definition: timMan.c:694
int Tim_ManBoxNum(Tim_Man_t *p)
Definition: timMan.c:702
ABC_NAMESPACE_IMPL_START Tim_Man_t * Tim_ManStart(int nCis, int nCos)
DECLARATIONS ///.
Definition: timMan.c:45
#define Tim_ManForEachCo(p, pObj, i)
Definition: timInt.h:109
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define Tim_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: timInt.h:107
int Tim_ManCoNum(Tim_Man_t *p)
Definition: timMan.c:684
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
typedefABC_NAMESPACE_HEADER_START struct Tim_Box_t_ Tim_Box_t
INCLUDES ///.
Definition: timInt.h:48
void Tim_ManBoxSetCopy(Tim_Man_t *p, int iBox, int iCopy)
Definition: timBox.c:290
int Tim_ManCiNum(Tim_Man_t *p)
Definition: timMan.c:680