ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
fretMain.c File Reference
#include "fretime.h"
Include dependency graph for fretMain.c:

Go to the source code of this file.

Functions

void Abc_NtkMarkCone_rec (Abc_Obj_t *pObj, int fForward)
 
void print_node3 (Abc_Obj_t *pObj)
 
Abc_Ntk_tAbc_FlowRetime_MinReg (Abc_Ntk_t *pNtk, int fVerbose, int fComputeInitState, int fGuaranteeInitState, int fBlockConst, int fForwardOnly, int fBackwardOnly, int nMaxIters, int maxDelay, int fFastButConservative)
 FUNCTION DEFINITIONS ///.
 
int Abc_FlowRetime_PushFlows (Abc_Ntk_t *pNtk, int fVerbose)
 
void Abc_FlowRetime_FixLatchBoxes (Abc_Ntk_t *pNtk, Vec_Ptr_t *vBoxIns)
 
void Abc_FlowRetime_CopyInitState (Abc_Obj_t *pSrc, Abc_Obj_t *pDest)
 
void print_node (Abc_Obj_t *pObj)
 
void print_node2 (Abc_Obj_t *pObj)
 
void Abc_ObjBetterTransferFanout (Abc_Obj_t *pFrom, Abc_Obj_t *pTo, int complement)
 
int Abc_FlowRetime_IsAcrossCut (Abc_Obj_t *pObj, Abc_Obj_t *pNext)
 
void Abc_FlowRetime_ClearFlows (int fClearAll)
 
Abc_Ntk_tAbc_FlowRetime_NtkSilentRestrash (Abc_Ntk_t *pNtk, int fCleanup)
 
void Abc_FlowRetime_UpdateLags ()
 
int Abc_FlowRetime_GetLag (Abc_Obj_t *pObj)
 
void Abc_FlowRetime_SetLag (Abc_Obj_t *pObj, int lag)
 
void Abc_ObjPrintNeighborhood (Abc_Obj_t *pObj, int depth)
 

Variables

MinRegMan_tpManMR
 
int fPathError = 0
 

Function Documentation

◆ Abc_FlowRetime_ClearFlows()

void Abc_FlowRetime_ClearFlows ( int fClearAll)

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

Synopsis [Resets flow problem]

Description [If fClearAll is true, all marks will be cleared; this is typically appropriate after the circuit structure has been modified.]

SideEffects []

SeeAlso []

Definition at line 1087 of file fretMain.c.

1087 {
1088 int i;
1089
1090 if (fClearAll)
1091 memset(pManMR->pDataArray, 0, sizeof(Flow_Data_t)*pManMR->nNodes);
1092 else {
1093 // clear only data related to flow problem
1094 for(i=0; i<pManMR->nNodes; i++) {
1095 pManMR->pDataArray[i].mark &= ~(VISITED | FLOW );
1096 pManMR->pDataArray[i].e_dist = 0;
1097 pManMR->pDataArray[i].r_dist = 0;
1098 pManMR->pDataArray[i].pred = NULL;
1099 }
1100 }
1101}
#define FLOW
Definition fretime.h:49
#define VISITED
Definition fretime.h:48
MinRegMan_t * pManMR
Definition fretMain.c:52
struct Flow_Data_t_ Flow_Data_t
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_FlowRetime_CopyInitState()

void Abc_FlowRetime_CopyInitState ( Abc_Obj_t * pSrc,
Abc_Obj_t * pDest )

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

Synopsis [Copies initial state from latches to BO nodes.]

Description [Initial states are marked on BO nodes with INIT_0 and INIT_1 flags in their Flow_Data structures.]

SideEffects []

SeeAlso []

Definition at line 777 of file fretMain.c.

777 {
778 Abc_Obj_t *pObj;
779
780 if (!pManMR->fComputeInitState) return;
781
782 assert(Abc_ObjIsLatch(pSrc));
783 assert(Abc_ObjFanin0(pDest) == pSrc);
784 assert(!Abc_ObjFaninC0(pDest));
785
786 FUNSET(pDest, INIT_CARE);
787 if (Abc_LatchIsInit0(pSrc)) {
788 FSET(pDest, INIT_0);
789 } else if (Abc_LatchIsInit1(pSrc)) {
790 FSET(pDest, INIT_1);
791 }
792
793 if (!pManMR->fIsForward) {
794 pObj = (Abc_Obj_t*)Abc_ObjData(pSrc);
795 assert(Abc_ObjIsPi(pObj));
796 FDATA(pDest)->pInitObj = pObj;
797 }
798}
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
#define FSET(x, y)
Definition fretime.h:81
#define INIT_1
Definition fretime.h:53
#define FDATA(x)
Definition fretime.h:80
#define INIT_CARE
Definition fretime.h:54
#define INIT_0
Definition fretime.h:52
#define FUNSET(x, y)
Definition fretime.h:82
#define assert(ex)
Definition util_old.h:213

