33static void Abc_FlowRetime_ConstrainExact_forw(
Abc_Obj_t * pObj );
34static void Abc_FlowRetime_ConstrainExact_back(
Abc_Obj_t * pObj );
35static void Abc_FlowRetime_ConstrainConserv_forw(
Abc_Ntk_t * pNtk );
36static void Abc_FlowRetime_ConstrainConserv_back(
Abc_Ntk_t * pNtk );
69 pManMR->nConservConstraints =
pManMR->nExactConstraints = 0;
71 pManMR->vExactNodes = Vec_PtrAlloc(1000);
96 pManMR->nExactConstraints = 0;
97 while( Vec_PtrSize(
pManMR->vExactNodes )) {
101 pArray = Vec_PtrReleaseArray(
FTIMEEDGES(pObj) );
106#if !defined(IGNORE_TIMING)
108 Abc_FlowRetime_ConstrainConserv_forw(pNtk);
110 Abc_FlowRetime_ConstrainConserv_back(pNtk);
119void Abc_FlowRetime_ConstrainConserv_forw(
Abc_Ntk_t * pNtk ) {
124 assert(!Vec_PtrSize( vNodes ));
125 pManMR->nConservConstraints = 0;
130 Abc_NtkIncrementTravId(pNtk);
132 Abc_FlowRetime_Dfs_forw( pObj, vNodes );
139 if ( Abc_NodeIsTravIdCurrent(pNext) &&
143 pObj->
Level += Abc_ObjIsNode(pObj) ? 1 : 0;
145 if ( Abc_ObjIsBi(pObj) )
153 Vec_PtrClear(vNodes);
154 Abc_NtkIncrementTravId(pNtk);
156 pBo = Abc_ObjFanout0( pObj );
157 pBi = Abc_ObjFanin0( pObj );
159 Abc_NodeSetTravIdCurrent( pObj );
160 Abc_FlowRetime_Dfs_forw( pBo, vNodes );
170#if defined(DEBUG_CHECK)
176 if ( Abc_NodeIsTravIdCurrent(pNext) && !Abc_ObjIsLatch(pNext))
188 if ( Abc_NodeIsTravIdCurrent(pNext) &&
192 pObj->
Level += Abc_ObjIsNode(pObj) ? 1 : 0;
210 if ( Abc_NodeIsTravIdCurrent(pNext) &&
214 pObj->
Level += Abc_ObjIsNode(pObj) ? 1 : 0;
216 if ( Abc_ObjIsBi(pObj) )
223 pBo = Abc_ObjFanout0( pObj );
224 pBi = Abc_ObjFanin0( pObj );
238 if ( Abc_NodeIsTravIdCurrent(pNext) &&
242 pObj->
Level += Abc_ObjIsNode(pObj) ? 1 : 0;
247 pManMR->nConservConstraints++;
252 Vec_PtrClear( vNodes );
256void Abc_FlowRetime_ConstrainConserv_back(
Abc_Ntk_t * pNtk ) {
261 assert(!Vec_PtrSize(vNodes));
263 pManMR->nConservConstraints = 0;
268 Abc_NtkIncrementTravId(pNtk);
270 Abc_FlowRetime_Dfs_back( pObj, vNodes );
277 l = pNext->
Level + (Abc_ObjIsNode(pObj) ? 1 : 0);
278 if ( Abc_NodeIsTravIdCurrent(pNext) &&
279 (
int)pObj->
Level < l )
283 if ( Abc_ObjIsBo(pObj) )
291 Vec_PtrClear(vNodes);
292 Abc_NtkIncrementTravId(pNtk);
294 pBo = Abc_ObjFanout0( pObj );
295 pBi = Abc_ObjFanin0( pObj );
297 Abc_NodeSetTravIdCurrent( pObj );
298 Abc_FlowRetime_Dfs_back( pBi, vNodes );
308#if defined(DEBUG_CHECK)
314 if ( Abc_NodeIsTravIdCurrent(pNext) && !Abc_ObjIsLatch(pNext))
326 l = pNext->
Level + (Abc_ObjIsNode(pObj) ? 1 : 0);
327 if ( Abc_NodeIsTravIdCurrent(pNext) &&
328 (
int)pObj->
Level < l )
332 if ((
int)pObj->
Level + (Abc_ObjIsNode(pObj)?1:0) >
pManMR->maxDelay) {
348 l = pNext->
Level + (Abc_ObjIsNode(pObj) ? 1 : 0);
349 if ( Abc_NodeIsTravIdCurrent(pNext) &&
350 (
int)pObj->
Level < l )
354 if ( Abc_ObjIsBo(pObj) ) {
362 pBo = Abc_ObjFanout0( pObj );
364 pBi = Abc_ObjFanin0( pObj );
378 l = pNext->
Level + (Abc_ObjIsNode(pObj) ? 1 : 0);
379 if ( Abc_NodeIsTravIdCurrent(pNext) &&
380 (
int)pObj->
Level < l )
387 pManMR->nConservConstraints++;
392 Vec_PtrClear( vNodes );
410 pManMR->nConservConstraints--;
414#if !defined(IGNORE_TIMING)
416 Abc_FlowRetime_ConstrainExact_forw(pObj);
418 Abc_FlowRetime_ConstrainExact_back(pObj);
428 if (Abc_ObjIsLatch(pObj)) {
449 Vec_PtrPush(vNodes, Abc_ObjNotCond(pObj, latch));
452void Abc_FlowRetime_ConstrainExact_forw(
Abc_Obj_t * pObj ) {
458 assert( !Vec_PtrSize(vNodes) );
459 assert( !Abc_ObjIsLatch(pObj) );
461 Vec_PtrPush(
pManMR->vExactNodes, pObj );
467 pReg = Abc_ObjRegular( pCur );
470 assert(!Abc_ObjIsLatch(pReg));
479 pReg = Abc_ObjRegular( pCur );
482 if (!Abc_ObjIsLatch(pNext))
487 pManMR->nExactConstraints++;
494 Vec_PtrClear( vNodes );
502 if (Abc_ObjIsLatch(pObj)) {
523 Vec_PtrPush(vNodes, Abc_ObjNotCond(pObj, latch));
527void Abc_FlowRetime_ConstrainExact_back(
Abc_Obj_t * pObj ) {
533 assert( !Vec_PtrSize( vNodes ));
534 assert( !Abc_ObjIsLatch(pObj) );
536 Vec_PtrPush(
pManMR->vExactNodes, pObj );
542 pReg = Abc_ObjRegular( pCur );
545 assert(!Abc_ObjIsLatch(pReg));
554 pReg = Abc_ObjRegular( pCur );
557 if (!Abc_ObjIsLatch(pNext))
562 pManMR->nExactConstraints++;
569 Vec_PtrClear( vNodes );
592 pArray = Vec_PtrReleaseArray(
FTIMEEDGES(pObj) );
595 pManMR->nExactConstraints = 0;
621 while( Vec_PtrSize(
pManMR->vExactNodes )) {
625 pArray = Vec_PtrReleaseArray(
FTIMEEDGES(pObj) );
630 Vec_PtrFree(
pManMR->vExactNodes);
650 if (Abc_ObjIsLatch(pObj))
return;
652 Abc_NodeSetTravIdCurrent( pObj );
655 if (!Abc_NodeIsTravIdCurrent( pNext ))
656 Abc_FlowRetime_Dfs_forw( pNext, vNodes );
658 Vec_PtrPush( vNodes, pObj );
666 if (Abc_ObjIsLatch(pObj))
return;
668 Abc_NodeSetTravIdCurrent( pObj );
671 if (!Abc_NodeIsTravIdCurrent( pNext ))
672 Abc_FlowRetime_Dfs_back( pNext, vNodes );
674 Vec_PtrPush( vNodes, pObj );
695 int i, flow, count = 0;
697 int maxTighten = 99999;
699 vprintf(
"\t\tsubiter %d : constraints = {cons, exact} = %d, %d\n",
704 vprintf(
"\t\trefinement: over ");
720 if (
pManMR->fConservTimingOnly) {
731 vprintf(
"%d refined nodes = ", flow);
740 count < maxTighten) {
751 count < maxTighten) {
struct Abc_Obj_t_ Abc_Obj_t
#define Abc_NtkForEachPo(pNtk, pPo, i)
#define Abc_NtkForEachLatch(pNtk, pObj, i)
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
#define Abc_ObjForEachFanin(pObj, pFanin, i)
#define Abc_ObjForEachFanout(pObj, pFanout, i)
struct Abc_Ntk_t_ Abc_Ntk_t
#define Abc_NtkForEachPi(pNtk, pPi, i)
#define ABC_ALLOC(type, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
void trace2(Abc_Obj_t *pObj)
void Abc_FlowRetime_ConstrainExact_forw_rec(Abc_Obj_t *pObj, Vec_Ptr_t *vNodes, int latch)
void Abc_FlowRetime_ConstrainExact(Abc_Obj_t *pObj)
void Abc_FlowRetime_ConstrainConserv(Abc_Ntk_t *pNtk)
void Abc_FlowRetime_ConstrainExact_back_rec(Abc_Obj_t *pObj, Vec_Ptr_t *vNodes, int latch)
int Abc_FlowRetime_RefineConstraints()
void Abc_FlowRetime_InitTiming(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
void Abc_FlowRetime_ConstrainExactAll(Abc_Ntk_t *pNtk)
void Abc_FlowRetime_FreeTiming(Abc_Ntk_t *pNtk)
void Abc_FlowRetime_ClearFlows(int fClearAll)
int Abc_FlowRetime_PushFlows(Abc_Ntk_t *pNtk, int fVerbose)
void print_node(Abc_Obj_t *pObj)
#define Vec_PtrForEachEntryReverse(Type, vVec, pEntry, i)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.