ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
tim.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TIM_ETERNITY   1000000000
 MACRO DEFINITIONS ///.
 

Typedefs

typedef typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
 INCLUDES ///.
 

Functions

void Tim_ManCreateBox (Tim_Man_t *p, int firstIn, int nIns, int firstOut, int nOuts, int iDelayTable, int fBlack)
 ITERATORS ///.
 
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 ///.
 
Tim_Man_tTim_ManLoad (Vec_Str_t *p, int fHieOnly)
 
Tim_Man_tTim_ManStart (int nCis, int nCos)
 DECLARATIONS ///.
 
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_ManPrintBoxCopy (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)
 
void Tim_ManBlackBoxIoNum (Tim_Man_t *p, int *pnBbIns, int *pnBbOuts)
 
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 ///.
 
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 ///.
 
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

◆ TIM_ETERNITY

#define TIM_ETERNITY   1000000000

MACRO DEFINITIONS ///.

Definition at line 98 of file tim.h.

Typedef Documentation

◆ Tim_Man_t

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

◆ Tim_ManAlignTwo()

Vec_Int_t * Tim_ManAlignTwo ( Tim_Man_t * pSpec,
Tim_Man_t * pImpl )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 347 of file timMan.c.

348{
349 Vec_Int_t * vBoxPres;
350 Tim_Box_t * pBox;
351 int i;
352 assert( Tim_ManBoxNum(pSpec) > Tim_ManBoxNum(pImpl) );
353 // check if boxes of pImpl can be aligned
354 Tim_ManForEachBox( pImpl, pBox, i )
355 if ( pBox->iCopy < 0 || pBox->iCopy >= Tim_ManBoxNum(pSpec) )
356 return NULL;
357 // map dropped boxes into 1, others into 0
358 vBoxPres = Vec_IntStart( Tim_ManBoxNum(pSpec) );
359 Tim_ManForEachBox( pImpl, pBox, i )
360 {
361 assert( !Vec_IntEntry(vBoxPres, pBox->iCopy) );
362 Vec_IntWriteEntry( vBoxPres, pBox->iCopy, 1 );
363 }
364 return vBoxPres;
365}
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
typedefABC_NAMESPACE_HEADER_START struct Tim_Box_t_ Tim_Box_t
INCLUDES ///.
Definition timInt.h:48
int Tim_ManBoxNum(Tim_Man_t *p)
Definition timMan.c:722
int Tim_ManBoxNum(Tim_Man_t *p)
Definition timMan.c:722
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tim_ManBlackBoxIoNum()

void Tim_ManBlackBoxIoNum ( Tim_Man_t * p,
int * pnBbIns,
int * pnBbOuts )
extern

Definition at line 735 of file timMan.c.

736{
737 Tim_Box_t * pBox;
738 int i;
739 *pnBbIns = *pnBbOuts = 0;
740 if ( Tim_ManBoxNum(p) )
741 Tim_ManForEachBox( p, pBox, i )
742 {
743 if ( !pBox->fBlack )//&& pBox->nInputs <= 6 )
744 continue;
745 *pnBbIns += Tim_ManBoxInputNum( p, i );
746 *pnBbOuts += Tim_ManBoxOutputNum( p, i );
747 }
748}
Cube * p
Definition exorList.c:222
int Tim_ManBoxOutputNum(Tim_Man_t *p, int iBox)
Definition timBox.c:203
int Tim_ManBoxInputNum(Tim_Man_t *p, int iBox)
Definition timBox.c:187
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tim_ManBlackBoxNum()

int Tim_ManBlackBoxNum ( Tim_Man_t * p)
extern

Definition at line 726 of file timMan.c.

727{
728 Tim_Box_t * pBox;
729 int i, Counter = 0;
730 if ( Tim_ManBoxNum(p) )
731 Tim_ManForEachBox( p, pBox, i )
732 Counter += pBox->fBlack;
733 return Counter;
734}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tim_ManBoxCopy()

int Tim_ManBoxCopy ( Tim_Man_t * p,
int iBox )
extern

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

Synopsis [Returns the copy of the box.]

Description []

SideEffects []

SeeAlso []

Definition at line 275 of file timBox.c.

276{
277 return Tim_ManBox(p, iBox)->iCopy;
278}
Here is the caller graph for this function:

◆ Tim_ManBoxDelayTable()

float * Tim_ManBoxDelayTable ( Tim_Man_t * p,
int iBox )
extern

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

Synopsis [Return the delay table.]

Description []

SideEffects []

SeeAlso []

Definition at line 235 of file timBox.c.

236{
237 float * pTable;
238 Tim_Box_t * pBox = Tim_ManBox(p, iBox);
239 if ( pBox->iDelayTable < 0 )
240 return NULL;
241 pTable = (float *)Vec_PtrEntry( p->vDelayTables, pBox->iDelayTable );
242 assert( (int)pTable[1] == pBox->nInputs );
243 assert( (int)pTable[2] == pBox->nOutputs );
244 return pTable;
245}
Here is the caller graph for this function:

◆ Tim_ManBoxDelayTableId()

int Tim_ManBoxDelayTableId ( Tim_Man_t * p,
int iBox )
extern

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

Synopsis [Return the delay table id.]

Description []

SideEffects []

SeeAlso []

Definition at line 219 of file timBox.c.

220{
221 return Tim_ManBox(p, iBox)->iDelayTable;
222}
Here is the caller graph for this function:

◆ Tim_ManBoxFindFromCiNum()

int Tim_ManBoxFindFromCiNum ( Tim_Man_t * p,
int iCiNum )
extern

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 307 of file timBox.c.

308{
309 Tim_Box_t * pBox;
310 int i;
311 assert( iCiNum >= 0 && iCiNum < Tim_ManCiNum(p) );
312 if ( iCiNum < Tim_ManPiNum(p) )
313 return -1;
314 Tim_ManForEachBox( p, pBox, i )
315 if ( iCiNum < Tim_ManBoxOutputFirst(p, i) )
316 return i - 1;
317 return -2;
318}
int Tim_ManBoxOutputFirst(Tim_Man_t *p, int iBox)
Definition timBox.c:155
int Tim_ManCiNum(Tim_Man_t *p)
Definition timMan.c:700
int Tim_ManPiNum(Tim_Man_t *p)
Definition timMan.c:708
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tim_ManBoxForCi()

