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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START void Gia_LutDelayTraceSortPins (Gia_Man_t *p, int iObj, int *pPinPerm, float *pPinDelays)
 DECLARATIONS ///.
 
int Gia_LutWhereIsPin (Gia_Man_t *p, int iFanout, int iFanin, int *pPinPerm)
 
float Gia_ObjComputeArrival (Gia_Man_t *p, int iObj, int fUseSorting)
 
float Gia_ObjPropagateRequired (Gia_Man_t *p, int iObj, int fUseSorting)
 
float Gia_ManDelayTraceLut (Gia_Man_t *p)
 
float Gia_ManDelayTraceLutPrint (Gia_Man_t *p, int fVerbose)
 
unsigned Gia_LutDelayTraceTCEdges (Gia_Man_t *p, int iObj, float tDelta)
 
int Gia_ManSpeedupObj_rec (Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
 
void Gia_ManSpeedupObj (Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vLeaves, Vec_Int_t *vTimes)
 
Gia_Man_tGia_ManSpeedup (Gia_Man_t *p, int Percentage, int Degree, int fVerbose, int fVeryVerbose)
 

Function Documentation

◆ Gia_LutDelayTraceSortPins()

ABC_NAMESPACE_IMPL_START void Gia_LutDelayTraceSortPins ( Gia_Man_t * p,
int iObj,
int * pPinPerm,
float * pPinDelays )

DECLARATIONS ///.

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

FileName [gia.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis []

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id
gia.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

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

Synopsis [Sorts the pins in the decreasing order of delays.]

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file giaSpeedup.c.

47{
48 int iFanin, i, j, best_i, temp;
49 assert( Gia_ObjIsLut(p, iObj) );
50 // start the trivial permutation and collect pin delays
51 Gia_LutForEachFanin( p, iObj, iFanin, i )
52 {
53 pPinPerm[i] = i;
54 pPinDelays[i] = Gia_ObjTimeArrival(p, iFanin);
55 }
56 // selection sort the pins in the decreasible order of delays
57 // this order will match the increasing order of LUT input pins
58 for ( i = 0; i < Gia_ObjLutSize(p, iObj)-1; i++ )
59 {
60 best_i = i;
61 for ( j = i+1; j < Gia_ObjLutSize(p, iObj); j++ )
62 if ( pPinDelays[pPinPerm[j]] > pPinDelays[pPinPerm[best_i]] )
63 best_i = j;
64 if ( best_i == i )
65 continue;
66 temp = pPinPerm[i];
67 pPinPerm[i] = pPinPerm[best_i];
68 pPinPerm[best_i] = temp;
69 }
70 // verify
71 assert( Gia_ObjLutSize(p, iObj) == 0 || pPinPerm[0] < Gia_ObjLutSize(p, iObj) );
72 for ( i = 1; i < Gia_ObjLutSize(p, iObj); i++ )
73 {
74 assert( pPinPerm[i] < Gia_ObjLutSize(p, iObj) );
75 assert( pPinDelays[pPinPerm[i-1]] >= pPinDelays[pPinPerm[i]] );
76 }
77}
Cube * p
Definition exorList.c:222
#define Gia_LutForEachFanin(p, i, iFan, k)
Definition gia.h:1161
#define assert(ex)
Definition util_old.h:213
Here is the caller graph for this function:

◆ Gia_LutDelayTraceTCEdges()

unsigned Gia_LutDelayTraceTCEdges ( Gia_Man_t * p,
int iObj,
float tDelta )

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

Synopsis [Determines timing-critical edges of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 502 of file giaSpeedup.c.

503{
504 If_LibLut_t * pLutLib = (If_LibLut_t *)p->pLutLib;
505 int pPinPerm[32];
506 float pPinDelays[32];
507 float tRequired, * pDelays;
508 unsigned uResult = 0;
509 int k, iFanin;
510 tRequired = Gia_ObjTimeRequired( p, iObj );
511 if ( pLutLib == NULL )
512 {
513 Gia_LutForEachFanin( p, iObj, iFanin, k )
514 if ( tRequired < Gia_ObjTimeArrival(p, iFanin) + 1.0 + tDelta )
515 uResult |= (1 << k);
516 }
517 else if ( !pLutLib->fVarPinDelays )
518 {
519 pDelays = pLutLib->pLutDelays[Gia_ObjLutSize(p, iObj)];
520 Gia_LutForEachFanin( p, iObj, iFanin, k )
521 if ( tRequired < Gia_ObjTimeArrival(p, iFanin) + pDelays[0] + tDelta )
522 uResult |= (1 << k);
523 }
524 else
525 {
526 pDelays = pLutLib->pLutDelays[Gia_ObjLutSize(p, iObj)];
527 Gia_LutDelayTraceSortPins( p, iObj, pPinPerm, pPinDelays );
528 Gia_LutForEachFanin( p, iObj, iFanin, k )
529 if ( tRequired < Gia_ObjTimeArrival( p, Gia_ObjLutFanin(p, iObj,pPinPerm[k])) + pDelays[k] + tDelta )
530 uResult |= (1 << pPinPerm[k]);
531 }
532 return uResult;
533}
ABC_NAMESPACE_IMPL_START void Gia_LutDelayTraceSortPins(Gia_Man_t *p, int iObj, int *pPinPerm, float *pPinDelays)
DECLARATIONS ///.
Definition giaSpeedup.c:46
struct If_LibLut_t_ If_LibLut_t
Definition if.h:82
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_LutWhereIsPin()

int Gia_LutWhereIsPin ( Gia_Man_t * p,
int iFanout,
int iFanin,
int * pPinPerm )

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

Synopsis [Sorts the pins in the decreasing order of delays.]

Description []

SideEffects []

SeeAlso []

Definition at line 90 of file giaSpeedup.c.

91{
92 int i;
93 for ( i = 0; i < Gia_ObjLutSize(p, iFanout); i++ )
94 if ( Gia_ObjLutFanin(p, iFanout, pPinPerm[i]) == iFanin )
95 return i;
96 return -1;
97}

◆ Gia_ManDelayTraceLut()

float Gia_ManDelayTraceLut ( Gia_Man_t * p)

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

Synopsis [Computes the delay trace of the given network.]

Description []

SideEffects []

SeeAlso []

Definition at line 230 of file giaSpeedup.c.

231{
232 int fUseSorting = 1;
233 If_LibLut_t * pLutLib = (If_LibLut_t *)p->pLutLib;
234 Vec_Int_t * vObjs;
235 Gia_Obj_t * pObj;
236 float tArrival, tArrivalCur, tRequired, tSlack;
237 int i, iObj;
238
239 // get the library
240 if ( pLutLib && pLutLib->LutMax < Gia_ManLutSizeMax(p) )
241 {
242 printf( "The max LUT size (%d) is less than the max fanin count (%d).\n",
243 pLutLib->LutMax, Gia_ManLutSizeMax(p) );
244 return -TIM_ETERNITY;
245 }
246
247 // initialize the arrival times
248 Gia_ManTimeStart( p );
250
251 // propagate arrival times
252 if ( p->pManTime )
253 Tim_ManIncrementTravId( (Tim_Man_t *)p->pManTime );
254 Gia_ManForEachObj( p, pObj, i )
255 {
256 if ( !Gia_ObjIsCi(pObj) && !Gia_ObjIsCo(pObj) && !Gia_ObjIsLut(p, i) )
257 continue;
258 tArrival = Gia_ObjComputeArrival( p, i, fUseSorting );
259 if ( Gia_ObjIsCi(pObj) && p->pManTime )
260 {
261 tArrival = Tim_ManGetCiArrival( (Tim_Man_t *)p->pManTime, Gia_ObjCioId(pObj) );
262//printf( "%.3f ", tArrival );
263 }
264 if ( Gia_ObjIsCo(pObj) && p->pManTime )
265 Tim_ManSetCoArrival( (Tim_Man_t *)p->pManTime, Gia_ObjCioId(pObj), tArrival );
266 Gia_ObjSetTimeArrival( p, i, tArrival );
267 }
268
269 // get the latest arrival times
270 tArrival = -TIM_ETERNITY;
271 Gia_ManForEachCo( p, pObj, i )
272 {
273 tArrivalCur = Gia_ObjTimeArrivalObj( p, Gia_ObjFanin0(pObj) );
274 Gia_ObjSetTimeArrival( p, Gia_ObjId(p,pObj), tArrivalCur );
275 if ( tArrival < tArrivalCur )
276 tArrival = tArrivalCur;
277 }
278
279 // initialize the required times
280 if ( p->pManTime )
281 {
282 Tim_ManIncrementTravId( (Tim_Man_t *)p->pManTime );
283 Tim_ManInitPoRequiredAll( (Tim_Man_t *)p->pManTime, tArrival );
284 }
285 else
286 {
287 Gia_ManForEachCo( p, pObj, i )
288 Gia_ObjSetTimeRequiredObj( p, pObj, tArrival );
289 }
290
291 // propagate the required times
292 vObjs = Gia_ManOrderReverse( p );
293 Vec_IntForEachEntry( vObjs, iObj, i )
294 {
295 pObj = Gia_ManObj(p, iObj);
296 if ( Gia_ObjIsLut(p, iObj) )
297 {
298 Gia_ObjPropagateRequired( p, iObj, fUseSorting );
299 }
300 else if ( Gia_ObjIsCi(pObj) )
301 {
302 if ( p->pManTime )
303 Tim_ManSetCiRequired( (Tim_Man_t *)p->pManTime, Gia_ObjCioId(pObj), Gia_ObjTimeRequired(p, iObj) );
304 }
305 else if ( Gia_ObjIsCo(pObj) )
306 {
307 if ( p->pManTime )
308 {
309 tRequired = Tim_ManGetCoRequired( (Tim_Man_t *)p->pManTime, Gia_ObjCioId(pObj) );
310 Gia_ObjSetTimeRequired( p, iObj, tRequired );
311 }
312 if ( Gia_ObjTimeRequired(p, Gia_ObjFaninId0p(p, pObj)) > Gia_ObjTimeRequired(p, iObj) )
313 Gia_ObjSetTimeRequired(p, Gia_ObjFaninId0p(p, pObj), Gia_ObjTimeRequired(p, iObj) );
314 }
315
316 // set slack for this object
317 tSlack = Gia_ObjTimeRequired(p, iObj) - Gia_ObjTimeArrival(p, iObj);
318 assert( tSlack + 0.01 > 0.0 );
319 Gia_ObjSetTimeSlack( p, iObj, tSlack < 0.0 ? 0.0 : tSlack );
320 }
321 Vec_IntFree( vObjs );
322 return tArrival;
323}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
float Gia_ObjComputeArrival(Gia_Man_t *p, int iObj, int fUseSorting)
Definition giaSpeedup.c:110
float Gia_ObjPropagateRequired(Gia_Man_t *p, int iObj, int fUseSorting)
Definition giaSpeedup.c:170
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
Vec_Int_t * Gia_ManOrderReverse(Gia_Man_t *p)
Definition giaDfs.c:459
int Gia_ManLutSizeMax(Gia_Man_t *p)
Definition giaIf.c:127
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition gia.h:1190
#define Gia_ManForEachCo(p, pObj, i)
Definition gia.h:1236
int Gia_ManLevelNum(Gia_Man_t *p)
Definition giaUtil.c:546
void Tim_ManSetCoArrival(Tim_Man_t *p, int iCo, float Delay)
Definition timTime.c:116
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition tim.h:92
void Tim_ManIncrementTravId(Tim_Man_t *p)
DECLARATIONS ///.
Definition timTrav.c:44
void Tim_ManSetCiRequired(Tim_Man_t *p, int iCi, float Delay)
Definition timTime.c:135
void Tim_ManInitPoRequiredAll(Tim_Man_t *p, float Delay)
Definition timTime.c:97
#define TIM_ETERNITY
MACRO DEFINITIONS ///.
Definition tim.h:98
float Tim_ManGetCiArrival(Tim_Man_t *p, int iCi)
Definition timTime.c:174
float Tim_ManGetCoRequired(Tim_Man_t *p, int iCo)
Definition timTime.c:222
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManDelayTraceLutPrint()

float Gia_ManDelayTraceLutPrint ( Gia_Man_t * p,
int fVerbose )

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

Synopsis [Prints the delay trace for the given network.]

Description []

SideEffects []

SeeAlso []

Definition at line 444 of file giaSpeedup.c.

445{
446 If_LibLut_t * pLutLib = (If_LibLut_t *)p->pLutLib;
447 int i, Nodes, * pCounters;
448 float tArrival, tDelta, nSteps, Num;
449 // get the library
450 if ( pLutLib && pLutLib->LutMax < Gia_ManLutSizeMax(p) )
451 {
452 printf( "The max LUT size (%d) is less than the max fanin count (%d).\n",
453 pLutLib->LutMax, Gia_ManLutSizeMax(p) );
454 return -ABC_INFINITY;
455 }
456 // decide how many steps
457 nSteps = pLutLib ? 20 : Gia_ManLutLevel(p, NULL);
458 pCounters = ABC_ALLOC( int, nSteps + 1 );
459 memset( pCounters, 0, sizeof(int)*(nSteps + 1) );
460 // perform delay trace
461 tArrival = Gia_ManDelayTraceLut( p );
462 tDelta = tArrival / nSteps;
463 // count how many nodes have slack in the corresponding intervals
464 Gia_ManForEachLut( p, i )
465 {
466 if ( Gia_ObjLutSize(p, i) == 0 )
467 continue;
468 Num = Gia_ObjTimeSlack(p, i) / tDelta;
469 if ( Num > nSteps )
470 continue;
471 assert( Num >=0 && Num <= nSteps );
472 pCounters[(int)Num]++;
473 }
474 // print the results
475 if ( fVerbose )
476 {
477 printf( "Max delay = %6.2f. Delay trace using %s model:\n", tArrival, pLutLib? "LUT library" : "unit-delay" );
478 Nodes = 0;
479 for ( i = 0; i < nSteps; i++ )
480 {
481 Nodes += pCounters[i];
482 printf( "%3d %s : %5d (%6.2f %%)\n", pLutLib? 5*(i+1) : i+1,
483 pLutLib? "%":"lev", Nodes, 100.0*Nodes/Gia_ManLutNum(p) );
484 }
485 }
486 ABC_FREE( pCounters );
487 Gia_ManTimeStop( p );
488 return tArrival;
489}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition abc_global.h:250
#define ABC_FREE(obj)
Definition abc_global.h:267
float Gia_ManDelayTraceLut(Gia_Man_t *p)
Definition giaSpeedup.c:230
int Gia_ManLutLevel(Gia_Man_t *p, int **ppLevels)
Definition giaIf.c:165
#define Gia_ManForEachLut(p, i)
Definition gia.h:1157
int Gia_ManLutNum(Gia_Man_t *p)
Definition giaIf.c:146
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSpeedup()

Gia_Man_t * Gia_ManSpeedup ( Gia_Man_t * p,
int Percentage,
int Degree,
int fVerbose,
int fVeryVerbose )

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

Synopsis [Adds choices to speed up the network by the given percentage.]

Description []

SideEffects []

SeeAlso []

Definition at line 629 of file giaSpeedup.c.

630{
631 Gia_Man_t * pNew, * pTemp;
632 Vec_Int_t * vTimeCries, * vTimeFanins;
633 int iObj, iFanin, iFanin2, nNodesNew;
634 float tDelta, tArrival;
635 int i, k, k2, Counter, CounterRes, nTimeCris;
636 int fUseLutLib = (p->pLutLib != NULL);
637 void * pTempTim = NULL;
638 unsigned * puTCEdges;
639 assert( Gia_ManHasMapping(p) );
640 if ( !fUseLutLib && p->pManTime )
641 {
642 pTempTim = p->pManTime;
643 p->pManTime = Tim_ManDup( (Tim_Man_t *)pTempTim, 1 );
644 }
645 // perform delay trace
646 tArrival = Gia_ManDelayTraceLut( p );
647 tDelta = fUseLutLib ? tArrival*Percentage/100.0 : 1.0;
648 if ( fVerbose )
649 {
650 printf( "Max delay = %.2f. Delta = %.2f. ", tArrival, tDelta );
651 printf( "Using %s model. ", fUseLutLib ? "LUT library" : "unit-delay" );
652 if ( fUseLutLib )
653 printf( "Percentage = %d. ", Percentage );
654 printf( "\n" );
655 }
656 // mark the timing critical nodes and edges
657 puTCEdges = ABC_CALLOC( unsigned, Gia_ManObjNum(p) );
658 Gia_ManForEachLut( p, iObj )
659 {
660 if ( Gia_ObjTimeSlack(p, iObj) >= tDelta )
661 continue;
662 puTCEdges[iObj] = Gia_LutDelayTraceTCEdges( p, iObj, tDelta );
663 }
664 if ( fVerbose )
665 {
666 Counter = CounterRes = 0;
667 Gia_ManForEachLut( p, iObj )
668 {
669 Gia_LutForEachFanin( p, iObj, iFanin, k )
670 if ( !Gia_ObjIsCi(Gia_ManObj(p, iFanin)) && Gia_ObjTimeSlack(p, iFanin) < tDelta )
671 Counter++;
672 CounterRes += Gia_WordCountOnes( puTCEdges[iObj] );
673 }
674 printf( "Edges: Total = %7d. 0-slack = %7d. Critical = %7d. Ratio = %4.2f\n",
675 Gia_ManLutFaninCount(p), Counter, CounterRes, Counter? 1.0*CounterRes/Counter : 0.0 );
676 }
677
678 // start the resulting network
679 pNew = Gia_ManDup( p );
680 Gia_ManHashStart( pNew );
681 nNodesNew = 1000 + 3 * Gia_ManObjNum(pNew);
682 pNew->pNexts = ABC_CALLOC( int, nNodesNew );
683 pNew->pReprs = ABC_CALLOC( Gia_Rpr_t, nNodesNew );
684 for ( i = 0; i < nNodesNew; i++ )
685 Gia_ObjSetRepr( pNew, i, GIA_VOID );
686
687 // collect nodes to be used for resynthesis
688 Counter = CounterRes = 0;
689 vTimeCries = Vec_IntAlloc( 16 );
690 vTimeFanins = Vec_IntAlloc( 16 );
691 Gia_ManForEachLut( p, iObj )
692 {
693 if ( Gia_ObjTimeSlack(p, iObj) >= tDelta )
694 continue;
695 // count the number of non-PI timing-critical nodes
696 nTimeCris = 0;
697 Gia_LutForEachFanin( p, iObj, iFanin, k )
698 if ( !Gia_ObjIsCi(Gia_ManObj(p, iFanin)) && (puTCEdges[iObj] & (1<<k)) )
699 nTimeCris++;
700 if ( !fVeryVerbose && nTimeCris == 0 )
701 continue;
702 Counter++;
703 // count the total number of timing critical second-generation nodes
704 Vec_IntClear( vTimeCries );
705 if ( nTimeCris )
706 {
707 Gia_LutForEachFanin( p, iObj, iFanin, k )
708 if ( !Gia_ObjIsCi(Gia_ManObj(p, iFanin)) && (puTCEdges[iObj] & (1<<k)) )
709 Gia_LutForEachFanin( p, iFanin, iFanin2, k2 )
710 if ( puTCEdges[iFanin] & (1<<k2) )
711 Vec_IntPushUnique( vTimeCries, iFanin2 );
712 }
713// if ( !fVeryVerbose && (Vec_IntSize(vTimeCries) == 0 || Vec_IntSize(vTimeCries) > Degree) )
714 if ( (Vec_IntSize(vTimeCries) == 0 || Vec_IntSize(vTimeCries) > Degree) )
715 continue;
716 CounterRes++;
717 // collect second generation nodes
718 Vec_IntClear( vTimeFanins );
719 Gia_LutForEachFanin( p, iObj, iFanin, k )
720 {
721 if ( Gia_ObjIsCi(Gia_ManObj(p, iFanin)) )
722 Vec_IntPushUnique( vTimeFanins, iFanin );
723 else
724 Gia_LutForEachFanin( p, iFanin, iFanin2, k2 )
725 Vec_IntPushUnique( vTimeFanins, iFanin2 );
726 }
727 // print the results
728 if ( fVeryVerbose )
729 {
730 printf( "%5d Node %5d : %d %2d %2d ", Counter, iObj,
731 nTimeCris, Vec_IntSize(vTimeCries), Vec_IntSize(vTimeFanins) );
732 Gia_LutForEachFanin( p, iObj, iFanin, k )
733 printf( "%d(%.2f)%s ", iFanin, Gia_ObjTimeSlack(p, iFanin), (puTCEdges[iObj] & (1<<k))? "*":"" );
734 printf( "\n" );
735 }
736 // add the node to choices
737 if ( Vec_IntSize(vTimeCries) == 0 || Vec_IntSize(vTimeCries) > Degree )
738 continue;
739 // order the fanins in the increasing order of criticalily
740 if ( Vec_IntSize(vTimeCries) > 1 )
741 {
742 iFanin = Vec_IntEntry( vTimeCries, 0 );
743 iFanin2 = Vec_IntEntry( vTimeCries, 1 );
744 if ( Gia_ObjTimeSlack(p, iFanin) < Gia_ObjTimeSlack(p, iFanin2) )
745 {
746 Vec_IntWriteEntry( vTimeCries, 0, iFanin2 );
747 Vec_IntWriteEntry( vTimeCries, 1, iFanin );
748 }
749 }
750 if ( Vec_IntSize(vTimeCries) > 2 )
751 {
752 iFanin = Vec_IntEntry( vTimeCries, 1 );
753 iFanin2 = Vec_IntEntry( vTimeCries, 2 );
754 if ( Gia_ObjTimeSlack(p, iFanin) < Gia_ObjTimeSlack(p, iFanin2) )
755 {
756 Vec_IntWriteEntry( vTimeCries, 1, iFanin2 );
757 Vec_IntWriteEntry( vTimeCries, 2, iFanin );
758 }
759 iFanin = Vec_IntEntry( vTimeCries, 0 );
760 iFanin2 = Vec_IntEntry( vTimeCries, 1 );
761 if ( Gia_ObjTimeSlack(p, iFanin) < Gia_ObjTimeSlack(p, iFanin2) )
762 {
763 Vec_IntWriteEntry( vTimeCries, 0, iFanin2 );
764 Vec_IntWriteEntry( vTimeCries, 1, iFanin );
765 }
766 }
767 // add choice
768 Gia_ManSpeedupObj( pNew, p, Gia_ManObj(p,iObj), vTimeFanins, vTimeCries );
769 // quit if the number of nodes is large
770 if ( Gia_ManObjNum(pNew) > nNodesNew - 100 )
771 {
772 printf( "Speedup stopped adding choices because there was too many to add.\n" );
773 break;
774 }
775 }
776 Gia_ManTimeStop( p );
777 Vec_IntFree( vTimeCries );
778 Vec_IntFree( vTimeFanins );
779 ABC_FREE( puTCEdges );
780 if ( fVerbose )
781 printf( "Nodes: Total = %7d. 0-slack = %7d. Workable = %7d. Ratio = %4.2f\n",
782 Gia_ManLutNum(p), Counter, CounterRes, Counter? 1.0*CounterRes/Counter : 0.0 );
783 if ( pTempTim )
784 {
785 Tim_ManStop( (Tim_Man_t *)p->pManTime );
786 p->pManTime = pTempTim;
787 }
788 // derive AIG with choices
789//Gia_ManPrintStats( pNew, 0 );
790 pTemp = Gia_ManEquivToChoices( pNew, 1 );
791 Gia_ManStop( pNew );
792//Gia_ManPrintStats( pTemp, 0 );
793// pNew = Gia_ManDupOrderDfsChoices( pTemp );
794// Gia_ManStop( pTemp );
795//Gia_ManPrintStats( pNew, 0 );
796// return pNew;
797 return pTemp;
798}
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
unsigned Gia_LutDelayTraceTCEdges(Gia_Man_t *p, int iObj, float tDelta)
Definition giaSpeedup.c:502
void Gia_ManSpeedupObj(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vLeaves, Vec_Int_t *vTimes)
Definition giaSpeedup.c:573
struct Gia_Rpr_t_ Gia_Rpr_t
Definition gia.h:57
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition giaDup.c:720
int Gia_ManLutFaninCount(Gia_Man_t *p)
Definition giaIf.c:108
void Gia_ManHashStart(Gia_Man_t *p)
Definition giaHash.c:125
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
Gia_Man_t * Gia_ManEquivToChoices(Gia_Man_t *p, int nSnapshots)
Definition giaEquiv.c:2034
#define GIA_VOID
Definition gia.h:46
Gia_Rpr_t * pReprs
Definition gia.h:126
int * pNexts
Definition gia.h:127
void Tim_ManStop(Tim_Man_t *p)
Definition timMan.c:378
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition timMan.c:86
Here is the call graph for this function:

◆ Gia_ManSpeedupObj()

void Gia_ManSpeedupObj ( Gia_Man_t * pNew,
Gia_Man_t * p,
Gia_Obj_t * pObj,
Vec_Int_t * vLeaves,
Vec_Int_t * vTimes )

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

Synopsis [Adds strashed nodes for one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 573 of file giaSpeedup.c.

574{
575 Vec_Int_t * vNodes;
576 Gia_Obj_t * pTemp = NULL;
577 int pCofs[32], nCofs, nSkip, i, k, iResult, iObj;
578 // mark the leaves
580 Gia_ObjSetTravIdCurrent( p, Gia_ManConst0(p) );
581 Gia_ManForEachObjVec( vLeaves, p, pTemp, i )
582 Gia_ObjSetTravIdCurrent( p, pTemp );
583 // collect the AIG nodes
584 vNodes = Vec_IntAlloc( 100 );
585 if ( !Gia_ManSpeedupObj_rec( p, pObj, vNodes ) )
586 {
587 printf( "Bad node!!!\n" );
588 Vec_IntFree( vNodes );
589 return;
590 }
591 // derive cofactors
592 nCofs = (1 << Vec_IntSize(vTimes));
593 for ( i = 0; i < nCofs; i++ )
594 {
595 Gia_ManForEachObjVec( vLeaves, p, pTemp, k )
596 pTemp->Value = Abc_Var2Lit( Gia_ObjId(p, pTemp), 0 );
597 Gia_ManForEachObjVec( vTimes, p, pTemp, k )
598 pTemp->Value = ((i & (1<<k)) != 0);
599 Gia_ManForEachObjVec( vNodes, p, pTemp, k )
600 pTemp->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pTemp), Gia_ObjFanin1Copy(pTemp) );
601 pCofs[i] = pTemp->Value;
602 }
603 Vec_IntFree( vNodes );
604 // collect the resulting tree
605 Gia_ManForEachObjVec( vTimes, p, pTemp, k )
606 for ( nSkip = (1<<k), i = 0; i < nCofs; i += 2*nSkip )
607 pCofs[i] = Gia_ManHashMux( pNew, Gia_ObjToLit(p,pTemp), pCofs[i+nSkip], pCofs[i] );
608 // create choice node (pObj is repr and ppCofs[0] is new)
609 iObj = Gia_ObjId( p, pObj );
610 iResult = Abc_Lit2Var( pCofs[0] );
611 if ( iResult <= iObj )
612 return;
613 Gia_ObjSetRepr( pNew, iResult, iObj );
614 Gia_ObjSetNext( pNew, iResult, Gia_ObjNext(pNew, iObj) );
615 Gia_ObjSetNext( pNew, iObj, iResult );
616}
int Gia_ManSpeedupObj_rec(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vNodes)
Definition giaSpeedup.c:546
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
Definition gia.h:1194
int Gia_ManHashMux(Gia_Man_t *p, int iCtrl, int iData1, int iData0)
Definition giaHash.c:692
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:576
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition giaUtil.c:190
unsigned Value
Definition gia.h:89
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManSpeedupObj_rec()

int Gia_ManSpeedupObj_rec ( Gia_Man_t * p,
Gia_Obj_t * pObj,
Vec_Int_t * vNodes )

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

Synopsis [Adds strashed nodes for one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 546 of file giaSpeedup.c.

547{
548 if ( Gia_ObjIsTravIdCurrent(p, pObj) )
549 return 1;
550 Gia_ObjSetTravIdCurrent( p, pObj );
551 if ( Gia_ObjIsCi(pObj) )
552 return 0;
553 assert( Gia_ObjIsAnd(pObj) );
554 if ( !Gia_ManSpeedupObj_rec( p, Gia_ObjFanin0(pObj), vNodes ) )
555 return 0;
556 if ( !Gia_ManSpeedupObj_rec( p, Gia_ObjFanin1(pObj), vNodes ) )
557 return 0;
558 Vec_IntPush( vNodes, Gia_ObjId(p, pObj) );
559 return 1;
560}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ObjComputeArrival()

float Gia_ObjComputeArrival ( Gia_Man_t * p,
int iObj,
int fUseSorting )

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

Synopsis [Computes the arrival times for the given object.]

Description []

SideEffects []

SeeAlso []

Definition at line 110 of file giaSpeedup.c.

111{
112 If_LibLut_t * pLutLib = (If_LibLut_t *)p->pLutLib;
113 Gia_Obj_t * pObj = Gia_ManObj( p, iObj );
114 int k, iFanin, pPinPerm[32];
115 float pPinDelays[32];
116 float tArrival, * pDelays;
117 if ( Gia_ObjIsCi(pObj) )
118 return Gia_ObjTimeArrival(p, iObj);
119 if ( Gia_ObjIsCo(pObj) )
120 return Gia_ObjTimeArrival(p, Gia_ObjFaninId0p(p, pObj) );
121 assert( Gia_ObjIsLut(p, iObj) );
122 tArrival = -TIM_ETERNITY;
123 if ( pLutLib == NULL )
124 {
125 Gia_LutForEachFanin( p, iObj, iFanin, k )
126 if ( tArrival < Gia_ObjTimeArrival(p, iFanin) + 1.0 )
127 tArrival = Gia_ObjTimeArrival(p, iFanin) + 1.0;
128 }
129 else if ( !pLutLib->fVarPinDelays )
130 {
131 pDelays = pLutLib->pLutDelays[Gia_ObjLutSize(p, iObj)];
132 Gia_LutForEachFanin( p, iObj, iFanin, k )
133 if ( tArrival < Gia_ObjTimeArrival(p, iFanin) + pDelays[0] )
134 tArrival = Gia_ObjTimeArrival(p, iFanin) + pDelays[0];
135 }
136 else
137 {
138 pDelays = pLutLib->pLutDelays[Gia_ObjLutSize(p, iObj)];
139 if ( fUseSorting )
140 {
141 Gia_LutDelayTraceSortPins( p, iObj, pPinPerm, pPinDelays );
142 Gia_LutForEachFanin( p, iObj, iFanin, k )
143 if ( tArrival < Gia_ObjTimeArrival( p, Gia_ObjLutFanin(p,iObj,pPinPerm[k])) + pDelays[k] )
144 tArrival = Gia_ObjTimeArrival( p, Gia_ObjLutFanin(p,iObj,pPinPerm[k])) + pDelays[k];
145 }
146 else
147 {
148 Gia_LutForEachFanin( p, iObj, iFanin, k )
149 if ( tArrival < Gia_ObjTimeArrival(p, iFanin) + pDelays[k] )
150 tArrival = Gia_ObjTimeArrival(p, iFanin) + pDelays[k];
151 }
152 }
153 if ( Gia_ObjLutSize(p, iObj) == 0 )
154 tArrival = 0.0;
155 return tArrival;
156}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ObjPropagateRequired()

float Gia_ObjPropagateRequired ( Gia_Man_t * p,
int iObj,
int fUseSorting )

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

Synopsis [Propagates the required times through the given node.]

Description []

SideEffects []

SeeAlso []

Definition at line 170 of file giaSpeedup.c.

171{
172 If_LibLut_t * pLutLib = (If_LibLut_t *)p->pLutLib;
173 int k, iFanin, pPinPerm[32];
174 float pPinDelays[32];
175 float tRequired = 0.0; // Suppress "might be used uninitialized"
176 float * pDelays;
177 assert( Gia_ObjIsLut(p, iObj) );
178 if ( pLutLib == NULL )
179 {
180 tRequired = Gia_ObjTimeRequired( p, iObj) - (float)1.0;
181 Gia_LutForEachFanin( p, iObj, iFanin, k )
182 if ( Gia_ObjTimeRequired(p, iFanin) > tRequired )
183 Gia_ObjSetTimeRequired( p, iFanin, tRequired );
184 }
185 else if ( !pLutLib->fVarPinDelays )
186 {
187 pDelays = pLutLib->pLutDelays[Gia_ObjLutSize(p, iObj)];
188 tRequired = Gia_ObjTimeRequired(p, iObj) - pDelays[0];
189 Gia_LutForEachFanin( p, iObj, iFanin, k )
190 if ( Gia_ObjTimeRequired(p, iFanin) > tRequired )
191 Gia_ObjSetTimeRequired( p, iFanin, tRequired );
192 }
193 else
194 {
195 pDelays = pLutLib->pLutDelays[Gia_ObjLutSize(p, iObj)];
196 if ( fUseSorting )
197 {
198 Gia_LutDelayTraceSortPins( p, iObj, pPinPerm, pPinDelays );
199 Gia_LutForEachFanin( p, iObj, iFanin, k )
200 {
201 tRequired = Gia_ObjTimeRequired( p, iObj) - pDelays[k];
202 if ( Gia_ObjTimeRequired( p, Gia_ObjLutFanin(p, iObj,pPinPerm[k])) > tRequired )
203 Gia_ObjSetTimeRequired( p, Gia_ObjLutFanin(p, iObj,pPinPerm[k]), tRequired );
204 }
205 }
206 else
207 {
208 Gia_LutForEachFanin( p, iObj, iFanin, k )
209 {
210 tRequired = Gia_ObjTimeRequired(p, iObj) - pDelays[k];
211 if ( Gia_ObjTimeRequired(p, iFanin) > tRequired )
212 Gia_ObjSetTimeRequired( p, iFanin, tRequired );
213 }
214 }
215 }
216 return tRequired;
217}
Here is the call graph for this function:
Here is the caller graph for this function: