ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
timMan.c File Reference
#include "timInt.h"
#include "map/if/if.h"
Include dependency graph for timMan.c:

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START 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_ManStop (Tim_Man_t *p)
 
void Tim_ManStopP (Tim_Man_t **p)
 
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_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)
 

Function Documentation

◆ Tim_ManAlignTwo()

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 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 )

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)

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_ManBoxNum()

int Tim_ManBoxNum ( Tim_Man_t * p)

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_ManCiNum()

int Tim_ManCiNum ( Tim_Man_t * p)

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)

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 )

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_ManDelayTableNum()

int Tim_ManDelayTableNum ( Tim_Man_t * p)

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 )

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)

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_ManGetReqTimes()

float * Tim_ManGetReqTimes ( Tim_Man_t * p)

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_ManPiNum()

int Tim_ManPiNum ( Tim_Man_t * p)

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)

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)

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}
#define Tim_ManBoxForEachInput(p, pBox, pObj, i)
Definition timInt.h:120
#define Tim_ManBoxForEachOutput(p, pBox, pObj, i)
Definition timInt.h:122
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)

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 )

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 )

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_ManSetDelayTables()

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 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_ManStart()

ABC_NAMESPACE_IMPL_START 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}
Mem_Flex_t * Mem_FlexStart()
Definition mem.c:327
int Id
Definition timInt.h:81
int iObj2Box
Definition timInt.h:83
int iObj2Num
Definition timInt.h:84
char * memset()
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)

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)

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)

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)

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 )

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
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: