ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
fretime.h File Reference
#include "base/abc/abc.h"
#include "misc/vec/vec.h"
Include dependency graph for fretime.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Flow_Data_t_
 
struct  NodeLag_T_
 
struct  InitConstraint_t_
 
struct  MinRegMan_t_
 

Macros

#define DEBUG_CHECK
 
#define MAX_DIST   30000
 DECLARATIONS ///.
 
#define VISITED_E   0x001
 
#define VISITED_R   0x002
 
#define VISITED   (VISITED_E | VISITED_R)
 
#define FLOW   0x004
 
#define CROSS_BOUNDARY   0x008
 
#define BLOCK   0x010
 
#define INIT_0   0x020
 
#define INIT_1   0x040
 
#define INIT_CARE   (INIT_0 | INIT_1)
 
#define CONSERVATIVE   0x080
 
#define BLOCK_OR_CONS   (BLOCK | CONSERVATIVE)
 
#define BIAS_NODE   0x100
 
#define MAX(a, b)
 
#define MIN(a, b)
 
#define FDATA(x)
 
#define FSET(x, y)
 
#define FUNSET(x, y)
 
#define FTEST(x, y)
 
#define FTIMEEDGES(x)
 
#define vprintf   if (pManMR->fVerbose) printf
 

Typedefs

typedef struct Flow_Data_t_ Flow_Data_t
 
typedef struct NodeLag_T_ NodeLag_t
 
typedef struct InitConstraint_t_ InitConstraint_t
 
typedef struct MinRegMan_t_ MinRegMan_t
 

Functions

Abc_Ntk_tAbc_FlowRetime_MinReg (Abc_Ntk_t *pNtk, int fVerbose, int fComputeInitState, int fGuaranteeInitState, int fBlockConst, int fForward, int fBackward, int nMaxIters, int maxDelay, int fFastButConservative)
 FUNCTION DEFINITIONS ///.
 
void print_node (Abc_Obj_t *pObj)
 
void Abc_ObjBetterTransferFanout (Abc_Obj_t *pFrom, Abc_Obj_t *pTo, int complement)
 
int Abc_FlowRetime_PushFlows (Abc_Ntk_t *pNtk, int fVerbose)
 
int Abc_FlowRetime_IsAcrossCut (Abc_Obj_t *pCur, Abc_Obj_t *pNext)
 
void Abc_FlowRetime_ClearFlows (int fClearAll)
 
int Abc_FlowRetime_GetLag (Abc_Obj_t *pObj)
 
void Abc_FlowRetime_SetLag (Abc_Obj_t *pObj, int lag)
 
void Abc_FlowRetime_UpdateLags ()
 
void Abc_ObjPrintNeighborhood (Abc_Obj_t *pObj, int depth)
 
Abc_Ntk_tAbc_FlowRetime_NtkSilentRestrash (Abc_Ntk_t *pNtk, int fCleanup)
 
int dfsplain_e (Abc_Obj_t *pObj, Abc_Obj_t *pPred)
 
int dfsplain_r (Abc_Obj_t *pObj, Abc_Obj_t *pPred)
 
void dfsfast_preorder (Abc_Ntk_t *pNtk)
 FUNCTION DEFINITIONS ///.
 
int dfsfast_e (Abc_Obj_t *pObj, Abc_Obj_t *pPred)
 
int dfsfast_r (Abc_Obj_t *pObj, Abc_Obj_t *pPred)
 
void Abc_FlowRetime_PrintInitStateInfo (Abc_Ntk_t *pNtk)
 
void Abc_FlowRetime_InitState (Abc_Ntk_t *pNtk)
 FUNCTION DEFINITIONS ///.
 
void Abc_FlowRetime_UpdateForwardInit (Abc_Ntk_t *pNtk)
 
void Abc_FlowRetime_UpdateBackwardInit (Abc_Ntk_t *pNtk)
 
void Abc_FlowRetime_SetupBackwardInit (Abc_Ntk_t *pNtk)
 
int Abc_FlowRetime_SolveBackwardInit (Abc_Ntk_t *pNtk)
 
void Abc_FlowRetime_ConstrainInit ()
 
void Abc_FlowRetime_AddInitBias ()
 
void Abc_FlowRetime_RemoveInitBias ()
 
void Abc_FlowRetime_InitTiming (Abc_Ntk_t *pNtk)
 FUNCTION DEFINITIONS ///.
 
void Abc_FlowRetime_FreeTiming (Abc_Ntk_t *pNtk)
 
int Abc_FlowRetime_RefineConstraints ()
 
void Abc_FlowRetime_ConstrainConserv (Abc_Ntk_t *pNtk)
 
void Abc_FlowRetime_ConstrainExact (Abc_Obj_t *pObj)
 
void Abc_FlowRetime_ConstrainExactAll (Abc_Ntk_t *pNtk)
 

Variables

MinRegMan_tpManMR
 

Macro Definition Documentation

◆ BIAS_NODE

#define BIAS_NODE   0x100

Definition at line 57 of file fretime.h.

◆ BLOCK

#define BLOCK   0x010

Definition at line 51 of file fretime.h.

◆ BLOCK_OR_CONS

#define BLOCK_OR_CONS   (BLOCK | CONSERVATIVE)

Definition at line 56 of file fretime.h.

◆ CONSERVATIVE

#define CONSERVATIVE   0x080

Definition at line 55 of file fretime.h.

◆ CROSS_BOUNDARY

#define CROSS_BOUNDARY   0x008

Definition at line 50 of file fretime.h.

◆ DEBUG_CHECK

#define DEBUG_CHECK

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

FileName [fretime.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Flow-based retiming package.]

Synopsis [Header file for retiming package.]

Author [Aaron Hurst]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - January 1, 2008.]

Revision [

Id
fretime.h,v 1.00 2008/01/01 00:00:00 ahurst Exp

]

Definition at line 36 of file fretime.h.

◆ FDATA

#define FDATA ( x)
Value:
(pManMR->pDataArray+Abc_ObjId(x))
MinRegMan_t * pManMR
Definition fretMain.c:52

Definition at line 80 of file fretime.h.

◆ FLOW

#define FLOW   0x004

Definition at line 49 of file fretime.h.

◆ FSET

#define FSET ( x,
y )
Value:
FDATA(x)->mark |= y
#define FDATA(x)
Definition fretime.h:80

Definition at line 81 of file fretime.h.

◆ FTEST

#define FTEST ( x,
y )
Value:
(FDATA(x)->mark & y)

Definition at line 83 of file fretime.h.

◆ FTIMEEDGES

#define FTIMEEDGES ( x)
Value:
&(pManMR->vTimeEdges[Abc_ObjId( x )])

Definition at line 84 of file fretime.h.

◆ FUNSET

#define FUNSET ( x,
y )
Value:
FDATA(x)->mark &= ~y

Definition at line 82 of file fretime.h.

◆ INIT_0

#define INIT_0   0x020

Definition at line 52 of file fretime.h.

◆ INIT_1

#define INIT_1   0x040

Definition at line 53 of file fretime.h.

◆ INIT_CARE

#define INIT_CARE   (INIT_0 | INIT_1)

Definition at line 54 of file fretime.h.

◆ MAX

#define MAX ( a,
b )
Value:
((a)>(b)?(a):(b))

Definition at line 60 of file fretime.h.

◆ MAX_DIST

#define MAX_DIST   30000

DECLARATIONS ///.

Definition at line 43 of file fretime.h.

◆ MIN

#define MIN ( a,
b )
Value:
((a)<(b)?(a):(b))

Definition at line 61 of file fretime.h.

◆ VISITED

#define VISITED   (VISITED_E | VISITED_R)

Definition at line 48 of file fretime.h.

◆ VISITED_E

#define VISITED_E   0x001

Definition at line 46 of file fretime.h.

◆ VISITED_R

#define VISITED_R   0x002

Definition at line 47 of file fretime.h.

◆ vprintf

#define vprintf   if (pManMR->fVerbose) printf

Definition at line 138 of file fretime.h.

Typedef Documentation

◆ Flow_Data_t

typedef struct Flow_Data_t_ Flow_Data_t

◆ InitConstraint_t

◆ MinRegMan_t

typedef struct MinRegMan_t_ MinRegMan_t

◆ NodeLag_t

typedef struct NodeLag_T_ NodeLag_t

Function Documentation

◆ Abc_FlowRetime_AddInitBias()

void Abc_FlowRetime_AddInitBias ( )

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

Synopsis [Adds nodes to bias against uninitializable cuts.]

Description []

SideEffects []

SeeAlso []

Definition at line 1218 of file fretInit.c.

1218 {
1219 Abc_Ntk_t *pNtk = pManMR->pNtk;
1220 Abc_Obj_t *pBiasNode, *pObj;
1221 InitConstraint_t *pConstraint;
1222 int i, j, id;
1223 const int nConstraints = Vec_PtrSize( pManMR->vInitConstraints );
1224
1225 pManMR->pDataArray = ABC_REALLOC( Flow_Data_t, pManMR->pDataArray, pManMR->nNodes + (nConstraints*(pManMR->iteration+1)) );
1226 memset(pManMR->pDataArray + pManMR->nNodes, 0, sizeof(Flow_Data_t)*(nConstraints*(pManMR->iteration+1)));
1227
1228 vprintf("\t\tcreating %d bias structures\n", nConstraints);
1229
1230 Vec_PtrForEachEntry(InitConstraint_t*, pManMR->vInitConstraints, pConstraint, i ) {
1231 if (pConstraint->pBiasNode) continue;
1232
1233 // printf("\t\t\tbias %d...\n", i);
1234 pBiasNode = Abc_NtkCreateBlackbox( pNtk );
1235
1236 Vec_IntForEachEntry( &pConstraint->vNodes, id, j ) {
1237 pObj = Abc_NtkObj(pNtk, id);
1238 Abc_FlowRetime_ConnectBiasNode(pBiasNode, pObj, Vec_IntEntry(&pConstraint->vLags, j));
1239 }
1240
1241 // pConstraint->pBiasNode = pBiasNode;
1242 }
1243}
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
#define ABC_REALLOC(type, obj, num)
Definition abc_global.h:268
#define vprintf
Definition fretime.h:138
struct Flow_Data_t_ Flow_Data_t
struct InitConstraint_t_ InitConstraint_t
Vec_Int_t vNodes
Definition fretime.h:94
Abc_Obj_t * pBiasNode
Definition fretime.h:92
Vec_Int_t vLags
Definition fretime.h:95
char * memset()
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the call graph for this function:

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

◆ Abc_FlowRetime_ConstrainConserv()

void Abc_FlowRetime_ConstrainConserv ( Abc_Ntk_t * pNtk)

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

Synopsis [Marks nodes with conservative constraints.]

Description []

SideEffects []

SeeAlso []

Definition at line 90 of file fretTime.c.

90 {
91 Abc_Obj_t *pObj;
92 int i;
93 void *pArray;
94
95 // clear all exact constraints
96 pManMR->nExactConstraints = 0;
97 while( Vec_PtrSize( pManMR->vExactNodes )) {
98 pObj = (Abc_Obj_t*)Vec_PtrPop( pManMR->vExactNodes );
99
100 if ( Vec_PtrSize( FTIMEEDGES(pObj) )) {
101 pArray = Vec_PtrReleaseArray( FTIMEEDGES(pObj) );
102 ABC_FREE( pArray );
103 }
104 }
105
106#if !defined(IGNORE_TIMING)
107 if (pManMR->fIsForward) {
108 Abc_FlowRetime_ConstrainConserv_forw(pNtk);
109 } else {
110 Abc_FlowRetime_ConstrainConserv_back(pNtk);
111 }
112#endif
113
114 Abc_NtkForEachObj( pNtk, pObj, i)
115 assert( !Vec_PtrSize(FTIMEEDGES(pObj)) );
116}
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition abc.h:449
#define ABC_FREE(obj)
Definition abc_global.h:267
#define FTIMEEDGES(x)
Definition fretime.h:84
#define assert(ex)
Definition util_old.h:213

◆ Abc_FlowRetime_ConstrainExact()

void Abc_FlowRetime_ConstrainExact ( Abc_Obj_t * pObj)

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

Synopsis [Introduces exact timing constraints for a node.]

Description []

SideEffects []

SeeAlso []

Definition at line 407 of file fretTime.c.

407 {
408
409 if (FTEST( pObj, CONSERVATIVE )) {
410 pManMR->nConservConstraints--;
411 FUNSET( pObj, CONSERVATIVE );
412 }
413
414#if !defined(IGNORE_TIMING)
415 if (pManMR->fIsForward) {
416 Abc_FlowRetime_ConstrainExact_forw(pObj);
417 } else {
418 Abc_FlowRetime_ConstrainExact_back(pObj);
419 }
420#endif
421}
#define FUNSET(x, y)
Definition fretime.h:82
#define CONSERVATIVE
Definition fretime.h:55
#define FTEST(x, y)
Definition fretime.h:83
Here is the caller graph for this function:

◆ Abc_FlowRetime_ConstrainExactAll()

void Abc_FlowRetime_ConstrainExactAll ( Abc_Ntk_t * pNtk)

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

Synopsis [Introduces all exact timing constraints in a network]

Description []

SideEffects []

SeeAlso []

Definition at line 584 of file fretTime.c.

584 {
585 int i;
586 Abc_Obj_t *pObj;
587 void *pArray;
588
589 // free existing constraints
590 Abc_NtkForEachObj( pNtk, pObj, i )
591 if ( Vec_PtrSize( FTIMEEDGES(pObj) )) {
592 pArray = Vec_PtrReleaseArray( FTIMEEDGES(pObj) );
593 ABC_FREE( pArray );
594 }
595 pManMR->nExactConstraints = 0;
596
597 // generate all constraints
598 Abc_NtkForEachObj(pNtk, pObj, i)
599 if (!Abc_ObjIsLatch(pObj) && FTEST( pObj, CONSERVATIVE ) && !FTEST( pObj, BLOCK ))
600 if (!Vec_PtrSize( FTIMEEDGES( pObj ) ))
602}
void Abc_FlowRetime_ConstrainExact(Abc_Obj_t *pObj)
Definition fretTime.c:407
#define BLOCK
Definition fretime.h:51
Here is the call graph for this function:

◆ Abc_FlowRetime_ConstrainInit()

void Abc_FlowRetime_ConstrainInit ( )

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

Synopsis [Constrains backward retiming for initializability.]

Description []

SideEffects []

SeeAlso []

Definition at line 1023 of file fretInit.c.

1023 {
1024 Vec_Ptr_t *vNodes;
1025 int low, high, mid;
1026 int i, n, lag;
1027 Abc_Obj_t *pObj = NULL, *pOrigObj;
1028 InitConstraint_t *pConstraint = ABC_ALLOC( InitConstraint_t, 1 );
1029
1030 memset( pConstraint, 0, sizeof(InitConstraint_t) );
1031
1032 assert(pManMR->pInitNtk);
1033
1034 vprintf("\tsearch for initial state conflict...\n");
1035
1036 vNodes = Abc_NtkDfs(pManMR->pInitNtk, 0);
1037 n = Vec_PtrSize(vNodes);
1038 // also add PIs to vNodes
1039 Abc_NtkForEachPi(pManMR->pInitNtk, pObj, i)
1040 Vec_PtrPush(vNodes, pObj);
1041 Vec_PtrReorder(vNodes, n);
1042
1043#if defined(DEBUG_CHECK)
1044 assert(!Abc_FlowRetime_PartialSat( vNodes, 0 ));
1045#endif
1046
1047 // grow initialization constraint
1048 do {
1049 vprintf("\t\t");
1050
1051 // find element to add to set...
1052 low = 0, high = Vec_PtrSize(vNodes);
1053 while (low != high-1) {
1054 mid = (low + high) >> 1;
1055
1056 if (!Abc_FlowRetime_PartialSat( vNodes, mid )) {
1057 low = mid;
1058 vprintf("-");
1059 } else {
1060 high = mid;
1061 vprintf("*");
1062 }
1063 fflush(stdout);
1064 }
1065
1066#if defined(DEBUG_CHECK)
1067 assert(Abc_FlowRetime_PartialSat( vNodes, high ));
1068 assert(!Abc_FlowRetime_PartialSat( vNodes, low ));
1069#endif
1070
1071 // mark its TFO
1072 pObj = (Abc_Obj_t*)Vec_PtrEntry( vNodes, low );
1073 Abc_NtkMarkCone_rec( pObj, 1 );
1074 vprintf(" conflict term = %d ", low);
1075
1076#if 0
1077 printf("init ------\n");
1078 Abc_ObjPrint(stdout, pObj);
1079 printf("\n");
1080 Abc_ObjPrintNeighborhood( pObj, 1 );
1081 printf("------\n");
1082#endif
1083
1084 // add node to constraint
1085 Abc_FlowRetime_GetInitToOrig( pObj, &pOrigObj, &lag );
1086 assert(pOrigObj);
1087 vprintf(" <=> %d/%d\n", Abc_ObjId(pOrigObj), lag);
1088
1089#if 0
1090 printf("orig ------\n");
1091 Abc_ObjPrint(stdout, pOrigObj);
1092 printf("\n");
1093 Abc_ObjPrintNeighborhood( pOrigObj, 1 );
1094 printf("------\n");
1095#endif
1096 Vec_IntPush( &pConstraint->vNodes, Abc_ObjId(pOrigObj) );
1097 Vec_IntPush( &pConstraint->vLags, lag );
1098
1099 } while (Abc_FlowRetime_PartialSat( vNodes, Vec_PtrSize(vNodes) ));
1100
1101 pConstraint->pBiasNode = NULL;
1102
1103 // add constraint
1104 Vec_PtrPush( pManMR->vInitConstraints, pConstraint );
1105
1106 // clear marks
1107 Abc_NtkForEachObj( pManMR->pInitNtk, pObj, i)
1108 pObj->fMarkA = 0;
1109
1110 // free
1111 Vec_PtrFree( vNodes );
1112}
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition abcDfs.c:82
ABC_DLL void Abc_ObjPrint(FILE *pFile, Abc_Obj_t *pObj)
Definition abcPrint.c:1674
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition abc.h:516
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
int Abc_FlowRetime_PartialSat(Vec_Ptr_t *vNodes, int cut)
Definition fretInit.c:956
void Abc_NtkMarkCone_rec(Abc_Obj_t *pObj, int fForward)
Definition retArea.c:147
void Abc_ObjPrintNeighborhood(Abc_Obj_t *pObj, int depth)
Definition fretMain.c:1369
unsigned fMarkA
Definition abc.h:134
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_FreeTiming()

void Abc_FlowRetime_FreeTiming ( Abc_Ntk_t * pNtk)

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

Synopsis [Deallocates exact constraints.]

Description []

SideEffects []

SeeAlso []

Definition at line 617 of file fretTime.c.

617 {
618 Abc_Obj_t *pObj;
619 void *pArray;
620
621 while( Vec_PtrSize( pManMR->vExactNodes )) {
622 pObj = (Abc_Obj_t*)Vec_PtrPop( pManMR->vExactNodes );
623
624 if ( Vec_PtrSize( FTIMEEDGES(pObj) )) {
625 pArray = Vec_PtrReleaseArray( FTIMEEDGES(pObj) );
626 ABC_FREE( pArray );
627 }
628 }
629
630 Vec_PtrFree(pManMR->vExactNodes);
631 ABC_FREE( pManMR->vTimeEdges );
632}
Here is the caller 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_InitState()

void Abc_FlowRetime_InitState ( Abc_Ntk_t * pNtk)

FUNCTION DEFINITIONS ///.

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

Synopsis [Updates initial state information.]

Description [Assumes latch boxes in original position, latches in new positions.]

SideEffects []

SeeAlso []

Definition at line 75 of file fretInit.c.

75 {
76
77 if (!pManMR->fComputeInitState) return;
78
79 if (pManMR->fIsForward)
81 else {
83 }
84}
void Abc_FlowRetime_UpdateForwardInit(Abc_Ntk_t *pNtk)
Definition fretInit.c:163
void Abc_FlowRetime_UpdateBackwardInit(Abc_Ntk_t *pNtk)
Definition fretInit.c:665
Here is the call graph for this function:

◆ Abc_FlowRetime_InitTiming()

void Abc_FlowRetime_InitTiming ( Abc_Ntk_t * pNtk)

FUNCTION DEFINITIONS ///.

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

Synopsis [Initializes timing]

Description []

SideEffects []

SeeAlso []

Definition at line 67 of file fretTime.c.

67 {
68
69 pManMR->nConservConstraints = pManMR->nExactConstraints = 0;
70
71 pManMR->vExactNodes = Vec_PtrAlloc(1000);
72
73 pManMR->vTimeEdges = ABC_ALLOC( Vec_Ptr_t, Abc_NtkObjNumMax(pNtk)+1 );
74 assert(pManMR->vTimeEdges);
75 memset(pManMR->vTimeEdges, 0, (Abc_NtkObjNumMax(pNtk)+1) * sizeof(Vec_Ptr_t) );
76}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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

◆ 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}
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition abc.h:500
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
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
struct MinRegMan_t_ MinRegMan_t
void Abc_FlowRetime_PrintInitStateInfo(Abc_Ntk_t *pNtk)
Definition fretInit.c:133
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
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
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_PrintInitStateInfo()

void Abc_FlowRetime_PrintInitStateInfo ( Abc_Ntk_t * pNtk)

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

Synopsis [Prints initial state information.]

Description [Prints distribution of 0,1,and X initial states.]

SideEffects []

SeeAlso []

Definition at line 133 of file fretInit.c.

133 {
134 int i, n0=0, n1=0, nDC=0, nOther=0;
135 Abc_Obj_t *pLatch;
136
137 Abc_NtkForEachLatch( pNtk, pLatch, i ) {
138 if (Abc_LatchIsInit0(pLatch)) n0++;
139 else if (Abc_LatchIsInit1(pLatch)) n1++;
140 else if (Abc_LatchIsInitDc(pLatch)) nDC++;
141 else nOther++;
142 }
143
144 printf("\tinitial states {0,1,x} = {%d, %d, %d}", n0, n1, nDC);
145 if (nOther)
146 printf(" + %d UNKNOWN", nOther);
147 printf("\n");
148}
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 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_RefineConstraints()

int Abc_FlowRetime_RefineConstraints ( )

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

Synopsis [Main timing-constrained routine.]

Description [Refines constraints that are limiting area improvement. These are identified by computing the min-cuts both with and without the conservative constraints: these two situation represent an over- and under-constrained version of the timing.]

SideEffects []

SeeAlso []

Definition at line 693 of file fretTime.c.

693 {
694 Abc_Ntk_t *pNtk = pManMR->pNtk;
695 int i, flow, count = 0;
696 Abc_Obj_t *pObj;
697 int maxTighten = 99999;
698
699 vprintf("\t\tsubiter %d : constraints = {cons, exact} = %d, %d\n",
700 pManMR->subIteration, pManMR->nConservConstraints, pManMR->nExactConstraints);
701
702 // 1. overconstrained
703 pManMR->constraintMask = BLOCK | CONSERVATIVE;
704 vprintf("\t\trefinement: over ");
705 fflush(stdout);
706 flow = Abc_FlowRetime_PushFlows( pNtk, 0 );
707 vprintf("= %d ", flow);
708
709 // remember nodes
710 if (pManMR->fIsForward) {
711 Abc_NtkForEachObj( pNtk, pObj, i )
712 if (!FTEST(pObj, VISITED_R))
713 pObj->fMarkC = 1;
714 } else {
715 Abc_NtkForEachObj( pNtk, pObj, i )
716 if (!FTEST(pObj, VISITED_E))
717 pObj->fMarkC = 1;
718 }
719
720 if (pManMR->fConservTimingOnly) {
721 vprintf(" done\n");
722 return 0;
723 }
724
725 // 2. underconstrained
726 pManMR->constraintMask = BLOCK;
728 vprintf("under = ");
729 fflush(stdout);
730 flow = Abc_FlowRetime_PushFlows( pNtk, 0 );
731 vprintf("%d refined nodes = ", flow);
732 fflush(stdout);
733
734 // find area-limiting constraints
735 if (pManMR->fIsForward) {
736 Abc_NtkForEachObj( pNtk, pObj, i ) {
737 if (pObj->fMarkC &&
738 FTEST(pObj, VISITED_R) &&
739 FTEST(pObj, CONSERVATIVE) &&
740 count < maxTighten) {
741 count++;
743 }
744 pObj->fMarkC = 0;
745 }
746 } else {
747 Abc_NtkForEachObj( pNtk, pObj, i ) {
748 if (pObj->fMarkC &&
749 FTEST(pObj, VISITED_E) &&
750 FTEST(pObj, CONSERVATIVE) &&
751 count < maxTighten) {
752 count++;
754 }
755 pObj->fMarkC = 0;
756 }
757 }
758
759 vprintf("%d\n", count);
760
761 return (count > 0);
762}
void Abc_FlowRetime_ClearFlows(int fClearAll)
Definition fretMain.c:1087
int Abc_FlowRetime_PushFlows(Abc_Ntk_t *pNtk, int fVerbose)
Definition fretMain.c:479
unsigned fMarkC
Definition abc.h:136
Here is the call graph for this function:

◆ Abc_FlowRetime_RemoveInitBias()

void Abc_FlowRetime_RemoveInitBias ( )

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

Synopsis [Removes nodes to bias against uninitializable cuts.]

Description []

SideEffects []

SeeAlso []

Definition at line 1126 of file fretInit.c.

1126 {
1127 // Abc_Ntk_t *pNtk = pManMR->pNtk;
1128 Abc_Obj_t *pBiasNode;
1129 InitConstraint_t *pConstraint;
1130 int i;
1131
1132 Vec_PtrForEachEntry( InitConstraint_t *, pManMR->vInitConstraints, pConstraint, i ) {
1133 pBiasNode = pConstraint->pBiasNode;
1134 pConstraint->pBiasNode = NULL;
1135
1136 if (pBiasNode)
1137 Abc_NtkDeleteObj(pBiasNode);
1138 }
1139}
ABC_DLL void Abc_NtkDeleteObj(Abc_Obj_t *pObj)
Definition abcObj.c:170
Here is the call 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_SetupBackwardInit()

void Abc_FlowRetime_SetupBackwardInit ( Abc_Ntk_t * pNtk)

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

Synopsis [Sets up backward initial state computation.]

Description []

SideEffects []

SeeAlso []

Definition at line 489 of file fretInit.c.

489 {
490 Abc_Obj_t *pLatch, *pObj, *pPi;
491 int i;
492 Vec_Ptr_t *vObj = Vec_PtrAlloc(100);
493
494 // create the network used for the initial state computation
495 if (Abc_NtkIsStrash(pNtk)) {
497 } else if (Abc_NtkHasMapping(pNtk))
498 pManMR->pInitNtk = Abc_NtkAlloc( pNtk->ntkType, ABC_FUNC_SOP, 1 );
499 else
500 pManMR->pInitNtk = Abc_NtkAlloc( pNtk->ntkType, pNtk->ntkFunc, 1 );
501
502 // mitre inputs
503 Abc_NtkForEachLatch( pNtk, pLatch, i ) {
504 // map latch to initial state network
505 pPi = Abc_NtkCreatePi( pManMR->pInitNtk );
506
507 // DEBUG
508 // printf("setup : mapping latch %d to PI %d\n", pLatch->Id, pPi->Id);
509
510 // has initial state requirement?
511 if (Abc_LatchIsInit0(pLatch)) {
512 pObj = Abc_NtkCreateNodeInv( pManMR->pInitNtk, pPi );
513 Vec_PtrPush(vObj, pObj);
514 }
515 else if (Abc_LatchIsInit1(pLatch)) {
516 Vec_PtrPush(vObj, pPi);
517 }
518
519 Abc_ObjSetData( pLatch, pPi ); // if not verifying init state
520 // FDATA(pLatch)->pInitObj = pPi; // if verifying init state
521 }
522
523 // are there any nodes not DC?
524 if (!Vec_PtrSize(vObj)) {
525 pManMR->fSolutionIsDc = 1;
526 return;
527 } else
528 pManMR->fSolutionIsDc = 0;
529
530 // mitre output
531
532 // create n-input AND gate
533 pObj = Abc_NtkCreateNodeAnd( pManMR->pInitNtk, vObj );
534
535 Abc_ObjAddFanin( Abc_NtkCreatePo( pManMR->pInitNtk ), pObj );
536
537 Vec_PtrFree( vObj );
538}
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition abcNtk.c:53
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition abcFanio.c:84
@ ABC_NTK_LOGIC
Definition abc.h:57
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeAnd(Abc_Ntk_t *pNtk, Vec_Ptr_t *vFanins)
Definition abcObj.c:738
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeInv(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition abcObj.c:674
@ ABC_FUNC_SOP
Definition abc.h:65
Abc_NtkType_t ntkType
Definition abc.h:156
Abc_NtkFunc_t ntkFunc
Definition abc.h:157
Here is the call graph for this function:

◆ Abc_FlowRetime_SolveBackwardInit()

int Abc_FlowRetime_SolveBackwardInit ( Abc_Ntk_t * pNtk)

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

Synopsis [Solves backward initial state computation.]

Description []

SideEffects [Sets object copies in init ntk.]

SeeAlso []

Definition at line 552 of file fretInit.c.

552 {
553 int i;
554 Abc_Obj_t *pObj, *pInitObj;
555 Vec_Ptr_t *vDelete = Vec_PtrAlloc(0);
556 Abc_Ntk_t *pSatNtk;
557 int result;
558
559 assert(pManMR->pInitNtk);
560
561 // is the solution entirely DC's?
562 if (pManMR->fSolutionIsDc) {
563 Vec_PtrFree(vDelete);
564 Abc_NtkForEachLatch( pNtk, pObj, i ) Abc_LatchSetInitDc( pObj );
565 vprintf("\tno init state computation: all-don't-care solution\n");
566 return 1;
567 }
568
569 // check that network is combinational
570 Abc_NtkForEachObj( pManMR->pInitNtk, pObj, i ) {
571 assert(!Abc_ObjIsLatch(pObj));
572 assert(!Abc_ObjIsBo(pObj));
573 assert(!Abc_ObjIsBi(pObj));
574 }
575
576 // delete superfluous nodes
577 while(Vec_PtrSize( vDelete )) {
578 pObj = (Abc_Obj_t *)Vec_PtrPop( vDelete );
579 Abc_NtkDeleteObj( pObj );
580 }
581 Vec_PtrFree(vDelete);
582
583 // do some final cleanup on the network
586 if (Abc_NtkIsLogic(pManMR->pInitNtk))
587 Abc_NtkCleanup(pManMR->pInitNtk, 0);
588
589#if defined(DEBUG_PRINT_INIT_NTK)
590 Abc_NtkLevelReverse( pManMR->pInitNtk );
591 Abc_NtkForEachObj( pManMR->pInitNtk, pObj, i )
592 if (Abc_ObjLevel( pObj ) < 2)
593 Abc_ObjPrint(stdout, pObj);
594#endif
595
596 vprintf("\tsolving for init state (%d nodes)... ", Abc_NtkObjNum(pManMR->pInitNtk));
597 fflush(stdout);
598#ifdef ABC_USE_CUDD
599 // convert SOPs to BDD
600 if (Abc_NtkHasSop(pManMR->pInitNtk))
601 Abc_NtkSopToBdd( pManMR->pInitNtk );
602 // convert AIGs to BDD
603 if (Abc_NtkHasAig(pManMR->pInitNtk))
604 Abc_NtkAigToBdd( pManMR->pInitNtk );
605#else
606 // convert SOPs to AIG
607 if (Abc_NtkHasSop(pManMR->pInitNtk))
608 Abc_NtkSopToAig( pManMR->pInitNtk );
609#endif
610 pSatNtk = pManMR->pInitNtk;
611
612 // solve
613 result = Abc_NtkMiterSat( pSatNtk, (ABC_INT64_T)500000, (ABC_INT64_T)50000000, 0, NULL, NULL );
614
615 if (!result) {
616 vprintf("SUCCESS\n");
617 } else {
618 vprintf("FAILURE\n");
619 return 0;
620 }
621
622 // clear initial values, associate PIs to latches
623 Abc_NtkForEachPi( pManMR->pInitNtk, pInitObj, i ) Abc_ObjSetCopy( pInitObj, NULL );
624 Abc_NtkForEachLatch( pNtk, pObj, i ) {
625 pInitObj = (Abc_Obj_t*)Abc_ObjData( pObj );
626 assert( Abc_ObjIsPi( pInitObj ));
627 Abc_ObjSetCopy( pInitObj, pObj );
628 Abc_LatchSetInitNone( pObj );
629
630 // DEBUG
631 // printf("solve : getting latch %d from PI %d\n", pObj->Id, pInitObj->Id);
632 }
633
634 // copy solution from PIs to latches
635 assert(pManMR->pInitNtk->pModel);
636 Abc_NtkForEachPi( pManMR->pInitNtk, pInitObj, i ) {
637 if ((pObj = Abc_ObjCopy( pInitObj ))) {
638 if ( pManMR->pInitNtk->pModel[i] )
639 Abc_LatchSetInit1( pObj );
640 else
641 Abc_LatchSetInit0( pObj );
642 }
643 }
644
645#if defined(DEBUG_CHECK)
646 // check that all latches have initial state
647 Abc_NtkForEachLatch( pNtk, pObj, i ) assert( !Abc_LatchIsInitNone( pObj ) );
648#endif
649
650 return 1;
651}
ABC_DLL int Abc_NtkCleanup(Abc_Ntk_t *pNtk, int fVerbose)
Definition abcSweep.c:478
ABC_DLL int Abc_NtkSopToBdd(Abc_Ntk_t *pNtk)
Definition abcFunc.c:865
ABC_DLL int Abc_NtkLevelReverse(Abc_Ntk_t *pNtk)
Definition abcDfs.c:1499
ABC_DLL int Abc_NtkSopToAig(Abc_Ntk_t *pNtk)
Definition abcFunc.c:884
ABC_DLL int Abc_NtkMiterSat(Abc_Ntk_t *pNtk, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, int fVerbose, ABC_INT64_T *pNumConfs, ABC_INT64_T *pNumInspects)
FUNCTION DEFINITIONS ///.
Definition abcSat.c:58
ABC_DLL int Abc_NtkAigToBdd(Abc_Ntk_t *pNtk)
Definition abcFunc.c:869
ABC_DLL void Abc_NtkAddDummyPoNames(Abc_Ntk_t *pNtk)
Definition abcNames.c:521
ABC_DLL void Abc_NtkAddDummyPiNames(Abc_Ntk_t *pNtk)
Definition abcNames.c:495
Here is the call graph for this function:

◆ Abc_FlowRetime_UpdateBackwardInit()

void Abc_FlowRetime_UpdateBackwardInit ( Abc_Ntk_t * pNtk)

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

Synopsis [Updates backward initial state computation problem.]

Description [Assumes box outputs in old positions stored w/ init values.]

SideEffects []

SeeAlso []

Definition at line 665 of file fretInit.c.

665 {
666 Abc_Obj_t *pOrigObj, *pInitObj;
667 Vec_Ptr_t *vBo = Vec_PtrAlloc(100);
668 Vec_Ptr_t *vPi = Vec_PtrAlloc(100);
669 Abc_Ntk_t *pInitNtk = pManMR-> pInitNtk;
670 Abc_Obj_t *pBuf;
671 int i;
672
673 // remove PIs from network (from BOs)
674 Abc_NtkForEachObj( pNtk, pOrigObj, i )
675 if (Abc_ObjIsBo(pOrigObj)) {
676 pInitObj = FDATA(pOrigObj)->pInitObj;
677 assert(Abc_ObjIsPi(pInitObj));
678
679 // DEBUG
680 // printf("update : freeing PI %d\n", pInitObj->Id);
681
682 // create a buffer instead
683 pBuf = Abc_NtkCreateNodeBuf( pInitNtk, NULL );
684 Abc_FlowRetime_ClearInitToOrig( pBuf );
685
686 Abc_ObjBetterTransferFanout( pInitObj, pBuf, 0 );
687 FDATA(pOrigObj)->pInitObj = pBuf;
688 pOrigObj->fMarkA = 1;
689
690 Vec_PtrPush(vBo, pOrigObj);
691 Vec_PtrPush(vPi, pInitObj);
692 }
693
694 // check that PIs are all free
695 Abc_NtkForEachPi( pInitNtk, pInitObj, i) {
696 assert( Abc_ObjFanoutNum( pInitObj ) == 0);
697 }
698
699 // add PIs to to latches
700 Abc_NtkForEachLatch( pNtk, pOrigObj, i ) {
701 assert(Vec_PtrSize(vPi) > 0);
702 pInitObj = (Abc_Obj_t*)Vec_PtrPop(vPi);
703
704 // DEBUG
705 // printf("update : mapping latch %d to PI %d\n", pOrigObj->Id, pInitObj->Id);
706
707 pOrigObj->fMarkA = pOrigObj->fMarkB = 1;
708 FDATA(pOrigObj)->pInitObj = pInitObj;
709 Abc_ObjSetData(pOrigObj, pInitObj);
710 }
711
712 // recursively build init network
713 Vec_PtrForEachEntry( Abc_Obj_t *, vBo, pOrigObj, i )
714 Abc_FlowRetime_UpdateBackwardInit_rec( pOrigObj );
715
716 // clear flags
717 Abc_NtkForEachObj( pNtk, pOrigObj, i )
718 pOrigObj->fMarkA = pOrigObj->fMarkB = 0;
719
720 // deallocate
721 Vec_PtrFree( vBo );
722 Vec_PtrFree( vPi );
723}
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeBuf(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition abcObj.c:706
void Abc_ObjBetterTransferFanout(Abc_Obj_t *pFrom, Abc_Obj_t *pTo, int complement)
Definition fretMain.c:1032
unsigned fMarkB
Definition abc.h:135
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_FlowRetime_UpdateForwardInit()

void Abc_FlowRetime_UpdateForwardInit ( Abc_Ntk_t * pNtk)

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

Synopsis [Computes initial state after forward retiming.]

Description [Assumes box outputs in old positions stored w/ init values. Uses three-value simulation to preserve don't cares.]

SideEffects []

SeeAlso []

Definition at line 163 of file fretInit.c.

163 {
164 Abc_Obj_t *pObj, *pFanin;
165 int i;
166
167 vprintf("\t\tupdating init state\n");
168
169 Abc_NtkIncrementTravId( pNtk );
170
171 Abc_NtkForEachLatch( pNtk, pObj, i ) {
172 pFanin = Abc_ObjFanin0(pObj);
173 Abc_FlowRetime_UpdateForwardInit_rec( pFanin );
174
175 if (FTEST(pFanin, INIT_0))
176 Abc_LatchSetInit0( pObj );
177 else if (FTEST(pFanin, INIT_1))
178 Abc_LatchSetInit1( pObj );
179 else
180 Abc_LatchSetInitDc( pObj );
181 }
182}
#define INIT_1
Definition fretime.h:53
#define INIT_0
Definition fretime.h:52
Here is the caller graph for this function:

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

◆ dfsfast_e()

int dfsfast_e ( Abc_Obj_t * pObj,
Abc_Obj_t * pPred )

Definition at line 210 of file fretFlow.c.

210 {
211 int i;
212 Abc_Obj_t *pNext;
213
214 if (pManMR->fSinkDistTerminate) return 0;
215
216 // have we reached the sink?
217 if(FTEST(pObj, BLOCK_OR_CONS) & pManMR->constraintMask ||
218 Abc_ObjIsPi(pObj)) {
219 assert(pPred);
220 assert(!pManMR->fIsForward);
221 return 1;
222 }
223
224 FSET(pObj, VISITED_E);
225
226#ifdef DEBUG_VISITED
227 printf("(%de=%d) ", Abc_ObjId(pObj), FDATA(pObj)->e_dist);
228#endif
229
230 // 1. structural edges
231 if (pManMR->fIsForward)
232 Abc_ObjForEachFanout( pObj, pNext, i ) {
233 if (!FTEST(pNext, VISITED_R) &&
234 FDIST(pObj, e, pNext, r) &&
235 dfsfast_r(pNext, pPred)) {
236#ifdef DEBUG_PRINT_FLOWS
237 printf("o");
238#endif
239 goto found;
240 }
241 }
242 else
243 Abc_ObjForEachFanin( pObj, pNext, i ) {
244 if (!FTEST(pNext, VISITED_R) &&
245 FDIST(pObj, e, pNext, r) &&
246 dfsfast_r(pNext, pPred)) {
247#ifdef DEBUG_PRINT_FLOWS
248 printf("o");
249#endif
250 goto found;
251 }
252 }
253
254 if (Abc_ObjIsLatch(pObj))
255 goto not_found;
256
257 // 2. reverse edges (backward retiming only)
258 if (!pManMR->fIsForward) {
259 Abc_ObjForEachFanout( pObj, pNext, i ) {
260 if (!FTEST(pNext, VISITED_E) &&
261 FDIST(pObj, e, pNext, e) &&
262 dfsfast_e(pNext, pPred)) {
263#ifdef DEBUG_PRINT_FLOWS
264 printf("i");
265#endif
266 goto found;
267 }
268 }
269
270 // 3. timing edges (backward retiming only)
271#if !defined(IGNORE_TIMING)
272 if (pManMR->maxDelay)
273 Vec_PtrForEachEntry(Abc_Obj_t *, FTIMEEDGES(pObj), pNext, i) {
274 if (!FTEST(pNext, VISITED_E) &&
275 FDIST(pObj, e, pNext, e) &&
276 dfsfast_e(pNext, pPred)) {
277#ifdef DEBUG_PRINT_FLOWS
278 printf("o");
279#endif
280 goto found;
281 }
282 }
283#endif
284 }
285
286 // unwind
287 if (FTEST(pObj, FLOW) &&
288 !FTEST(pObj, VISITED_R) &&
289 FDIST(pObj, e, pObj, r) &&
290 dfsfast_r(pObj, FGETPRED(pObj))) {
291
292 FUNSET(pObj, FLOW);
293 FSETPRED(pObj, NULL);
294#ifdef DEBUG_PRINT_FLOWS
295 printf("u");
296#endif
297 goto found;
298 }
299
300 not_found:
301 FUNSET(pObj, VISITED_E);
302 dfsfast_e_retreat(pObj);
303 return 0;
304
305 found:
306#ifdef DEBUG_PRINT_FLOWS
307 printf("%d ", Abc_ObjId(pObj));
308#endif
309 FUNSET(pObj, VISITED_E);
310 return 1;
311}
#define FDIST(xn, xe, yn, ye)
Definition fretFlow.c:33
int dfsfast_r(Abc_Obj_t *pObj, Abc_Obj_t *pPred)
Definition fretFlow.c:313
#define FSET(x, y)
Definition fretime.h:81
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dfsfast_preorder()

void dfsfast_preorder ( Abc_Ntk_t * pNtk)

FUNCTION DEFINITIONS ///.

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

Synopsis [Fast DFS.]

Description [Uses sink-distance-histogram heuristic. May not find all flow paths: this occurs in a small number of cases where the flow predecessor points to a non-adjacent node and the distance ordering is perturbed.]

SideEffects []

SeeAlso []

Definition at line 54 of file fretFlow.c.

54 {
55 Abc_Obj_t *pObj, *pNext;
56 Vec_Ptr_t *vTimeIn, *qn = Vec_PtrAlloc(Abc_NtkObjNum(pNtk));
57 Vec_Int_t *qe = Vec_IntAlloc(Abc_NtkObjNum(pNtk));
58 int i, j, d = 0, end;
59 int qpos = 0;
60
61 // create reverse timing edges for backward traversal
62#if !defined(IGNORE_TIMING)
63 if (pManMR->maxDelay) {
64 Abc_NtkForEachObj( pNtk, pObj, i ) {
65 Vec_PtrForEachEntry( Abc_Obj_t *, FTIMEEDGES(pObj), pNext, j ) {
66 vTimeIn = FDATA(pNext)->vNodes;
67 if (!vTimeIn) {
68 vTimeIn = FDATA(pNext)->vNodes = Vec_PtrAlloc(2);
69 }
70 Vec_PtrPush(vTimeIn, pObj);
71 }
72 }
73 }
74#endif
75
76 // clear histogram
77 assert(pManMR->vSinkDistHist);
78 memset(Vec_IntArray(pManMR->vSinkDistHist), 0, sizeof(int)*Vec_IntSize(pManMR->vSinkDistHist));
79
80 // seed queue : latches, PIOs, and blocks
81 Abc_NtkForEachObj( pNtk, pObj, i )
82 if (Abc_ObjIsPo(pObj) ||
83 Abc_ObjIsLatch(pObj) ||
84 (pManMR->fIsForward && FTEST(pObj, BLOCK_OR_CONS) & pManMR->constraintMask)) {
85 Vec_PtrPush(qn, pObj);
86 Vec_IntPush(qe, 'r');
87 FDATA(pObj)->r_dist = 1;
88 } else if (Abc_ObjIsPi(pObj) ||
89 (!pManMR->fIsForward && FTEST(pObj, BLOCK_OR_CONS) & pManMR->constraintMask)) {
90 Vec_PtrPush(qn, pObj);
91 Vec_IntPush(qe, 'e');
92 FDATA(pObj)->e_dist = 1;
93 }
94
95 // until queue is empty...
96 while(qpos < Vec_PtrSize(qn)) {
97 pObj = (Abc_Obj_t *)Vec_PtrEntry(qn, qpos);
98 assert(pObj);
99 end = Vec_IntEntry(qe, qpos);
100 qpos++;
101
102 if (end == 'r') {
103 d = FDATA(pObj)->r_dist;
104
105 // 1. structural edges
106 if (pManMR->fIsForward) {
107 Abc_ObjForEachFanin( pObj, pNext, i )
108 if (!FDATA(pNext)->e_dist) {
109 FDATA(pNext)->e_dist = d+1;
110 Vec_PtrPush(qn, pNext);
111 Vec_IntPush(qe, 'e');
112 }
113 } else
114 Abc_ObjForEachFanout( pObj, pNext, i )
115 if (!FDATA(pNext)->e_dist) {
116 FDATA(pNext)->e_dist = d+1;
117 Vec_PtrPush(qn, pNext);
118 Vec_IntPush(qe, 'e');
119 }
120
121 if (d == 1) continue;
122
123 // 2. reverse edges (forward retiming only)
124 if (pManMR->fIsForward) {
125 Abc_ObjForEachFanout( pObj, pNext, i )
126 if (!FDATA(pNext)->r_dist && !Abc_ObjIsLatch(pNext)) {
127 FDATA(pNext)->r_dist = d+1;
128 Vec_PtrPush(qn, pNext);
129 Vec_IntPush(qe, 'r');
130 }
131
132 // 3. timimg edges (forward retiming only)
133#if !defined(IGNORE_TIMING)
134 if (pManMR->maxDelay && FDATA(pObj)->vNodes)
135 Vec_PtrForEachEntry(Abc_Obj_t *, FDATA(pObj)->vNodes, pNext, i ) {
136 if (!FDATA(pNext)->r_dist) {
137 FDATA(pNext)->r_dist = d+1;
138 Vec_PtrPush(qn, pNext);
139 Vec_IntPush(qe, 'r');
140 }
141 }
142#endif
143 }
144
145 } else { // if 'e'
146 if (Abc_ObjIsLatch(pObj)) continue;
147
148 d = FDATA(pObj)->e_dist;
149
150 // 1. through node
151 if (!FDATA(pObj)->r_dist) {
152 FDATA(pObj)->r_dist = d+1;
153 Vec_PtrPush(qn, pObj);
154 Vec_IntPush(qe, 'r');
155 }
156
157 // 2. reverse edges (backward retiming only)
158 if (!pManMR->fIsForward) {
159 Abc_ObjForEachFanin( pObj, pNext, i )
160 if (!FDATA(pNext)->e_dist && !Abc_ObjIsLatch(pNext)) {
161 FDATA(pNext)->e_dist = d+1;
162 Vec_PtrPush(qn, pNext);
163 Vec_IntPush(qe, 'e');
164 }
165
166 // 3. timimg edges (backward retiming only)
167#if !defined(IGNORE_TIMING)
168 if (pManMR->maxDelay && FDATA(pObj)->vNodes)
169 Vec_PtrForEachEntry(Abc_Obj_t *, FDATA(pObj)->vNodes, pNext, i ) {
170 if (!FDATA(pNext)->e_dist) {
171 FDATA(pNext)->e_dist = d+1;
172 Vec_PtrPush(qn, pNext);
173 Vec_IntPush(qe, 'e');
174 }
175 }
176#endif
177 }
178 }
179 }
180
181 // free time edges
182#if !defined(IGNORE_TIMING)
183 if (pManMR->maxDelay) {
184 Abc_NtkForEachObj( pNtk, pObj, i ) {
185 vTimeIn = FDATA(pObj)->vNodes;
186 if (vTimeIn) {
187 Vec_PtrFree(vTimeIn);
188 FDATA(pObj)->vNodes = 0;
189 }
190 }
191 }
192#endif
193
194 Abc_NtkForEachObj( pNtk, pObj, i ) {
195 Vec_IntAddToEntry(pManMR->vSinkDistHist, FDATA(pObj)->r_dist, 1);
196 Vec_IntAddToEntry(pManMR->vSinkDistHist, FDATA(pObj)->e_dist, 1);
197
198#ifdef DEBUG_PREORDER
199 printf("node %d\t: r=%d\te=%d\n", Abc_ObjId(pObj), FDATA(pObj)->r_dist, FDATA(pObj)->e_dist);
200#endif
201 }
202
203 // printf("\t\tpre-ordered (max depth=%d)\n", d+1);
204
205 // deallocate
206 Vec_PtrFree( qn );
207 Vec_IntFree( qe );
208}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dfsfast_r()

int dfsfast_r ( Abc_Obj_t * pObj,
Abc_Obj_t * pPred )

Definition at line 313 of file fretFlow.c.

313 {
314 int i;
315 Abc_Obj_t *pNext, *pOldPred;
316
317 if (pManMR->fSinkDistTerminate) return 0;
318
319#ifdef DEBUG_VISITED
320 printf("(%dr=%d) ", Abc_ObjId(pObj), FDATA(pObj)->r_dist);
321#endif
322
323 // have we reached the sink?
324 if (Abc_ObjIsLatch(pObj) ||
325 (pManMR->fIsForward && Abc_ObjIsPo(pObj)) ||
326 (pManMR->fIsForward && FTEST(pObj, BLOCK_OR_CONS) & pManMR->constraintMask)) {
327 assert(pPred);
328 return 1;
329 }
330
331 FSET(pObj, VISITED_R);
332
333 if (FTEST(pObj, FLOW)) {
334
335 pOldPred = FGETPRED(pObj);
336 if (pOldPred &&
337 !FTEST(pOldPred, VISITED_E) &&
338 FDIST(pObj, r, pOldPred, e) &&
339 dfsfast_e(pOldPred, pOldPred)) {
340
341 FSETPRED(pObj, pPred);
342
343#ifdef DEBUG_PRINT_FLOWS
344 printf("fr");
345#endif
346 goto found;
347 }
348
349 } else {
350
351 if (!FTEST(pObj, VISITED_E) &&
352 FDIST(pObj, r, pObj, e) &&
353 dfsfast_e(pObj, pObj)) {
354
355 FSET(pObj, FLOW);
356 FSETPRED(pObj, pPred);
357
358#ifdef DEBUG_PRINT_FLOWS
359 printf("f");
360#endif
361 goto found;
362 }
363 }
364
365 // 2. reverse edges (forward retiming only)
366 if (pManMR->fIsForward) {
367 Abc_ObjForEachFanin( pObj, pNext, i ) {
368 if (!FTEST(pNext, VISITED_R) &&
369 FDIST(pObj, r, pNext, r) &&
370 !Abc_ObjIsLatch(pNext) &&
371 dfsfast_r(pNext, pPred)) {
372#ifdef DEBUG_PRINT_FLOWS
373 printf("i");
374#endif
375 goto found;
376 }
377 }
378
379 // 3. timing edges (forward retiming only)
380#if !defined(IGNORE_TIMING)
381 if (pManMR->maxDelay)
382 Vec_PtrForEachEntry(Abc_Obj_t*, FTIMEEDGES(pObj), pNext, i) {
383 if (!FTEST(pNext, VISITED_R) &&
384 FDIST(pObj, r, pNext, r) &&
385 dfsfast_r(pNext, pPred)) {
386#ifdef DEBUG_PRINT_FLOWS
387 printf("o");
388#endif
389 goto found;
390 }
391 }
392#endif
393 }
394
395 FUNSET(pObj, VISITED_R);
396 dfsfast_r_retreat(pObj);
397 return 0;
398
399 found:
400#ifdef DEBUG_PRINT_FLOWS
401 printf("%d ", Abc_ObjId(pObj));
402#endif
403 FUNSET(pObj, VISITED_R);
404 return 1;
405}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dfsplain_e()

int dfsplain_e ( Abc_Obj_t * pObj,
Abc_Obj_t * pPred )

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

Synopsis [Plain DFS.]

Description [Does not use sink-distance-histogram heuristic.]

SideEffects []

SeeAlso []

Definition at line 528 of file fretFlow.c.

528 {
529 int i;
530 Abc_Obj_t *pNext;
531
532 if (FTEST(pObj, BLOCK_OR_CONS) & pManMR->constraintMask ||
533 Abc_ObjIsPi(pObj)) {
534 assert(pPred);
535 assert(!pManMR->fIsForward);
536 return 1;
537 }
538
539 FSET(pObj, VISITED_E);
540
541 // printf(" %de\n", Abc_ObjId(pObj));
542
543 // 1. structural edges
544 if (pManMR->fIsForward)
545 Abc_ObjForEachFanout( pObj, pNext, i ) {
546 if (!FTEST(pNext, VISITED_R) &&
547 dfsplain_r(pNext, pPred)) {
548#ifdef DEBUG_PRINT_FLOWS
549 printf("o");
550#endif
551 goto found;
552 }
553 }
554 else
555 Abc_ObjForEachFanin( pObj, pNext, i ) {
556 if (!FTEST(pNext, VISITED_R) &&
557 dfsplain_r(pNext, pPred)) {
558#ifdef DEBUG_PRINT_FLOWS
559 printf("o");
560#endif
561 goto found;
562 }
563 }
564
565 if (Abc_ObjIsLatch(pObj))
566 return 0;
567
568 // 2. reverse edges (backward retiming only)
569 if (!pManMR->fIsForward) {
570 Abc_ObjForEachFanout( pObj, pNext, i ) {
571 if (!FTEST(pNext, VISITED_E) &&
572 dfsplain_e(pNext, pPred)) {
573#ifdef DEBUG_PRINT_FLOWS
574 printf("i");
575#endif
576 goto found;
577 }
578 }
579
580 // 3. timing edges (backward retiming only)
581#if !defined(IGNORE_TIMING)
582 if (pManMR->maxDelay)
583 Vec_PtrForEachEntry(Abc_Obj_t*, FTIMEEDGES(pObj), pNext, i) {
584 if (!FTEST(pNext, VISITED_E) &&
585 dfsplain_e(pNext, pPred)) {
586#ifdef DEBUG_PRINT_FLOWS
587 printf("o");
588#endif
589 goto found;
590 }
591 }
592#endif
593 }
594
595 // unwind
596 if (FTEST(pObj, FLOW) &&
597 !FTEST(pObj, VISITED_R) &&
598 dfsplain_r(pObj, FGETPRED(pObj))) {
599 FUNSET(pObj, FLOW);
600 FSETPRED(pObj, NULL);
601#ifdef DEBUG_PRINT_FLOWS
602 printf("u");
603#endif
604 goto found;
605 }
606
607 return 0;
608
609 found:
610#ifdef DEBUG_PRINT_FLOWS
611 printf("%d ", Abc_ObjId(pObj));
612#endif
613
614 return 1;
615}
int dfsplain_r(Abc_Obj_t *pObj, Abc_Obj_t *pPred)
Definition fretFlow.c:617
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dfsplain_r()

int dfsplain_r ( Abc_Obj_t * pObj,
Abc_Obj_t * pPred )

Definition at line 617 of file fretFlow.c.

617 {
618 int i;
619 Abc_Obj_t *pNext, *pOldPred;
620
621 // have we reached the sink?
622 if (Abc_ObjIsLatch(pObj) ||
623 (pManMR->fIsForward && Abc_ObjIsPo(pObj)) ||
624 (pManMR->fIsForward && FTEST(pObj, BLOCK_OR_CONS) & pManMR->constraintMask)) {
625 assert(pPred);
626 return 1;
627 }
628
629 FSET(pObj, VISITED_R);
630
631 // printf(" %dr\n", Abc_ObjId(pObj));
632
633 if (FTEST(pObj, FLOW)) {
634
635 pOldPred = FGETPRED(pObj);
636 if (pOldPred &&
637 !FTEST(pOldPred, VISITED_E) &&
638 dfsplain_e(pOldPred, pOldPred)) {
639
640 FSETPRED(pObj, pPred);
641
642#ifdef DEBUG_PRINT_FLOWS
643 printf("fr");
644#endif
645 goto found;
646 }
647
648 } else {
649
650 if (!FTEST(pObj, VISITED_E) &&
651 dfsplain_e(pObj, pObj)) {
652
653 FSET(pObj, FLOW);
654 FSETPRED(pObj, pPred);
655
656#ifdef DEBUG_PRINT_FLOWS
657 printf("f");
658#endif
659 goto found;
660 }
661 }
662
663 // 2. follow reverse edges
664 if (pManMR->fIsForward) { // forward retiming only
665 Abc_ObjForEachFanin( pObj, pNext, i ) {
666 if (!FTEST(pNext, VISITED_R) &&
667 !Abc_ObjIsLatch(pNext) &&
668 dfsplain_r(pNext, pPred)) {
669#ifdef DEBUG_PRINT_FLOWS
670 printf("i");
671#endif
672 goto found;
673 }
674 }
675
676 // 3. timing edges (forward only)
677#if !defined(IGNORE_TIMING)
678 if (pManMR->maxDelay)
679 Vec_PtrForEachEntry(Abc_Obj_t*, FTIMEEDGES(pObj), pNext, i) {
680 if (!FTEST(pNext, VISITED_R) &&
681 dfsplain_r(pNext, pPred)) {
682#ifdef DEBUG_PRINT_FLOWS
683 printf("o");
684#endif
685 goto found;
686 }
687 }
688#endif
689 }
690
691 return 0;
692
693 found:
694#ifdef DEBUG_PRINT_FLOWS
695 printf("%d ", Abc_ObjId(pObj));
696#endif
697 return 1;
698}
Here is the call graph for this function:
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}
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:

Variable Documentation

◆ pManMR

MinRegMan_t* pManMR
extern

Definition at line 52 of file fretMain.c.