◆ Abc_FlowRetime_FixLatchBoxes()

void Abc_FlowRetime_FixLatchBoxes ( Abc_Ntk_t * pNtk,
Vec_Ptr_t * vBoxIns )

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

Synopsis [Restores latch boxes.]

Description [Latchless BI/BO nodes are removed. Latch boxes are restored around remaining latches.]

SideEffects [Deletes nodes as appropriate.]

SeeAlso []

Definition at line 545 of file fretMain.c.

545 {
546 int i;
547 Abc_Obj_t *pObj, *pBo = NULL, *pBi = NULL;
548 Vec_Ptr_t *vFreeBi = Vec_PtrAlloc( 100 );
549 Vec_Ptr_t *vFreeBo = Vec_PtrAlloc( 100 );
550
551 // 1. remove empty bi/bo pairs
552 while(Vec_PtrSize( vBoxIns )) {
553 pBi = (Abc_Obj_t *)Vec_PtrPop( vBoxIns );
554 assert(Abc_ObjIsBi(pBi));
555 assert(Abc_ObjFanoutNum(pBi) == 1);
556 // APH: broken by bias nodes assert(Abc_ObjFaninNum(pBi) == 1);
557 pBo = Abc_ObjFanout0(pBi);
558 assert(!Abc_ObjFaninC0(pBo));
559
560 if (Abc_ObjIsBo(pBo)) {
561 // an empty bi/bo pair
562
563 Abc_ObjRemoveFanins( pBo );
564 // transfer complement from BI, if present
565 assert(!Abc_ObjIsComplement(Abc_ObjFanin0(pBi)));
566 Abc_ObjBetterTransferFanout( pBo, Abc_ObjFanin0(pBi), Abc_ObjFaninC0(pBi) );
567
568 Abc_ObjRemoveFanins( pBi );
569 pBi->fCompl0 = 0;
570 Vec_PtrPush( vFreeBi, pBi );
571 Vec_PtrPush( vFreeBo, pBo );
572
573 // free names
574 if (Nm_ManFindNameById(pNtk->pManName, Abc_ObjId(pBi)))
575 Nm_ManDeleteIdName( pNtk->pManName, Abc_ObjId(pBi));
576 if (Nm_ManFindNameById(pNtk->pManName, Abc_ObjId(pBo)))
577 Nm_ManDeleteIdName( pNtk->pManName, Abc_ObjId(pBo));
578
579 // check for complete detachment
580 assert(Abc_ObjFaninNum(pBi) == 0);
581 assert(Abc_ObjFanoutNum(pBi) == 0);
582 assert(Abc_ObjFaninNum(pBo) == 0);
583 assert(Abc_ObjFanoutNum(pBo) == 0);
584 } else if (Abc_ObjIsLatch(pBo)) {
585 } else {
586 Abc_ObjPrint(stdout, pBi);
587 Abc_ObjPrint(stdout, pBo);
588 assert(0);
589 }
590 }
591
592 // 2. add bi/bos as necessary for latches
593 Abc_NtkForEachLatch( pNtk, pObj, i ) {
594 assert(Abc_ObjFaninNum(pObj) == 1);
595 if (Abc_ObjFanoutNum(pObj))
596 pBo = Abc_ObjFanout0(pObj);
597 else pBo = NULL;
598 pBi = Abc_ObjFanin0(pObj);
599
600 // add BO
601 if (!pBo || !Abc_ObjIsBo(pBo)) {
602 pBo = (Abc_Obj_t *)Vec_PtrPop( vFreeBo );
603 if (Abc_ObjFanoutNum(pObj)) Abc_ObjTransferFanout( pObj, pBo );
604 Abc_ObjAddFanin( pBo, pObj );
605 }
606 // add BI
607 if (!Abc_ObjIsBi(pBi)) {
608 pBi = (Abc_Obj_t *)Vec_PtrPop( vFreeBi );
609 assert(Abc_ObjFaninNum(pBi) == 0);
610 Abc_ObjAddFanin( pBi, Abc_ObjFanin0(pObj) );
611 pBi->fCompl0 = pObj->fCompl0;
612 Abc_ObjRemoveFanins( pObj );
613 Abc_ObjAddFanin( pObj, pBi );
614 }
615 }
616
617 // delete remaining BIs and BOs
618 while(Vec_PtrSize( vFreeBi )) {
619 pObj = (Abc_Obj_t *)Vec_PtrPop( vFreeBi );
620 Abc_NtkDeleteObj( pObj );
621 }
622 while(Vec_PtrSize( vFreeBo )) {
623 pObj = (Abc_Obj_t *)Vec_PtrPop( vFreeBo );
624 Abc_NtkDeleteObj( pObj );
625 }
626
627#if defined(DEBUG_CHECK)
628 Abc_NtkForEachObj( pNtk, pObj, i ) {
629 if (Abc_ObjIsBo(pObj)) {
630 assert(Abc_ObjFaninNum(pObj) == 1);
631 assert(Abc_ObjIsLatch(Abc_ObjFanin0(pObj)));
632 }
633 if (Abc_ObjIsBi(pObj)) {
634 assert(Abc_ObjFaninNum(pObj) == 1);
635 assert(Abc_ObjFanoutNum(pObj) == 1);
636 assert(Abc_ObjIsLatch(Abc_ObjFanout0(pObj)));
637 }
638 if (Abc_ObjIsLatch(pObj)) {
639 assert(Abc_ObjFanoutNum(pObj) == 1);
640 assert(Abc_ObjFaninNum(pObj) == 1);
641 }
642 }
643#endif
644
645 Vec_PtrFree( vFreeBi );
646 Vec_PtrFree( vFreeBo );
647}
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition abcFanio.c:84
ABC_DLL void Abc_NtkDeleteObj(Abc_Obj_t *pObj)
Definition abcObj.c:170
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition abc.h:500
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition abc.h:449
ABC_DLL void Abc_ObjPrint(FILE *pFile, Abc_Obj_t *pObj)
Definition abcPrint.c:1674
ABC_DLL void Abc_ObjTransferFanout(Abc_Obj_t *pObjOld, Abc_Obj_t *pObjNew)
Definition abcFanio.c:292
ABC_DLL void Abc_ObjRemoveFanins(Abc_Obj_t *pObj)
Definition abcFanio.c:141
void Abc_ObjBetterTransferFanout(Abc_Obj_t *pFrom, Abc_Obj_t *pTo, int complement)
Definition fretMain.c:1032
char * Nm_ManFindNameById(Nm_Man_t *p, int ObjId)
Definition nmApi.c:199
void Nm_ManDeleteIdName(Nm_Man_t *p, int ObjId)
Definition nmApi.c:149
Nm_Man_t * pManName
Definition abc.h:160
unsigned fCompl0
Definition abc.h:140
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
Here is the call graph for this function:

◆ Abc_FlowRetime_GetLag()

int Abc_FlowRetime_GetLag ( Abc_Obj_t * pObj)

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

Synopsis [Gets lag value of a node.]

Description []

SideEffects []

SeeAlso []

Definition at line 1323 of file fretMain.c.

1323 {
1324 assert( !Abc_ObjIsLatch(pObj) );
1325 assert( (int)Abc_ObjId(pObj) < Vec_IntSize(pManMR->vLags) );
1326
1327 return Vec_IntEntry(pManMR->vLags, Abc_ObjId(pObj));
1328}

◆ Abc_FlowRetime_IsAcrossCut()

int Abc_FlowRetime_IsAcrossCut ( Abc_Obj_t * pObj,
Abc_Obj_t * pNext )

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

Synopsis [Returns true is a connection spans the min-cut.]

Description [pNext is a direct fanout of pObj.]

SideEffects []

SeeAlso []

Definition at line 1054 of file fretMain.c.

1054 {
1055
1056 if (FTEST(pObj, VISITED_R) && !FTEST(pObj, VISITED_E)) {
1057 if (pManMR->fIsForward) {
1058 if (!FTEST(pNext, VISITED_R) ||
1059 (FTEST(pNext, BLOCK_OR_CONS) & pManMR->constraintMask)||
1060 FTEST(pNext, CROSS_BOUNDARY) ||
1061 Abc_ObjIsLatch(pNext))
1062 return 1;
1063 } else {
1064 if (FTEST(pNext, VISITED_E) ||
1065 FTEST(pNext, CROSS_BOUNDARY))
1066 return 1;
1067 }
1068 }
1069
1070 return 0;
1071}
#define CROSS_BOUNDARY
Definition fretime.h:50
#define VISITED_E
Definition fretime.h:46
#define VISITED_R
Definition fretime.h:47
#define BLOCK_OR_CONS
Definition fretime.h:56
#define FTEST(x, y)
Definition fretime.h:83

◆ Abc_FlowRetime_MinReg()

Abc_Ntk_t * Abc_FlowRetime_MinReg ( Abc_Ntk_t * pNtk,
int fVerbose,
int fComputeInitState,
int fGuaranteeInitState,
int fBlockConst,
int fForwardOnly,
int fBackwardOnly,
int nMaxIters,
int maxDelay,
int fFastButConservative )

FUNCTION DEFINITIONS ///.

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

Synopsis [Performs minimum-register retiming.]

Description []

SideEffects []

SeeAlso []

Definition at line 72 of file fretMain.c.

75 {
76
77 int i;
78 Abc_Obj_t *pObj, *pNext;
79 InitConstraint_t *pData;
80
81 // create manager
83
84 pManMR->pNtk = pNtk;
85 pManMR->fVerbose = fVerbose;
86 pManMR->fComputeInitState = fComputeInitState;
87 pManMR->fGuaranteeInitState = fGuaranteeInitState;
88 pManMR->fBlockConst = fBlockConst;
89 pManMR->fForwardOnly = fForwardOnly;
90 pManMR->fBackwardOnly = fBackwardOnly;
91 pManMR->nMaxIters = nMaxIters;
92 pManMR->maxDelay = maxDelay;
93 pManMR->fComputeInitState = fComputeInitState;
94 pManMR->fConservTimingOnly = fFastButConservative;
95 pManMR->vNodes = Vec_PtrAlloc(100);
96 pManMR->vInitConstraints = Vec_PtrAlloc(2);
97 pManMR->pInitNtk = NULL;
98 pManMR->pInitToOrig = NULL;
99 pManMR->sizeInitToOrig = 0;
100
101 vprintf("Flow-based minimum-register retiming...\n");
102
103 if (!Abc_NtkHasOnlyLatchBoxes(pNtk)) {
104 printf("\tERROR: Can not retime with black/white boxes\n");
105 return pNtk;
106 }
107
108 if (maxDelay) {
109 vprintf("\tmax delay constraint = %d\n", maxDelay);
110 if (maxDelay < (i = Abc_NtkLevel(pNtk))) {
111 printf("ERROR: max delay constraint (%d) must be > current max delay (%d)\n", maxDelay, i);
112 return pNtk;
113 }
114 }
115
116 // print info about type of network
117 vprintf("\tnetlist type = ");
118 if (Abc_NtkIsNetlist( pNtk )) { vprintf("netlist/"); }
119 else if (Abc_NtkIsLogic( pNtk )) { vprintf("logic/"); }
120 else if (Abc_NtkIsStrash( pNtk )) { vprintf("strash/"); }
121 else { vprintf("***unknown***/"); }
122 if (Abc_NtkHasSop( pNtk )) { vprintf("sop\n"); }
123 else if (Abc_NtkHasBdd( pNtk )) { vprintf("bdd\n"); }
124 else if (Abc_NtkHasAig( pNtk )) { vprintf("aig\n"); }
125 else if (Abc_NtkHasMapping( pNtk )) { vprintf("mapped\n"); }
126 else { vprintf("***unknown***\n"); }
127
128 vprintf("\tinitial reg count = %d\n", Abc_NtkLatchNum(pNtk));
129 vprintf("\tinitial levels = %d\n", Abc_NtkLevel(pNtk));
130
131 // remove bubbles from latch boxes
132 if (pManMR->fVerbose) Abc_FlowRetime_PrintInitStateInfo(pNtk);
133 vprintf("\tpushing bubbles out of latch boxes\n");
134 Abc_NtkForEachLatch( pNtk, pObj, i )
135 Abc_FlowRetime_RemoveLatchBubbles(pObj);
136 if (pManMR->fVerbose) Abc_FlowRetime_PrintInitStateInfo(pNtk);
137
138 // check for box inputs/outputs
139 Abc_NtkForEachLatch( pNtk, pObj, i ) {
140 assert(Abc_ObjFaninNum(pObj) == 1);
141 assert(Abc_ObjFanoutNum(pObj) == 1);
142 assert(!Abc_ObjFaninC0(pObj));
143
144 pNext = Abc_ObjFanin0(pObj);
145 assert(Abc_ObjIsBi(pNext));
146 assert(Abc_ObjFaninNum(pNext) <= 1);
147 if(Abc_ObjFaninNum(pNext) == 0) // every Bi should have a fanin
148 Abc_FlowRetime_AddDummyFanin( pNext );
149
150 pNext = Abc_ObjFanout0(pObj);
151 assert(Abc_ObjIsBo(pNext));
152 assert(Abc_ObjFaninNum(pNext) == 1);
153 assert(!Abc_ObjFaninC0(pNext));
154 }
155
156 pManMR->nLatches = Abc_NtkLatchNum( pNtk );
157 pManMR->nNodes = Abc_NtkObjNumMax( pNtk )+1;
158
159 // build histogram
160 pManMR->vSinkDistHist = Vec_IntStart( pManMR->nNodes*2+10 );
161
162 // initialize timing
163 if (maxDelay)
165
166 // create lag and Flow_Data structure
167 pManMR->vLags = Vec_IntStart(pManMR->nNodes);
168 memset(pManMR->vLags->pArray, 0, sizeof(int)*pManMR->nNodes);
169
170 pManMR->pDataArray = ABC_ALLOC( Flow_Data_t, pManMR->nNodes );
172
173 // main loop!
174 pNtk = Abc_FlowRetime_MainLoop();
175
176 // cleanup node fields
177 Abc_NtkForEachObj( pNtk, pObj, i ) {
178 // if not computing init state, set all latches to DC
179 if (!fComputeInitState && Abc_ObjIsLatch(pObj))
180 Abc_LatchSetInitDc(pObj);
181 }
182
183 // deallocate space
184 ABC_FREE( pManMR->pDataArray );
185 if (pManMR->pInitToOrig) ABC_FREE( pManMR->pInitToOrig );
186 if (pManMR->vNodes) Vec_PtrFree(pManMR->vNodes);
187 if (pManMR->vLags) Vec_IntFree(pManMR->vLags);
188 if (pManMR->vSinkDistHist) Vec_IntFree(pManMR->vSinkDistHist);
189 if (pManMR->maxDelay) Abc_FlowRetime_FreeTiming( pNtk );
190 while( Vec_PtrSize( pManMR->vInitConstraints )) {
191 pData = (InitConstraint_t*)Vec_PtrPop( pManMR->vInitConstraints );
192 //assert( pData->pBiasNode );
193 //Abc_NtkDeleteObj( pData->pBiasNode );
194 ABC_FREE( pData->vNodes.pArray );
195 ABC_FREE( pData );
196 }
197 ABC_FREE( pManMR->vInitConstraints );
198
199 // restrash if necessary
200 if (Abc_NtkIsStrash(pNtk)) {
201 Abc_NtkReassignIds( pNtk );
202 pNtk = Abc_FlowRetime_NtkSilentRestrash( pNtk, 1 );
203 }
204
205 vprintf("\tfinal reg count = %d\n", Abc_NtkLatchNum(pNtk));
206 vprintf("\tfinal levels = %d\n", Abc_NtkLevel(pNtk));
207
208#if defined(DEBUG_CHECK)
209 Abc_NtkDoCheck( pNtk );
210#endif
211
212 // free manager
213 ABC_FREE( pManMR );
214
215 return pNtk;
216}
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition abcDfs.c:1449
ABC_DLL int Abc_NtkDoCheck(Abc_Ntk_t *pNtk)
Definition abcCheck.c:96
ABC_DLL void Abc_NtkReassignIds(Abc_Ntk_t *pNtk)
Definition abcUtil.c:1809
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_FREE(obj)
Definition abc_global.h:267
void Abc_FlowRetime_ClearFlows(int fClearAll)
Definition fretMain.c:1087
Abc_Ntk_t * Abc_FlowRetime_NtkSilentRestrash(Abc_Ntk_t *pNtk, int fCleanup)
Definition fretMain.c:1184
#define vprintf
Definition fretime.h:138
struct MinRegMan_t_ MinRegMan_t
void Abc_FlowRetime_PrintInitStateInfo(Abc_Ntk_t *pNtk)
Definition fretInit.c:133
struct InitConstraint_t_ InitConstraint_t
void Abc_FlowRetime_InitTiming(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition fretTime.c:67
void Abc_FlowRetime_FreeTiming(Abc_Ntk_t *pNtk)
Definition fretTime.c:617
Vec_Int_t vNodes
Definition fretime.h:94
Here is the call graph for this function:

◆ Abc_FlowRetime_NtkSilentRestrash()

Abc_Ntk_t * Abc_FlowRetime_NtkSilentRestrash ( Abc_Ntk_t * pNtk,
int fCleanup )

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

Synopsis [Silent restrash.]

Description [Same functionality as Abc_NtkRestrash but w/o warnings.]

SideEffects []

SeeAlso []

Definition at line 1184 of file fretMain.c.

1185{
1186 Abc_Ntk_t * pNtkAig;
1187 Abc_Obj_t * pObj;
1188 int i, nNodes;//, RetValue;
1189 assert( Abc_NtkIsStrash(pNtk) );
1190 // start the new network (constants and CIs of the old network will point to the their counterparts in the new network)
1191 pNtkAig = Abc_NtkStartFrom( pNtk, ABC_NTK_STRASH, ABC_FUNC_AIG );
1192 // restrash the nodes (assuming a topological order of the old network)
1193 Abc_NtkForEachNode( pNtk, pObj, i )
1194 pObj->pCopy = Abc_AigAnd( (Abc_Aig_t *)pNtkAig->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) );
1195 // finalize the network
1196 Abc_NtkFinalize( pNtk, pNtkAig );
1197 // perform cleanup if requested
1198 if ( fCleanup )
1199 nNodes = Abc_AigCleanup((Abc_Aig_t *)pNtkAig->pManFunc);
1200 // duplicate EXDC
1201 if ( pNtk->pExdc )
1202 pNtkAig->pExdc = Abc_NtkDup( pNtk->pExdc );
1203 // make sure everything is okay
1204 if ( !Abc_NtkCheck( pNtkAig ) )
1205 {
1206 printf( "Abc_NtkStrash: The network check has failed.\n" );
1207 Abc_NtkDelete( pNtkAig );
1208 return NULL;
1209 }
1210 return pNtkAig;
1211}
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition abcCheck.c:64
struct Abc_Aig_t_ Abc_Aig_t
Definition abc.h:117
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
ABC_DLL void Abc_NtkFinalize(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkNew)
Definition abcNtk.c:355
@ ABC_NTK_STRASH
Definition abc.h:58
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
Definition abcAig.c:194
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition abcAig.c:700
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition abcNtk.c:1421
@ ABC_FUNC_AIG
Definition abc.h:67
ABC_DLL Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
Definition abcNtk.c:157
ABC_DLL Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
Definition abcNtk.c:472
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition abc.h:464
Abc_Ntk_t * pExdc
Definition abc.h:201
void * pManFunc
Definition abc.h:191
Abc_Obj_t * pCopy
Definition abc.h:148
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_FlowRetime_PushFlows()

int Abc_FlowRetime_PushFlows ( Abc_Ntk_t * pNtk,
int fVerbose )

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

Synopsis [Computes maximum flow.]

Description []

SideEffects [Leaves VISITED flags on source-reachable nodes.]

SeeAlso []

Definition at line 479 of file fretMain.c.

479 {
480 int i, j, flow = 0, last, srcDist = 0;
481 Abc_Obj_t *pObj, *pObj2;
482// int clk = clock();
483
484 pManMR->constraintMask |= BLOCK;
485
486 pManMR->fSinkDistTerminate = 0;
487 dfsfast_preorder( pNtk );
488
489 // (i) fast max-flow computation
490 while(!pManMR->fSinkDistTerminate && srcDist < MAX_DIST) {
491 srcDist = MAX_DIST;
492 Abc_NtkForEachLatch( pNtk, pObj, i )
493 if (FDATA(pObj)->e_dist)
494 srcDist = MIN(srcDist, (int)FDATA(pObj)->e_dist);
495
496 Abc_NtkForEachLatch( pNtk, pObj, i ) {
497 if (srcDist == (int)FDATA(pObj)->e_dist &&
498 dfsfast_e( pObj, NULL )) {
499#ifdef DEBUG_PRINT_FLOWS
500 printf("\n\n");
501#endif
502 flow++;
503 }
504 }
505 }
506
507 if (fVerbose) vprintf("\t\tmax-flow1 = %d \t", flow);
508
509 // (ii) complete max-flow computation
510 // also, marks source-reachable nodes
511 do {
512 last = flow;
513 Abc_NtkForEachLatch( pNtk, pObj, i ) {
514 if (dfsplain_e( pObj, NULL )) {
515#ifdef DEBUG_PRINT_FLOWS
516 printf("\n\n");
517#endif
518 flow++;
519 Abc_NtkForEachObj( pNtk, pObj2, j )
520 FUNSET( pObj2, VISITED );
521 }
522 }
523 } while (flow > last);
524
525 if (fVerbose) vprintf("max-flow2 = %d\n", flow);
526
527// PRT( "time", clock() - clk );
528 return flow;
529}
#define MAX_DIST(s)
Definition deflate.h:285
int dfsfast_e(Abc_Obj_t *pObj, Abc_Obj_t *pPred)
Definition fretFlow.c:210
int dfsplain_e(Abc_Obj_t *pObj, Abc_Obj_t *pPred)
Definition fretFlow.c:528
void dfsfast_preorder(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition fretFlow.c:54
#define BLOCK
Definition fretime.h:51
#define MIN(a, b)
Definition util_old.h:256
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_FlowRetime_SetLag()

void Abc_FlowRetime_SetLag ( Abc_Obj_t * pObj,
int lag )

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

Synopsis [Sets lag value of a node.]

Description []

SideEffects []

SeeAlso []

Definition at line 1342 of file fretMain.c.

1342 {
1343 assert( Abc_ObjIsNode(pObj) );
1344 assert( (int)Abc_ObjId(pObj) < Vec_IntSize(pManMR->vLags) );
1345
1346 Vec_IntWriteEntry(pManMR->vLags, Abc_ObjId(pObj), lag);
1347}

◆ Abc_FlowRetime_UpdateLags()

void Abc_FlowRetime_UpdateLags ( )

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

Synopsis [Updates lag values.]

Description []

SideEffects []

SeeAlso []

Definition at line 1294 of file fretMain.c.

1294 {
1295 Abc_Obj_t *pObj, *pNext;
1296 int i, j;
1297
1298 Abc_NtkIncrementTravId( pManMR->pNtk );
1299
1300 Abc_NtkForEachLatch( pManMR->pNtk, pObj, i )
1301 if (pManMR->fIsForward) {
1302 Abc_ObjForEachFanin( pObj, pNext, j )
1303 Abc_FlowRetime_UpdateLags_forw_rec( pNext );
1304 } else {
1305 Abc_ObjForEachFanout( pObj, pNext, j )
1306 Abc_FlowRetime_UpdateLags_back_rec( pNext );
1307 }
1308}
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition abc.h:527
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition abc.h:529

◆ Abc_NtkMarkCone_rec()

void Abc_NtkMarkCone_rec ( Abc_Obj_t * pObj,
int fForward )
extern

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

Synopsis [Marks the cone with MarkA.]

Description []

SideEffects []

SeeAlso []

Definition at line 147 of file retArea.c.

148{
149 Abc_Obj_t * pNext;
150 int i;
151 if ( pObj->fMarkA )
152 return;
153 pObj->fMarkA = 1;
154 if ( fForward )
155 {
156 Abc_ObjForEachFanout( pObj, pNext, i )
157 Abc_NtkMarkCone_rec( pNext, fForward );
158 }
159 else
160 {
161 Abc_ObjForEachFanin( pObj, pNext, i )
162 Abc_NtkMarkCone_rec( pNext, fForward );
163 }
164}
void Abc_NtkMarkCone_rec(Abc_Obj_t *pObj, int fForward)
Definition retArea.c:147
unsigned fMarkA
Definition abc.h:134
Here is the caller graph for this function:

◆ Abc_ObjBetterTransferFanout()

void Abc_ObjBetterTransferFanout ( Abc_Obj_t * pFrom,
Abc_Obj_t * pTo,
int complement )

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

Synopsis [Transfers fanout.]

Description [Does not produce an error if there is no fanout. Complements as necessary.]

SideEffects []

SeeAlso []

Definition at line 1032 of file fretMain.c.

1032 {
1033 Abc_Obj_t *pNext;
1034
1035 while(Abc_ObjFanoutNum(pFrom) > 0) {
1036 pNext = Abc_ObjFanout0(pFrom);
1037 Abc_ObjPatchFanin( pNext, pFrom, Abc_ObjNotCond(pTo, complement) );
1038 }
1039}
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
Definition abcFanio.c:172
pcover complement(pcube *T)
Definition compl.c:49
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_ObjPrintNeighborhood()

void Abc_ObjPrintNeighborhood ( Abc_Obj_t * pObj,
int depth )

Definition at line 1369 of file fretMain.c.

1369 {
1370 Vec_Ptr_t *vNodes = Vec_PtrAlloc(100);
1371 Abc_Obj_t *pObj2;
1372
1373 Abc_ObjPrintNeighborhood_rec( pObj, vNodes, depth );
1374
1375 while(Vec_PtrSize(vNodes)) {
1376 pObj2 = (Abc_Obj_t*)Vec_PtrPop(vNodes);
1377 pObj2->fMarkC = 0;
1378 }
1379
1380 Vec_PtrFree(vNodes);
1381}
unsigned fMarkC
Definition abc.h:136
Here is the caller graph for this function:

◆ print_node()

void print_node ( Abc_Obj_t * pObj)

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

Synopsis [Prints information about a node.]

Description [Debuging.]

SideEffects []

SeeAlso []

Definition at line 945 of file fretMain.c.

945 {
946 int i;
947 Abc_Obj_t * pNext;
948 char m[6];
949
950 m[0] = 0;
951 if (pObj->fMarkA)
952 strcat(m, "A");
953 if (pObj->fMarkB)
954 strcat(m, "B");
955 if (pObj->fMarkC)
956 strcat(m, "C");
957
958 printf("node %d type=%d lev=%d tedge=%d (%x%s) fanouts {", Abc_ObjId(pObj), Abc_ObjType(pObj),
959 pObj->Level, Vec_PtrSize(FTIMEEDGES(pObj)), FDATA(pObj)->mark, m);
960 Abc_ObjForEachFanout( pObj, pNext, i )
961 printf("%d[%d](%d),", Abc_ObjId(pNext), Abc_ObjType(pNext), FDATA(pNext)->mark);
962 printf("} fanins {");
963 Abc_ObjForEachFanin( pObj, pNext, i )
964 printf("%d[%d](%d),", Abc_ObjId(pNext), Abc_ObjType(pNext), FDATA(pNext)->mark);
965 printf("}\n");
966}
#define FTIMEEDGES(x)
Definition fretime.h:84
unsigned fMarkB
Definition abc.h:135
unsigned Level
Definition abc.h:142
char * strcat()
signed char mark
Definition value.h:8
Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_node2()

void print_node2 ( Abc_Obj_t * pObj)

Definition at line 969 of file fretMain.c.

969 {
970 int i;
971 Abc_Obj_t * pNext;
972 char m[6];
973
974 m[0] = 0;
975 if (pObj->fMarkA)
976 strcat(m, "A");
977 if (pObj->fMarkB)
978 strcat(m, "B");
979 if (pObj->fMarkC)
980 strcat(m, "C");
981
982 printf("node %d type=%d %s fanouts {", Abc_ObjId(pObj), Abc_ObjType(pObj), m);
983 Abc_ObjForEachFanout( pObj, pNext, i )
984 printf("%d ,", Abc_ObjId(pNext));
985 printf("} fanins {");
986 Abc_ObjForEachFanin( pObj, pNext, i )
987 printf("%d ,", Abc_ObjId(pNext));
988 printf("} ");
989}
Here is the call graph for this function:

◆ print_node3()

void print_node3 ( Abc_Obj_t * pObj)

Definition at line 992 of file fretMain.c.

992 {
993 int i;
994 Abc_Obj_t * pNext;
995 char m[6];
996
997 m[0] = 0;
998 if (pObj->fMarkA)
999 strcat(m, "A");
1000 if (pObj->fMarkB)
1001 strcat(m, "B");
1002 if (pObj->fMarkC)
1003 strcat(m, "C");
1004
1005 printf("\nnode %d type=%d mark=%d %s\n", Abc_ObjId(pObj), Abc_ObjType(pObj), FDATA(pObj)->mark, m);
1006 printf("fanouts\n");
1007 Abc_ObjForEachFanout( pObj, pNext, i ) {
1008 print_node(pNext);
1009 printf("\n");
1010 }
1011 printf("fanins\n");
1012 Abc_ObjForEachFanin( pObj, pNext, i ) {
1013 print_node(pNext);
1014 printf("\n");
1015 }
1016}
void print_node(Abc_Obj_t *pObj)
Definition fretMain.c:945
Here is the call graph for this function:

Variable Documentation

◆ fPathError

int fPathError = 0

Definition at line 54 of file fretMain.c.

◆ pManMR

MinRegMan_t* pManMR

Definition at line 52 of file fretMain.c.