int Tim_ManBoxForCi ( Tim_Man_t * p,
int iCi )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 87 of file timBox.c.

88{
89 if ( iCi >= p->nCis )
90 return -1;
91 return p->pCis[iCi].iObj2Box;
92}
Here is the caller graph for this function:

◆ Tim_ManBoxForCo()

int Tim_ManBoxForCo ( Tim_Man_t * p,
int iCo )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 105 of file timBox.c.

106{
107 if ( iCo >= p->nCos )
108 return -1;
109 return p->pCos[iCo].iObj2Box;
110}
Here is the caller graph for this function:

◆ Tim_ManBoxInputFirst()

int Tim_ManBoxInputFirst ( Tim_Man_t * p,
int iBox )
extern

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

Synopsis [Returns the first input of the box.]

Description []

SideEffects []

SeeAlso []

Definition at line 123 of file timBox.c.

124{
125 return Tim_ManBox(p, iBox)->Inouts[0];
126}
Here is the caller graph for this function:

◆ Tim_ManBoxInputLast()

int Tim_ManBoxInputLast ( Tim_Man_t * p,
int iBox )
extern

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

Synopsis [Returns the last input of the box.]

Description []

SideEffects []

SeeAlso []

Definition at line 139 of file timBox.c.

140{
141 return Tim_ManBox(p, iBox)->Inouts[0] + Tim_ManBoxInputNum(p, iBox) - 1;
142}
int Tim_ManBoxInputNum(Tim_Man_t *p, int iBox)
Definition timBox.c:187
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tim_ManBoxInputNum()

int Tim_ManBoxInputNum ( Tim_Man_t * p,
int iBox )
extern

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

Synopsis [Returns the number of box inputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 187 of file timBox.c.

188{
189 return Tim_ManBox(p, iBox)->nInputs;
190}
Here is the caller graph for this function:

◆ Tim_ManBoxIsBlack()

int Tim_ManBoxIsBlack ( Tim_Man_t * p,
int iBox )
extern

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

Synopsis [Return 1 if the box is black.]

Description []

SideEffects []

SeeAlso []

Definition at line 258 of file timBox.c.

259{
260 return Tim_ManBox(p, iBox)->fBlack;
261}
Here is the caller graph for this function:

◆ Tim_ManBoxNum()

int Tim_ManBoxNum ( Tim_Man_t * p)
extern

Definition at line 722 of file timMan.c.

723{
724 return p->vBoxes ? Vec_PtrSize(p->vBoxes) : 0;
725}
Here is the caller graph for this function:

◆ Tim_ManBoxOutputFirst()

int Tim_ManBoxOutputFirst ( Tim_Man_t * p,
int iBox )
extern

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

Synopsis [Returns the first output of the box.]

Description []

SideEffects []

SeeAlso []

Definition at line 155 of file timBox.c.

156{
157 return Tim_ManBox(p, iBox)->Inouts[Tim_ManBox(p, iBox)->nInputs];
158}
Here is the caller graph for this function:

◆ Tim_ManBoxOutputLast()

int Tim_ManBoxOutputLast ( Tim_Man_t * p,
int iBox )
extern

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

Synopsis [Returns the last output of the box.]

Description []

SideEffects []

SeeAlso []

Definition at line 171 of file timBox.c.

172{
173 return Tim_ManBox(p, iBox)->Inouts[Tim_ManBox(p, iBox)->nInputs] + Tim_ManBoxOutputNum(p, iBox) - 1;
174}
int Tim_ManBoxOutputNum(Tim_Man_t *p, int iBox)
Definition timBox.c:203
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tim_ManBoxOutputNum()

int Tim_ManBoxOutputNum ( Tim_Man_t * p,
int iBox )
extern

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

Synopsis [Returns the number of box outputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 203 of file timBox.c.

204{
205 return Tim_ManBox(p, iBox)->nOutputs;
206}
Here is the caller graph for this function:

◆ Tim_ManBoxSetCopy()

void Tim_ManBoxSetCopy ( Tim_Man_t * p,
int iBox,
int iCopy )
extern

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

Synopsis [Sets the copy of the box.]

Description []

SideEffects []

SeeAlso []

Definition at line 291 of file timBox.c.

292{
293 Tim_ManBox(p, iBox)->iCopy = iCopy;
294}
Here is the caller graph for this function:

◆ Tim_ManCiNum()

int Tim_ManCiNum ( Tim_Man_t * p)
extern

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

Synopsis [Read parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 700 of file timMan.c.

701{
702 return p->nCis;
703}
Here is the caller graph for this function:

◆ Tim_ManCoNum()

int Tim_ManCoNum ( Tim_Man_t * p)
extern

Definition at line 704 of file timMan.c.

705{
706 return p->nCos;
707}
Here is the caller graph for this function:

◆ Tim_ManCreate()

void Tim_ManCreate ( Tim_Man_t * p,
void * pLib,
Vec_Flt_t * vInArrs,
Vec_Flt_t * vOutReqs )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 406 of file timMan.c.

407{
408 If_LibBox_t * pLibBox = (If_LibBox_t *)pLib;
409 If_Box_t * pIfBox;
410 Tim_Box_t * pBox;
411 Tim_Obj_t * pObj;
412 float * pTable;
413 int i, k;
414 assert( p->vDelayTables == NULL );
415 p->vDelayTables = pLibBox ? Vec_PtrStart( Vec_PtrSize(pLibBox->vBoxes) ) : Vec_PtrAlloc( 100 );
416 if ( p->vBoxes )
417 Tim_ManForEachBox( p, pBox, i )
418 {
419 if ( pBox->iDelayTable == -1 || pLibBox == NULL )
420 {
421 // create table with constants
422 pTable = ABC_ALLOC( float, 3 + pBox->nInputs * pBox->nOutputs );
423 pTable[0] = pBox->iDelayTable;
424 pTable[1] = pBox->nInputs;
425 pTable[2] = pBox->nOutputs;
426 for ( k = 0; k < pBox->nInputs * pBox->nOutputs; k++ )
427 pTable[3 + k] = 1.0;
428 // save table
429 pBox->iDelayTable = Vec_PtrSize(p->vDelayTables);
430 Vec_PtrPush( p->vDelayTables, pTable );
431 continue;
432 }
433 assert( pBox->iDelayTable >= 0 && pBox->iDelayTable < Vec_PtrSize(pLibBox->vBoxes) );
434 pIfBox = (If_Box_t *)Vec_PtrEntry( pLibBox->vBoxes, pBox->iDelayTable );
435 assert( pIfBox != NULL );
436 assert( pIfBox->nPis == pBox->nInputs );
437 assert( pIfBox->nPos == pBox->nOutputs );
438 pBox->fBlack = pIfBox->fBlack;
439 if ( Vec_PtrEntry( p->vDelayTables, pBox->iDelayTable ) != NULL )
440 continue;
441 // create table of boxes
442 pTable = ABC_ALLOC( float, 3 + pBox->nInputs * pBox->nOutputs );
443 pTable[0] = pBox->iDelayTable;
444 pTable[1] = pBox->nInputs;
445 pTable[2] = pBox->nOutputs;
446 for ( k = 0; k < pBox->nInputs * pBox->nOutputs; k++ )
447 pTable[3 + k] = pIfBox->pDelays[k];
448 // save table
449 Vec_PtrWriteEntry( p->vDelayTables, pBox->iDelayTable, pTable );
450 }
451 // create arrival times
452 if ( vInArrs )
453 {
454 assert( Vec_FltSize(vInArrs) == Tim_ManPiNum(p) );
455 Tim_ManForEachPi( p, pObj, i )
456 pObj->timeArr = Vec_FltEntry(vInArrs, i);
457
458 }
459 // create required times
460 if ( vOutReqs )
461 {
462 k = 0;
463 assert( Vec_FltSize(vOutReqs) == Tim_ManPoNum(p) );
464 Tim_ManForEachPo( p, pObj, i )
465 pObj->timeReq = Vec_FltEntry(vOutReqs, k++);
466 assert( k == Tim_ManPoNum(p) );
467 }
468}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
struct If_LibBox_t_ If_LibBox_t
Definition if.h:83
struct If_Box_t_ If_Box_t
Definition if.h:364
int nPos
Definition if.h:374
int nPis
Definition if.h:373
char fBlack
Definition if.h:369
int * pDelays
Definition if.h:375
Vec_Ptr_t * vBoxes
Definition if.h:381
float timeArr
Definition timInt.h:85
float timeReq
Definition timInt.h:86
#define Tim_ManForEachPo(p, pObj, i)
Definition timInt.h:114
struct Tim_Obj_t_ Tim_Obj_t
Definition timInt.h:49
#define Tim_ManForEachPi(p, pObj, i)
Definition timInt.h:112
int Tim_ManPoNum(Tim_Man_t *p)
Definition timMan.c:714
int Tim_ManPiNum(Tim_Man_t *p)
Definition timMan.c:708
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tim_ManCreateBox()

void Tim_ManCreateBox ( Tim_Man_t * p,
int firstIn,
int nIns,
int firstOut,
int nOuts,
int iDelayTable,
int fBlack )
extern

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 pBox->fBlack = fBlack;
58 for ( i = 0; i < nIns; i++ )
59 {
60 assert( firstIn+i < p->nCos );
61 pBox->Inouts[i] = firstIn+i;
62 p->pCos[firstIn+i].iObj2Box = pBox->iBox;
63 p->pCos[firstIn+i].iObj2Num = i;
64 }
65 for ( i = 0; i < nOuts; i++ )
66 {
67 assert( firstOut+i < p->nCis );
68 pBox->Inouts[nIns+i] = firstOut+i;
69 p->pCis[firstOut+i].iObj2Box = pBox->iBox;
70 p->pCis[firstOut+i].iObj2Num = i;
71 }
72// if ( pBox->iBox < 20 )
73// printf( "%4d %4d %4d %4d \n", firstIn, nIns, firstOut, nOuts );
74}
char * Mem_FlexEntryFetch(Mem_Flex_t *p, int nBytes)
Definition mem.c:388
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tim_ManDelayTableNum()

int Tim_ManDelayTableNum ( Tim_Man_t * p)
extern

Definition at line 749 of file timMan.c.

750{
751 return p->vDelayTables ? Vec_PtrSize(p->vDelayTables) : 0;
752}
Here is the caller graph for this function:

◆ Tim_ManDup()

Tim_Man_t * Tim_ManDup ( Tim_Man_t * p,
int fUnitDelay )
extern

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
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 {
147 Tim_ManCreateBox( pNew, pBox->Inouts[0], pBox->nInputs,
148 pBox->Inouts[pBox->nInputs], pBox->nOutputs, pBox->iDelayTable, pBox->fBlack );
149 Tim_ManBoxSetCopy( pNew, i, pBox->iCopy );
150 }
151 }
152 return pNew;
153}
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition abc_global.h:250
int TravId
Definition timInt.h:82
#define Tim_ManForEachCo(p, pObj, i)
Definition timInt.h:109
#define Tim_ManForEachTable(p, pTable, i)
Definition timInt.h:125
#define Tim_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition timInt.h:107
ABC_NAMESPACE_IMPL_START Tim_Man_t * Tim_ManStart(int nCis, int nCos)
DECLARATIONS ///.
Definition timMan.c:45
int Tim_ManDelayTableNum(Tim_Man_t *p)
Definition timMan.c:749
void Tim_ManInitPiArrivalAll(Tim_Man_t *p, float Delay)
Definition timTime.c:78
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition tim.h:92
void Tim_ManCreateBox(Tim_Man_t *p, int firstIn, int nIns, int firstOut, int nOuts, int iDelayTable, int fBlack)
ITERATORS ///.
Definition timBox.c:44
void Tim_ManBoxSetCopy(Tim_Man_t *p, int iBox, int iCopy)
Definition timBox.c:291
void Tim_ManInitPoRequiredAll(Tim_Man_t *p, float Delay)
Definition timTime.c:97
#define TIM_ETERNITY
MACRO DEFINITIONS ///.
Definition tim.h:98
char * memcpy()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tim_ManGetArrTimes()

float * Tim_ManGetArrTimes ( Tim_Man_t * p)
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 482 of file timMan.c.

483{
484 float * pTimes;
485 Tim_Obj_t * pObj;
486 int i;
487 Tim_ManForEachPi( p, pObj, i )
488 if ( pObj->timeArr != 0.0 )
489 break;
490 if ( i == Tim_ManPiNum(p) )
491 return NULL;
492 pTimes = ABC_FALLOC( float, Tim_ManCiNum(p) );
493 Tim_ManForEachPi( p, pObj, i )
494 pTimes[i] = pObj->timeArr;
495 return pTimes;
496}
#define ABC_FALLOC(type, num)
Definition abc_global.h:266
int Tim_ManCiNum(Tim_Man_t *p)
Definition timMan.c:700
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tim_ManGetCiArrival()

float Tim_ManGetCiArrival ( Tim_Man_t * p,
int iCi )
extern

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}
#define Tim_ManBoxForEachInput(p, pBox, pObj, i)
Definition timInt.h:120
#define Tim_ManBoxForEachOutput(p, pBox, pObj, i)
Definition timInt.h:122
float * Tim_ManBoxDelayTable(Tim_Man_t *p, int iBox)
Definition timBox.c:235
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tim_ManGetCoRequired()

float Tim_ManGetCoRequired ( Tim_Man_t * p,
int iCo )
extern

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}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tim_ManGetReqTimes()

float * Tim_ManGetReqTimes ( Tim_Man_t * p)
extern

Definition at line 497 of file timMan.c.

498{
499 float * pTimes;
500 Tim_Obj_t * pObj;
501 int i, k = 0;
502 Tim_ManForEachPo( p, pObj, i )
503 if ( pObj->timeReq != TIM_ETERNITY )
504 break;
505 if ( i == Tim_ManPoNum(p) )
506 return NULL;
507 pTimes = ABC_FALLOC( float, Tim_ManCoNum(p) );
508 Tim_ManForEachPo( p, pObj, i )
509 pTimes[k++] = pObj->timeArr;
510 assert( k == Tim_ManPoNum(p) );
511 return pTimes;
512}
int Tim_ManCoNum(Tim_Man_t *p)
Definition timMan.c:704
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tim_ManIncrementTravId()

void Tim_ManIncrementTravId ( Tim_Man_t * p)
extern

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}
Here is the caller graph for this function:

◆ Tim_ManInitPiArrival()

void Tim_ManInitPiArrival ( Tim_Man_t * p,
int iPi,
float Delay )
extern

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}
Here is the caller graph for this function:

◆ Tim_ManInitPiArrivalAll()

void Tim_ManInitPiArrivalAll ( Tim_Man_t * p,
float Delay )
extern

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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tim_ManInitPoRequired()

void Tim_ManInitPoRequired ( Tim_Man_t * p,
int iPo,
float Delay )
extern

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}
Here is the caller graph for this function:

◆ Tim_ManInitPoRequiredAll()

void Tim_ManInitPoRequiredAll ( Tim_Man_t * p,
float Delay )
extern

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}
void Tim_ManSetCoRequired(Tim_Man_t *p, int iCo, float Delay)
Definition timTime.c:154
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tim_ManIsCiTravIdCurrent()

int Tim_ManIsCiTravIdCurrent ( Tim_Man_t * p,
int iCi )
extern

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}
Here is the caller graph for this function:

◆ Tim_ManIsCoTravIdCurrent()

int Tim_ManIsCoTravIdCurrent ( Tim_Man_t * p,
int iCo )
extern

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}
Here is the caller graph for this function:

◆ Tim_ManLoad()

Tim_Man_t * Tim_ManLoad ( Vec_Str_t * p,
int fHieOnly )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 113 of file timDump.c.

114{
115 Tim_Man_t * pMan;
116 Tim_Obj_t * pObj;
117 int VerNum, nCis, nCos, nPis, nPos;
118 int nBoxes, nBoxIns, nBoxOuts, CopyBox, fBlack;
119 int TableId, nTables, TableSize, TableX, TableY;
120 int i, k, curPi, curPo, iStr = 0;
121 float * pDelayTable;
122 // get version number
123 VerNum = Vec_StrGetI_ne( p, &iStr );
124 assert( VerNum == TIM_DUMP_VER_NUM );
125 // get the number of CIs/COs
126 nCis = Vec_StrGetI_ne( p, &iStr );
127 nCos = Vec_StrGetI_ne( p, &iStr );
128 // get the number of PIs/POs
129 nPis = Vec_StrGetI_ne( p, &iStr );
130 nPos = Vec_StrGetI_ne( p, &iStr );
131 // start the timing manager
132 pMan = Tim_ManStart( nCis, nCos );
133 // start boxes
134 nBoxes = Vec_StrGetI_ne( p, &iStr );
135 assert( pMan->vBoxes == NULL );
136 if ( nBoxes > 0 )
137 pMan->vBoxes = Vec_PtrAlloc( nBoxes );
138 // create boxes
139 curPi = nPis;
140 curPo = 0;
141 for ( i = 0; i < nBoxes; i++ )
142 {
143 nBoxIns = Vec_StrGetI_ne( p, &iStr );
144 nBoxOuts = Vec_StrGetI_ne( p, &iStr );
145 TableId = Vec_StrGetI_ne( p, &iStr );
146 CopyBox = Vec_StrGetI_ne( p, &iStr );
147 fBlack = 0;//Vec_StrGetI_ne( p, &iStr );
148 Tim_ManCreateBox( pMan, curPo, nBoxIns, curPi, nBoxOuts, TableId, fBlack );
149 Tim_ManBoxSetCopy( pMan, i, CopyBox );
150 curPi += nBoxOuts;
151 curPo += nBoxIns;
152 }
153 curPo += nPos;
154 assert( curPi == nCis );
155 assert( curPo == nCos );
156 if ( fHieOnly )
157 return pMan;
158 // create delay tables
159 nTables = Vec_StrGetI_ne( p, &iStr );
160 assert( pMan->vDelayTables == NULL );
161 if ( nTables > 0 )
162 pMan->vDelayTables = Vec_PtrAlloc( nTables );
163 // read delay tables
164 for ( i = 0; i < nTables; i++ )
165 {
166 // read table ID and dimensions
167 TableId = Vec_StrGetI_ne( p, &iStr );
168 TableX = Vec_StrGetI_ne( p, &iStr );
169 TableY = Vec_StrGetI_ne( p, &iStr );
170 assert( TableId == i );
171 // create new table
172 TableSize = TableX * TableY;
173 pDelayTable = ABC_ALLOC( float, TableSize + 3 );
174 pDelayTable[0] = TableId;
175 pDelayTable[1] = TableX;
176 pDelayTable[2] = TableY;
177 // read table contents
178 for ( k = 0; k < TableSize; k++ )
179 pDelayTable[k+3] = Vec_StrGetF( p, &iStr );
180 assert( Vec_PtrSize(pMan->vDelayTables) == TableId );
181 Vec_PtrPush( pMan->vDelayTables, pDelayTable );
182 }
183 assert( Tim_ManDelayTableNum(pMan) == nTables );
184 // read PI arrival times
185 Tim_ManForEachPi( pMan, pObj, i )
186 Tim_ManInitPiArrival( pMan, i, Vec_StrGetF(p, &iStr) );
187 // read PO required times
188 Tim_ManForEachPo( pMan, pObj, i )
189 Tim_ManInitPoRequired( pMan, i, Vec_StrGetF(p, &iStr) );
190 assert( Vec_StrSize(p) == iStr );
191// Tim_ManPrint( pMan );
192 return pMan;
193}
#define TIM_DUMP_VER_NUM
DECLARATIONS ///.
Definition timDump.c:29
Tim_Man_t * Tim_ManStart(int nCis, int nCos)
DECLARATIONS ///.
Definition timMan.c:45
void Tim_ManInitPiArrival(Tim_Man_t *p, int iPi, float Delay)
DECLARATIONS ///.
Definition timTime.c:44
int Tim_ManDelayTableNum(Tim_Man_t *p)
Definition timMan.c:749
void Tim_ManInitPoRequired(Tim_Man_t *p, int iPo, float Delay)
Definition timTime.c:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tim_ManPiNum()

int Tim_ManPiNum ( Tim_Man_t * p)
extern

Definition at line 708 of file timMan.c.

709{
710 if ( Tim_ManBoxNum(p) == 0 )
711 return Tim_ManCiNum(p);
712 return Tim_ManBoxOutputFirst(p, 0);
713}
int Tim_ManBoxOutputFirst(Tim_Man_t *p, int iBox)
Definition timBox.c:155
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tim_ManPoNum()

int Tim_ManPoNum ( Tim_Man_t * p)
extern

Definition at line 714 of file timMan.c.

715{
716 int iLastBoxId;
717 if ( Tim_ManBoxNum(p) == 0 )
718 return Tim_ManCoNum(p);
719 iLastBoxId = Tim_ManBoxNum(p) - 1;
720 return Tim_ManCoNum(p) - (Tim_ManBoxInputFirst(p, iLastBoxId) + Tim_ManBoxInputNum(p, iLastBoxId));
721}
int Tim_ManBoxInputFirst(Tim_Man_t *p, int iBox)
Definition timBox.c:123
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tim_ManPrint()

void Tim_ManPrint ( Tim_Man_t * p)
extern

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

Synopsis [Prints the timing manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 526 of file timMan.c.

527{
528 Tim_Box_t * pBox;
529 Tim_Obj_t * pObj, * pPrev;
530 float * pTable;
531 int i, j, k, TableX, TableY;
532 if ( p == NULL )
533 return;
534 printf( "TIMING MANAGER:\n" );
535 printf( "PI = %d. CI = %d. PO = %d. CO = %d. Box = %d.\n",
537
538 // print CI info
539 pPrev = p->pCis;
540 Tim_ManForEachPi( p, pObj, i )
541 if ( pPrev->timeArr != pObj->timeArr || pPrev->timeReq != pObj->timeReq )
542 break;
543 if ( i == Tim_ManCiNum(p) )
544 printf( "All PIs : arrival = %5.3f required = %5.3f\n", pPrev->timeArr, pPrev->timeReq );
545 else
546 Tim_ManForEachPi( p, pObj, i )
547 printf( "PI%5d : arrival = %5.3f required = %5.3f\n", i, pObj->timeArr, pObj->timeReq );
548
549 // print CO info
550 pPrev = p->pCos;
551 Tim_ManForEachPo( p, pObj, i )
552 if ( pPrev->timeArr != pObj->timeArr || pPrev->timeReq != pObj->timeReq )
553 break;
554 if ( i == Tim_ManCoNum(p) )
555 printf( "All POs : arrival = %5.3f required = %5.3f\n", pPrev->timeArr, pPrev->timeReq );
556 else
557 {
558 int k = 0;
559 Tim_ManForEachPo( p, pObj, i )
560 printf( "PO%5d : arrival = %5.3f required = %5.3f\n", k++, pObj->timeArr, pObj->timeReq );
561 }
562
563 // print box info
564 if ( Tim_ManBoxNum(p) > 0 )
565 Tim_ManForEachBox( p, pBox, i )
566 {
567 printf( "*** Box %5d : I =%4d. O =%4d. I1 =%6d. O1 =%6d. Table =%4d. Copy = %d.\n",
568 i, pBox->nInputs, pBox->nOutputs,
570 pBox->iDelayTable, pBox->iCopy );
571
572 // print box inputs
573 pPrev = Tim_ManBoxInput( p, pBox, 0 );
574 Tim_ManBoxForEachInput( p, pBox, pObj, k )
575 if ( pPrev->timeArr != pObj->timeArr || pPrev->timeReq != pObj->timeReq )
576 break;
577 if ( k == Tim_ManBoxInputNum(p, pBox->iBox) )
578 printf( "Box inputs : arrival = %5.3f required = %5.3f\n", pPrev->timeArr, pPrev->timeReq );
579 else
580 Tim_ManBoxForEachInput( p, pBox, pObj, k )
581 printf( "box-in%4d : arrival = %5.3f required = %5.3f\n", k, pObj->timeArr, pObj->timeReq );
582
583 // print box outputs
584 pPrev = Tim_ManBoxOutput( p, pBox, 0 );
585 Tim_ManBoxForEachOutput( p, pBox, pObj, k )
586 if ( pPrev->timeArr != pObj->timeArr || pPrev->timeReq != pObj->timeReq )
587 break;
588 if ( k == Tim_ManBoxOutputNum(p, pBox->iBox) )
589 printf( "Box outputs : arrival = %5.3f required = %5.3f\n", pPrev->timeArr, pPrev->timeReq );
590 else
591 Tim_ManBoxForEachOutput( p, pBox, pObj, k )
592 printf( "box-out%3d : arrival = %5.3f required = %5.3f\n", k, pObj->timeArr, pObj->timeReq );
593
594 if ( i == 7 )
595 break;
596 }
597
598 // print delay tables
599 if ( Tim_ManDelayTableNum(p) > 0 )
600 Tim_ManForEachTable( p, pTable, i )
601 {
602 if ( pTable == NULL )
603 continue;
604 printf( "Delay table %d:\n", i );
605 assert( i == (int)pTable[0] );
606 TableX = (int)pTable[1];
607 TableY = (int)pTable[2];
608 for ( j = 0; j < TableY; j++, printf( "\n" ) )
609 for ( k = 0; k < TableX; k++ )
610 if ( pTable[3+j*TableX+k] == -ABC_INFINITY )
611 printf( "%5s", "-" );
612 else
613 printf( "%5.0f", pTable[3+j*TableX+k] );
614 if ( i == 7 )
615 break;
616 }
617 printf( "\n" );
618}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tim_ManPrintBoxCopy()

void Tim_ManPrintBoxCopy ( Tim_Man_t * p)
extern

Definition at line 619 of file timMan.c.

620{
621 Tim_Box_t * pBox;
622 int i;
623 if ( p == NULL )
624 return;
625 printf( "TIMING MANAGER:\n" );
626 printf( "PI = %d. CI = %d. PO = %d. CO = %d. Box = %d.\n",
628
629 if ( Tim_ManBoxNum(p) > 0 )
630 Tim_ManForEachBox( p, pBox, i )
631 printf( "%d ", pBox->iCopy );
632 printf( "\n" );
633}
Here is the call graph for this function:

◆ Tim_ManPrintStats()

void Tim_ManPrintStats ( Tim_Man_t * p,
int nAnd2Delay )
extern

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

Synopsis [Prints statistics of the timing manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 646 of file timMan.c.

647{
648 Tim_Box_t * pBox;
649 Vec_Int_t * vCounts;
650 Vec_Ptr_t * vBoxes;
651 int i, Count, IdMax;
652 if ( p == NULL )
653 return;
654 Abc_Print( 1, "Hierarchy : " );
655 printf( "PI/CI = %d/%d PO/CO = %d/%d Box = %d ",
658 Tim_ManBoxNum(p) );
659 if ( nAnd2Delay )
660 printf( "delay(AND2) = %d", nAnd2Delay );
661 printf( "\n" );
662 if ( Tim_ManBoxNum(p) == 0 )
663 return;
664 IdMax = 0;
665 Tim_ManForEachBox( p, pBox, i )
666 IdMax = Abc_MaxInt( IdMax, pBox->iDelayTable );
667 vCounts = Vec_IntStart( IdMax+1 );
668 vBoxes = Vec_PtrStart( IdMax+1 );
669 Tim_ManForEachBox( p, pBox, i )
670 {
671 Vec_IntAddToEntry( vCounts, pBox->iDelayTable, 1 );
672 Vec_PtrWriteEntry( vBoxes, pBox->iDelayTable, pBox );
673 }
674 // print statistics about boxes
675 Vec_IntForEachEntry( vCounts, Count, i )
676 {
677 if ( Count == 0 ) continue;
678 pBox = (Tim_Box_t *)Vec_PtrEntry( vBoxes, i );
679 printf( " Box %4d ", i );
680 printf( "Num = %4d ", Count );
681 printf( "Ins = %4d ", pBox->nInputs );
682 printf( "Outs = %4d", pBox->nOutputs );
683 printf( "\n" );
684 }
685 Vec_IntFree( vCounts );
686 Vec_PtrFree( vBoxes );
687}
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
Here is the call graph for this function:

◆ Tim_ManReduce()

Tim_Man_t * Tim_ManReduce ( Tim_Man_t * p,
Vec_Int_t * vBoxesLeft,
int nTermsDiff )
extern

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

Synopsis [Reduces the timing manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 254 of file timMan.c.

255{
256 Tim_Man_t * pNew;
257 Tim_Box_t * pBox;
258 Tim_Obj_t * pObj;
259 float * pDelayTable, * pDelayTableNew;
260 int i, k, iBox, nNewCis, nNewCos, nInputs, nOutputs;
261 int nNewPiNum = Tim_ManPiNum(p) - nTermsDiff;
262 int nNewPoNum = Tim_ManPoNum(p) - nTermsDiff;
263 assert( Vec_IntSize(vBoxesLeft) <= Tim_ManBoxNum(p) );
264 // count the number of CIs and COs in the trimmed manager
265 nNewCis = nNewPiNum;
266 nNewCos = nNewPoNum;
267 Vec_IntForEachEntry( vBoxesLeft, iBox, i )
268 {
269 pBox = Tim_ManBox( p, iBox );
270 nNewCis += pBox->nOutputs;
271 nNewCos += pBox->nInputs;
272 }
273 assert( nNewCis <= Tim_ManCiNum(p) - nTermsDiff );
274 assert( nNewCos <= Tim_ManCoNum(p) - nTermsDiff );
275 // clear traversal IDs
276 Tim_ManForEachCi( p, pObj, i )
277 pObj->TravId = 0;
278 Tim_ManForEachCo( p, pObj, i )
279 pObj->TravId = 0;
280 // create new manager
281 pNew = Tim_ManStart( nNewCis, nNewCos );
282 // copy box connectivity information
283 memcpy( pNew->pCis, p->pCis, sizeof(Tim_Obj_t) * nNewPiNum );
284 memcpy( pNew->pCos + nNewCos - nNewPoNum,
285 p->pCos + Tim_ManCoNum(p) - Tim_ManPoNum(p),
286 sizeof(Tim_Obj_t) * nNewPoNum );
287 // duplicate delay tables
288 if ( Tim_ManDelayTableNum(p) > 0 )
289 {
290 int fWarning = 0;
291 pNew->vDelayTables = Vec_PtrStart( Vec_PtrSize(p->vDelayTables) );
292 Tim_ManForEachTable( p, pDelayTable, i )
293 {
294 if ( pDelayTable == NULL )
295 continue;
296 if ( i != (int)pDelayTable[0] && fWarning == 0 )
297 {
298 printf( "Warning: Mismatch in delay-table number between the manager and the box.\n" );
299 fWarning = 1;
300 }
301 //assert( i == (int)pDelayTable[0] );
302 nInputs = (int)pDelayTable[1];
303 nOutputs = (int)pDelayTable[2];
304 pDelayTableNew = ABC_ALLOC( float, 3 + nInputs * nOutputs );
305 pDelayTableNew[0] = i;//(int)pDelayTable[0];
306 pDelayTableNew[1] = (int)pDelayTable[1];
307 pDelayTableNew[2] = (int)pDelayTable[2];
308 for ( k = 0; k < nInputs * nOutputs; k++ )
309 pDelayTableNew[3+k] = pDelayTable[3+k];
310// assert( (int)pDelayTableNew[0] == Vec_PtrSize(pNew->vDelayTables) );
311 assert( Vec_PtrEntry(pNew->vDelayTables, i) == NULL );
312 Vec_PtrWriteEntry( pNew->vDelayTables, i, pDelayTableNew );
313 }
314 }
315 // duplicate boxes
316 if ( Tim_ManBoxNum(p) > 0 )
317 {
318 int curPi = nNewPiNum;
319 int curPo = 0;
320 pNew->vBoxes = Vec_PtrAlloc( Tim_ManBoxNum(p) );
321 Vec_IntForEachEntry( vBoxesLeft, iBox, i )
322 {
323 pBox = Tim_ManBox( p, iBox );
324 Tim_ManCreateBox( pNew, curPo, pBox->nInputs, curPi, pBox->nOutputs, pBox->iDelayTable, pBox->fBlack );
325 Tim_ManBoxSetCopy( pNew, Tim_ManBoxNum(pNew) - 1, Tim_ManBoxCopy(p, iBox) == -1 ? iBox : Tim_ManBoxCopy(p, iBox) );
326 curPi += pBox->nOutputs;
327 curPo += pBox->nInputs;
328 }
329 curPo += nNewPoNum;
330 assert( curPi == Tim_ManCiNum(pNew) );
331 assert( curPo == Tim_ManCoNum(pNew) );
332 }
333 return pNew;
334}
int Tim_ManCoNum(Tim_Man_t *p)
Definition timMan.c:704
int Tim_ManBoxCopy(Tim_Man_t *p, int iBox)
Definition timBox.c:275
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tim_ManSave()

Vec_Str_t * Tim_ManSave ( Tim_Man_t * p,
int fHieOnly )
extern

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
56 Vec_StrPutI_ne( vStr, TIM_DUMP_VER_NUM );
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 //Vec_StrPutI_ne( vStr, Tim_ManBoxIsBlack(p, pBox->iBox) );
74 }
75 if ( fHieOnly )
76 return vStr;
77 // save the number of delay tables
78 Vec_StrPutI_ne( vStr, Tim_ManDelayTableNum(p) );
79 // save the delay tables
80 if ( Tim_ManDelayTableNum(p) > 0 )
81 Tim_ManForEachTable( p, pDelayTable, i )
82 {
83 assert( (int)pDelayTable[0] == i );
84 // save table ID and dimensions (inputs x outputs)
85 Vec_StrPutI_ne( vStr, (int)pDelayTable[0] );
86 Vec_StrPutI_ne( vStr, (int)pDelayTable[1] );
87 Vec_StrPutI_ne( vStr, (int)pDelayTable[2] );
88 // save table contents
89 TableSize = (int)pDelayTable[1] * (int)pDelayTable[2];
90 for ( k = 0; k < TableSize; k++ )
91 Vec_StrPutF( vStr, pDelayTable[k+3] );
92 }
93 // save PI arrival times
94 Tim_ManForEachPi( p, pObj, i )
95 Vec_StrPutF( vStr, Tim_ManGetCiArrival(p, pObj->Id) );
96 // save PO required times
97 Tim_ManForEachPo( p, pObj, i )
98 Vec_StrPutF( vStr, Tim_ManGetCoRequired(p, pObj->Id) );
99 return vStr;
100}
struct Vec_Str_t_ Vec_Str_t
Definition bblif.c:46
int Id
Definition timInt.h:81
int Tim_ManPoNum(Tim_Man_t *p)
Definition timMan.c:714
float Tim_ManGetCiArrival(Tim_Man_t *p, int iCi)
Definition timTime.c:174
int Tim_ManBoxDelayTableId(Tim_Man_t *p, int iBox)
Definition timBox.c:219
float Tim_ManGetCoRequired(Tim_Man_t *p, int iCo)
Definition timTime.c:222
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tim_ManSetCiRequired()

void Tim_ManSetCiRequired ( Tim_Man_t * p,
int iCi,
float Delay )
extern

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}
Here is the caller graph for this function:

◆ Tim_ManSetCoArrival()

void Tim_ManSetCoArrival ( Tim_Man_t * p,
int iCo,
float Delay )
extern

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}
Here is the caller graph for this function:

◆ Tim_ManSetCoRequired()

void Tim_ManSetCoRequired ( Tim_Man_t * p,
int iCo,
float Delay )
extern

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}
Here is the caller graph for this function:

◆ Tim_ManSetCurrentTravIdBoxInputs()

void Tim_ManSetCurrentTravIdBoxInputs ( Tim_Man_t * p,
int iBox )
extern

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}
Here is the caller graph for this function:

◆ Tim_ManSetCurrentTravIdBoxOutputs()

void Tim_ManSetCurrentTravIdBoxOutputs ( Tim_Man_t * p,
int iBox )
extern

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}
Here is the caller graph for this function:

◆ Tim_ManSetDelayTables()

void Tim_ManSetDelayTables ( Tim_Man_t * p,
Vec_Ptr_t * vDelayTables )
extern

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 765 of file timMan.c.

766{
767 assert( p->vDelayTables == NULL );
768 p->vDelayTables = vDelayTables;
769}
Here is the caller graph for this function:

◆ Tim_ManSetPreviousTravIdBoxInputs()

void Tim_ManSetPreviousTravIdBoxInputs ( Tim_Man_t * p,
int iBox )
extern

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}
Here is the caller graph for this function:

◆ Tim_ManSetPreviousTravIdBoxOutputs()

void Tim_ManSetPreviousTravIdBoxOutputs ( Tim_Man_t * p,
int iBox )
extern

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}
Here is the caller graph for this function:

◆ Tim_ManStart()

Tim_Man_t * Tim_ManStart ( int nCis,
int nCos )
extern

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}
Mem_Flex_t * Mem_FlexStart()
Definition mem.c:327
int iObj2Box
Definition timInt.h:83
int iObj2Num
Definition timInt.h:84
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tim_ManStop()

void Tim_ManStop ( Tim_Man_t * p)
extern

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

Synopsis [Stops the timing manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 378 of file timMan.c.

379{
380 Vec_PtrFreeFree( p->vDelayTables );
381 Vec_PtrFreeP( &p->vBoxes );
382 Mem_FlexStop( p->pMemObj, 0 );
383 ABC_FREE( p->pCis );
384 ABC_FREE( p->pCos );
385 ABC_FREE( p );
386}
#define ABC_FREE(obj)
Definition abc_global.h:267
void Mem_FlexStop(Mem_Flex_t *p, int fVerbose)
Definition mem.c:359
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tim_ManStopP()

void Tim_ManStopP ( Tim_Man_t ** p)
extern

Definition at line 387 of file timMan.c.

388{
389 if ( *p == NULL )
390 return;
391 Tim_ManStop( *p );
392 *p = NULL;
393}
void Tim_ManStop(Tim_Man_t *p)
Definition timMan.c:378
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Tim_ManTravIdDisable()

void Tim_ManTravIdDisable ( Tim_Man_t * p)
extern

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

Synopsis [Disables the use of the traversal ID.]

Description []

SideEffects []

SeeAlso []

Definition at line 782 of file timMan.c.

783{
784 p->fUseTravId = 0;
785}

◆ Tim_ManTravIdEnable()

void Tim_ManTravIdEnable ( Tim_Man_t * p)
extern

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

Synopsis [Enables the use of the traversal ID.]

Description []

SideEffects []

SeeAlso []

Definition at line 798 of file timMan.c.

799{
800 p->fUseTravId = 1;
801}

◆ Tim_ManTrim()

Tim_Man_t * Tim_ManTrim ( Tim_Man_t * p,
Vec_Int_t * vBoxPres )
extern

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

Synopsis [Trims the timing manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 166 of file timMan.c.

167{
168 Tim_Man_t * pNew;
169 Tim_Box_t * pBox;
170 Tim_Obj_t * pObj;
171 float * pDelayTable, * pDelayTableNew;
172 int i, k, nNewCis, nNewCos, nInputs, nOutputs;
173 assert( Vec_IntSize(vBoxPres) == Tim_ManBoxNum(p) );
174 // count the number of CIs and COs in the trimmed manager
175 nNewCis = Tim_ManPiNum(p);
176 nNewCos = Tim_ManPoNum(p);
177 if ( Tim_ManBoxNum(p) )
178 Tim_ManForEachBox( p, pBox, i )
179 if ( Vec_IntEntry(vBoxPres, i) )
180 {
181 nNewCis += pBox->nOutputs;
182 nNewCos += pBox->nInputs;
183 }
184 if ( nNewCis == Tim_ManCiNum(p) && nNewCos == Tim_ManCoNum(p) )
185 return Tim_ManDup( p, 0 );
186 assert( nNewCis < Tim_ManCiNum(p) );
187 assert( nNewCos < Tim_ManCoNum(p) );
188 // clear traversal IDs
189 Tim_ManForEachCi( p, pObj, i )
190 pObj->TravId = 0;
191 Tim_ManForEachCo( p, pObj, i )
192 pObj->TravId = 0;
193 // create new manager
194 pNew = Tim_ManStart( nNewCis, nNewCos );
195 // copy box connectivity information
196 memcpy( pNew->pCis, p->pCis, sizeof(Tim_Obj_t) * Tim_ManPiNum(p) );
197 memcpy( pNew->pCos + nNewCos - Tim_ManPoNum(p),
198 p->pCos + Tim_ManCoNum(p) - Tim_ManPoNum(p),
199 sizeof(Tim_Obj_t) * Tim_ManPoNum(p) );
200 // duplicate delay tables
201 if ( Tim_ManDelayTableNum(p) > 0 )
202 {
203 pNew->vDelayTables = Vec_PtrStart( Vec_PtrSize(p->vDelayTables) );
204 Tim_ManForEachTable( p, pDelayTable, i )
205 {
206 if ( pDelayTable == NULL )
207 continue;
208 assert( i == (int)pDelayTable[0] );
209 nInputs = (int)pDelayTable[1];
210 nOutputs = (int)pDelayTable[2];
211 pDelayTableNew = ABC_ALLOC( float, 3 + nInputs * nOutputs );
212 pDelayTableNew[0] = (int)pDelayTable[0];
213 pDelayTableNew[1] = (int)pDelayTable[1];
214 pDelayTableNew[2] = (int)pDelayTable[2];
215 for ( k = 0; k < nInputs * nOutputs; k++ )
216 pDelayTableNew[3+k] = pDelayTable[3+k];
217// assert( (int)pDelayTableNew[0] == Vec_PtrSize(pNew->vDelayTables) );
218 assert( Vec_PtrEntry(pNew->vDelayTables, i) == NULL );
219 Vec_PtrWriteEntry( pNew->vDelayTables, i, pDelayTableNew );
220 }
221 }
222 // duplicate boxes
223 if ( Tim_ManBoxNum(p) > 0 )
224 {
225 int curPi = Tim_ManPiNum(p);
226 int curPo = 0;
227 pNew->vBoxes = Vec_PtrAlloc( Tim_ManBoxNum(p) );
228 Tim_ManForEachBox( p, pBox, i )
229 if ( Vec_IntEntry(vBoxPres, i) )
230 {
231 Tim_ManCreateBox( pNew, curPo, pBox->nInputs, curPi, pBox->nOutputs, pBox->iDelayTable, pBox->fBlack );
232 Tim_ManBoxSetCopy( pNew, Tim_ManBoxNum(pNew) - 1, Tim_ManBoxCopy(p, i) == -1 ? i : Tim_ManBoxCopy(p, i) );
233 curPi += pBox->nOutputs;
234 curPo += pBox->nInputs;
235 }
236 curPo += Tim_ManPoNum(p);
237 assert( curPi == Tim_ManCiNum(pNew) );
238 assert( curPo == Tim_ManCoNum(pNew) );
239 }
240 return pNew;
241}
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition timMan.c:86
Here is the call graph for this function:
Here is the caller graph for this function: