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

Go to the source code of this file.

Functions

ABC_NAMESPACE_HEADER_START int Abc_NtkRetimeMinArea (Abc_Ntk_t *pNtk, int fForwardOnly, int fBackwardOnly, int fUseOldNames, int fVerbose)
 INCLUDES ///.
 
int Abc_NtkRetime (Abc_Ntk_t *pNtk, int Mode, int nDelayLim, int fForwardOnly, int fBackwardOnly, int fOneStep, int fUseOldNames, int fVerbose)
 FUNCTION DEFINITIONS ///.
 
int Abc_NtkRetimeMinDelay (Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkCopy, int nDelayLim, int nIterLimit, int fForward, int fVerbose)
 FUNCTION DEFINITIONS ///.
 
int Abc_NtkRetimeIncremental (Abc_Ntk_t *pNtk, int nDelayLim, int fForward, int fMinDelay, int fOneStep, int fUseOldNames, int fVerbose)
 FUNCTION DEFINITIONS ///.
 
void Abc_NtkRetimeShareLatches (Abc_Ntk_t *pNtk, int fInitial)
 
int Abc_NtkRetimeNodeIsEnabled (Abc_Obj_t *pObj, int fForward)
 
void Abc_NtkRetimeNode (Abc_Obj_t *pObj, int fForward, int fInitial)
 
st__tableAbc_NtkRetimePrepareLatches (Abc_Ntk_t *pNtk)
 
int Abc_NtkRetimeFinalizeLatches (Abc_Ntk_t *pNtk, st__table *tLatches, int nIdMaxStart, int fUseOldNames)
 
void Abc_NtkMaxFlowTest (Abc_Ntk_t *pNtk)
 FUNCTION DEFINITIONS ///.
 
Vec_Ptr_tAbc_NtkMaxFlow (Abc_Ntk_t *pNtk, int fForward, int fVerbose)
 
Vec_Int_tAbc_NtkRetimeInitialValues (Abc_Ntk_t *pNtkSat, Vec_Int_t *vValues, int fVerbose)
 FUNCTION DEFINITIONS ///.
 
int Abc_ObjSopSimulate (Abc_Obj_t *pObj)
 
void Abc_NtkRetimeTranferToCopy (Abc_Ntk_t *pNtk)
 
void Abc_NtkRetimeTranferFromCopy (Abc_Ntk_t *pNtk)
 
Vec_Int_tAbc_NtkRetimeCollectLatchValues (Abc_Ntk_t *pNtk)
 
void Abc_NtkRetimeInsertLatchValues (Abc_Ntk_t *pNtk, Vec_Int_t *vValues)
 
Abc_Ntk_tAbc_NtkRetimeBackwardInitialStart (Abc_Ntk_t *pNtk)
 
void Abc_NtkRetimeBackwardInitialFinish (Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkNew, Vec_Int_t *vValuesOld, int fVerbose)
 
int Abc_NtkRetimeLValue (Abc_Ntk_t *pNtk, int nIterLimit, int fVerbose)
 FUNCTION DEFINITIONS ///.
 

Function Documentation

◆ Abc_NtkMaxFlow()

Vec_Ptr_t * Abc_NtkMaxFlow ( Abc_Ntk_t * pNtk,
int fForward,
int fVerbose )
extern

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

Synopsis [Implementation of max-flow/min-cut computation.]

Description []

SideEffects []

SeeAlso []

Definition at line 143 of file retFlow.c.

144{
145 Vec_Ptr_t * vMinCut;
146 Abc_Obj_t * pLatch;
147 int Flow, FlowCur, RetValue, i;
148 abctime clk = Abc_Clock();
149 int fUseDirectedFlow = 1;
150
151 // find the max-flow
152 Abc_NtkCleanCopy( pNtk );
153 Flow = 0;
154 Abc_NtkIncrementTravId(pNtk);
155 Abc_NtkForEachLatch( pNtk, pLatch, i )
156 {
157 if ( fForward )
158 {
159// assert( !Abc_ObjFanout0(pLatch)->fMarkA );
160 FlowCur = Abc_NtkMaxFlowFwdPath2_rec( Abc_ObjFanout0(pLatch) );
161// FlowCur = Abc_NtkMaxFlowFwdPath3_rec( Abc_ObjFanout0(pLatch), pLatch, 1 );
162 Flow += FlowCur;
163 }
164 else
165 {
166 assert( !Abc_ObjFanin0(pLatch)->fMarkA );
167 FlowCur = Abc_NtkMaxFlowBwdPath2_rec( Abc_ObjFanin0(pLatch) );
168 Flow += FlowCur;
169 }
170 if ( FlowCur )
171 Abc_NtkIncrementTravId(pNtk);
172 }
173
174 if ( !fUseDirectedFlow )
175 {
176 Abc_NtkIncrementTravId(pNtk);
177 Abc_NtkForEachLatch( pNtk, pLatch, i )
178 {
179 if ( fForward )
180 {
181 // assert( !Abc_ObjFanout0(pLatch)->fMarkA );
182 FlowCur = Abc_NtkMaxFlowFwdPath_rec( Abc_ObjFanout0(pLatch) );
183 Flow += FlowCur;
184 }
185 else
186 {
187 assert( !Abc_ObjFanin0(pLatch)->fMarkA );
188 FlowCur = Abc_NtkMaxFlowBwdPath_rec( Abc_ObjFanin0(pLatch) );
189 Flow += FlowCur;
190 }
191 if ( FlowCur )
192 Abc_NtkIncrementTravId(pNtk);
193 }
194 }
195// Abc_NtkMaxFlowPrintFlow( pNtk, fForward );
196
197 // mark the nodes reachable from the latches
198 Abc_NtkIncrementTravId(pNtk);
199 Abc_NtkForEachLatch( pNtk, pLatch, i )
200 {
201 if ( fForward )
202 {
203// assert( !Abc_ObjFanout0(pLatch)->fMarkA );
204 if ( fUseDirectedFlow )
205 RetValue = Abc_NtkMaxFlowFwdPath2_rec( Abc_ObjFanout0(pLatch) );
206// RetValue = Abc_NtkMaxFlowFwdPath3_rec( Abc_ObjFanout0(pLatch), pLatch, 1 );
207 else
208 RetValue = Abc_NtkMaxFlowFwdPath_rec( Abc_ObjFanout0(pLatch) );
209 }
210 else
211 {
212 assert( !Abc_ObjFanin0(pLatch)->fMarkA );
213 if ( fUseDirectedFlow )
214 RetValue = Abc_NtkMaxFlowBwdPath2_rec( Abc_ObjFanin0(pLatch) );
215 else
216 RetValue = Abc_NtkMaxFlowBwdPath_rec( Abc_ObjFanin0(pLatch) );
217 }
218 assert( RetValue == 0 );
219 }
220
221 // find the min-cut with the smallest volume
222 vMinCut = Abc_NtkMaxFlowMinCut( pNtk, fForward );
223 // verify the cut
224 if ( !Abc_NtkMaxFlowVerifyCut(pNtk, vMinCut, fForward) )
225 printf( "Abc_NtkMaxFlow() error! The computed min-cut is not a cut!\n" );
226 // make the cut retimable
227 Abc_NtkMaxFlowMinCutUpdate( pNtk, vMinCut, fForward );
228
229 // report the results
230 if ( fVerbose )
231 {
232 printf( "L = %6d. %s max-flow = %6d. Min-cut = %6d. ",
233 Abc_NtkLatchNum(pNtk), fForward? "Forward " : "Backward", Flow, Vec_PtrSize(vMinCut) );
234ABC_PRT( "Time", Abc_Clock() - clk );
235 }
236
237// Abc_NtkMaxFlowPrintCut( pNtk, vMinCut );
238 return vMinCut;
239}
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition abc.h:500
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition abcUtil.c:540
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_PRT(a, t)
Definition abc_global.h:255
#define assert(ex)
Definition util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkMaxFlowTest()

void Abc_NtkMaxFlowTest ( Abc_Ntk_t * pNtk)
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Test-bench for the max-flow computation.]

Description []

SideEffects []

SeeAlso []

Definition at line 104 of file retFlow.c.

105{
106 Vec_Ptr_t * vMinCut;
107 Abc_Obj_t * pObj;
108 int i;
109
110 // forward flow
111 Abc_NtkForEachPo( pNtk, pObj, i )
112 pObj->fMarkA = 1;
113 Abc_NtkForEachLatch( pNtk, pObj, i )
114 pObj->fMarkA = Abc_ObjFanin0(pObj)->fMarkA = 1;
115// Abc_ObjFanin0(pObj)->fMarkA = 1;
116 vMinCut = Abc_NtkMaxFlow( pNtk, 1, 1 );
117 Vec_PtrFree( vMinCut );
118 Abc_NtkCleanMarkA( pNtk );
119
120 // backward flow
121 Abc_NtkForEachPi( pNtk, pObj, i )
122 pObj->fMarkA = 1;
123 Abc_NtkForEachLatch( pNtk, pObj, i )
124 pObj->fMarkA = Abc_ObjFanout0(pObj)->fMarkA = 1;
125// Abc_ObjFanout0(pObj)->fMarkA = 1;
126 vMinCut = Abc_NtkMaxFlow( pNtk, 0, 1 );
127 Vec_PtrFree( vMinCut );
128 Abc_NtkCleanMarkA( pNtk );
129
130}
ABC_DLL void Abc_NtkCleanMarkA(Abc_Ntk_t *pNtk)
Definition abcUtil.c:696
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition abc.h:520
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition abc.h:516
Vec_Ptr_t * Abc_NtkMaxFlow(Abc_Ntk_t *pNtk, int fForward, int fVerbose)
Definition retFlow.c:143
unsigned fMarkA
Definition abc.h:134
Here is the call graph for this function:

◆ Abc_NtkRetime()

int Abc_NtkRetime ( Abc_Ntk_t * pNtk,
int Mode,
int nDelayLim,
int fForwardOnly,
int fBackwardOnly,
int fOneStep,
int fUseOldNames,
int fVerbose )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Implementation of retiming.]

Description []

SideEffects []

SeeAlso []

Definition at line 47 of file retCore.c.

48{
49 int nLatches = Abc_NtkLatchNum(pNtk);
50 int nLevels = Abc_NtkLevel(pNtk);
51 int RetValue = 0;
52 abctime clkTotal = Abc_Clock();
53 int nNodesOld, nLatchesOld;
54 assert( Mode > 0 && Mode < 7 );
55 assert( !fForwardOnly || !fBackwardOnly );
56
57 // cleanup the network
58 nNodesOld = Abc_NtkNodeNum(pNtk);
59 nLatchesOld = Abc_NtkLatchNum(pNtk);
60 Abc_NtkCleanupSeq(pNtk, 0, 0, 0);
61 if ( nNodesOld > Abc_NtkNodeNum(pNtk) || nLatchesOld > Abc_NtkLatchNum(pNtk) )
62 printf( "Cleanup before retiming removed %d dangling nodes and %d dangling latches.\n",
63 nNodesOld - Abc_NtkNodeNum(pNtk), nLatchesOld - Abc_NtkLatchNum(pNtk) );
64
65 // perform retiming
66 switch ( Mode )
67 {
68 case 1: // forward
69 RetValue = Abc_NtkRetimeIncremental( pNtk, nDelayLim, 1, 0, 0, fUseOldNames, fVerbose );
70 break;
71 case 2: // backward
72 RetValue = Abc_NtkRetimeIncremental( pNtk, nDelayLim, 0, 0, 0, fUseOldNames, fVerbose );
73 break;
74 case 3: // min-area
75 RetValue = Abc_NtkRetimeMinArea( pNtk, fForwardOnly, fBackwardOnly, fUseOldNames, fVerbose );
76 break;
77 case 4: // min-delay
78 if ( !fBackwardOnly )
79 RetValue += Abc_NtkRetimeIncremental( pNtk, nDelayLim, 1, 1, fOneStep, fUseOldNames, fVerbose );
80 if ( !fForwardOnly )
81 RetValue += Abc_NtkRetimeIncremental( pNtk, nDelayLim, 0, 1, fOneStep, fUseOldNames, fVerbose );
82 break;
83 case 5: // min-area + min-delay
84 RetValue = Abc_NtkRetimeMinArea( pNtk, fForwardOnly, fBackwardOnly, fUseOldNames, fVerbose );
85 if ( !fBackwardOnly )
86 RetValue += Abc_NtkRetimeIncremental( pNtk, nDelayLim, 1, 1, 0, fUseOldNames, fVerbose );
87 if ( !fForwardOnly )
88 RetValue += Abc_NtkRetimeIncremental( pNtk, nDelayLim, 0, 1, 0, fUseOldNames, fVerbose );
89 break;
90 case 6: // Pan's algorithm
91 RetValue = Abc_NtkRetimeLValue( pNtk, 500, fVerbose );
92 break;
93 default:
94 printf( "Unknown retiming option.\n" );
95 break;
96 }
97 if ( fVerbose )
98 {
99 printf( "Reduction in area = %3d. Reduction in delay = %3d. ",
100 nLatches - Abc_NtkLatchNum(pNtk), nLevels - Abc_NtkLevel(pNtk) );
101 ABC_PRT( "Total runtime", Abc_Clock() - clkTotal );
102 }
103 timeRetime = Abc_Clock() - clkTotal;
104 return RetValue;
105}
int timeRetime
DECLARATIONS ///.
Definition retCore.c:30
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition abcDfs.c:1449
ABC_DLL int Abc_NtkCleanupSeq(Abc_Ntk_t *pNtk, int fLatchSweep, int fAutoSweep, int fVerbose)
Definition abcSweep.c:919
int Abc_NtkRetimeMinArea(Abc_Ntk_t *pNtk, int fForwardOnly, int fBackwardOnly, int fUseOldNames, int fVerbose)
FUNCTION DEFINITIONS ///.
Definition retArea.c:53
int Abc_NtkRetimeIncremental(Abc_Ntk_t *pNtk, int nDelayLim, int fForward, int fMinDelay, int fOneStep, int fUseOldNames, int fVerbose)
FUNCTION DEFINITIONS ///.
Definition retIncrem.c:47
int Abc_NtkRetimeLValue(Abc_Ntk_t *pNtk, int nIterLimit, int fVerbose)
FUNCTION DEFINITIONS ///.
Definition retLvalue.c:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkRetimeBackwardInitialFinish()

void Abc_NtkRetimeBackwardInitialFinish ( Abc_Ntk_t * pNtk,
Abc_Ntk_t * pNtkNew,
Vec_Int_t * vValuesOld,
int fVerbose )
extern

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

Synopsis [Transfer latch initial values to pCopy.]

Description []

SideEffects []

SeeAlso []

Definition at line 279 of file retInit.c.

280{
281 Vec_Int_t * vValuesNew;
282 Abc_Obj_t * pObj;
283 int i;
284 // create PIs corresponding to the initial values
285 Abc_NtkForEachObj( pNtk, pObj, i )
286 if ( Abc_ObjIsLatch(pObj) )
287 Abc_ObjAddFanin( pObj->pCopy, Abc_NtkCreatePi(pNtkNew) );
288 // assign dummy node names
289 Abc_NtkAddDummyPiNames( pNtkNew );
290 Abc_NtkAddDummyPoNames( pNtkNew );
291 // check the network
292 if ( !Abc_NtkCheck( pNtkNew ) )
293 fprintf( stdout, "Abc_NtkRetimeBackwardInitialFinish(): Network check has failed.\n" );
294 // derive new initial values
295 vValuesNew = Abc_NtkRetimeInitialValues( pNtkNew, vValuesOld, fVerbose );
296 // insert new initial values
297 Abc_NtkRetimeInsertLatchValues( pNtk, vValuesNew );
298 if ( vValuesNew ) Vec_IntFree( vValuesNew );
299}
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition abcFanio.c:84
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition abcCheck.c:64
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition abc.h:449
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
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
void Abc_NtkRetimeInsertLatchValues(Abc_Ntk_t *pNtk, Vec_Int_t *vValues)
Definition retInit.c:231
Vec_Int_t * Abc_NtkRetimeInitialValues(Abc_Ntk_t *pNtkCone, Vec_Int_t *vValues, int fVerbose)
FUNCTION DEFINITIONS ///.
Definition retInit.c:47
Abc_Obj_t * pCopy
Definition abc.h:148
Here is the call graph for this function:

◆ Abc_NtkRetimeBackwardInitialStart()

Abc_Ntk_t * Abc_NtkRetimeBackwardInitialStart ( Abc_Ntk_t * pNtk)
extern

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

Synopsis [Transfer latch initial values to pCopy.]

Description []

SideEffects []

SeeAlso []

Definition at line 254 of file retInit.c.

255{
256 Abc_Ntk_t * pNtkNew;
257 Abc_Obj_t * pObj;
258 int i;
259 // create the network used for the initial state computation
260 pNtkNew = Abc_NtkAlloc( ABC_NTK_LOGIC, ABC_FUNC_SOP, 1 );
261 // create POs corresponding to the initial values
262 Abc_NtkForEachObj( pNtk, pObj, i )
263 if ( Abc_ObjIsLatch(pObj) )
264 pObj->pCopy = Abc_NtkCreatePo(pNtkNew);
265 return pNtkNew;
266}
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition abcNtk.c:53
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
@ ABC_NTK_LOGIC
Definition abc.h:57
@ ABC_FUNC_SOP
Definition abc.h:65
Here is the call graph for this function:

◆ Abc_NtkRetimeCollectLatchValues()

Vec_Int_t * Abc_NtkRetimeCollectLatchValues ( Abc_Ntk_t * pNtk)
extern

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

Synopsis [Transfer latch initial values to pCopy.]

Description []

SideEffects []

SeeAlso []

Definition at line 208 of file retInit.c.

209{
210 Vec_Int_t * vValues;
211 Abc_Obj_t * pObj;
212 int i;
213 vValues = Vec_IntAlloc( Abc_NtkLatchNum(pNtk) );
214 Abc_NtkForEachObj( pNtk, pObj, i )
215 if ( Abc_ObjIsLatch(pObj) )
216 Vec_IntPush( vValues, Abc_LatchIsInit1(pObj) );
217 return vValues;
218}

◆ Abc_NtkRetimeFinalizeLatches()

int Abc_NtkRetimeFinalizeLatches ( Abc_Ntk_t * pNtk,
st__table * tLatches,
int nIdMaxStart,
int fUseOldNames )
extern

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

Synopsis [Finalizes the latches after retiming.]

Description [Reuses the LIs/LOs for old latches.]

SideEffects []

SeeAlso []

Definition at line 146 of file retIncrem.c.

147{
148 Vec_Ptr_t * vCisOld, * vCosOld, * vBoxesOld, * vCisNew, * vCosNew, * vBoxesNew;
149 Abc_Obj_t * pObj, * pLatch, * pLatchIn, * pLatchOut;
150 int i, Index;
151 // create new arrays
152 vCisOld = pNtk->vCis; pNtk->vCis = NULL; vCisNew = Vec_PtrAlloc( 100 );
153 vCosOld = pNtk->vCos; pNtk->vCos = NULL; vCosNew = Vec_PtrAlloc( 100 );
154 vBoxesOld = pNtk->vBoxes; pNtk->vBoxes = NULL; vBoxesNew = Vec_PtrAlloc( 100 );
155 // copy boxes and their CIs/COs
156 Vec_PtrForEachEntryStop( Abc_Obj_t *, vCisOld, pObj, i, Vec_PtrSize(vCisOld) - st__count(tLatches) )
157 Vec_PtrPush( vCisNew, pObj );
158 Vec_PtrForEachEntryStop( Abc_Obj_t *, vCosOld, pObj, i, Vec_PtrSize(vCosOld) - st__count(tLatches) )
159 Vec_PtrPush( vCosNew, pObj );
160 Vec_PtrForEachEntryStop( Abc_Obj_t *, vBoxesOld, pObj, i, Vec_PtrSize(vBoxesOld) - st__count(tLatches) )
161 Vec_PtrPush( vBoxesNew, pObj );
162 // go through the latches
163 Abc_NtkForEachObj( pNtk, pLatch, i )
164 {
165 if ( !Abc_ObjIsLatch(pLatch) )
166 continue;
167 if ( Abc_ObjId(pLatch) >= (unsigned)nIdMaxStart )
168 {
169 // this is a new latch
170 pLatchIn = Abc_NtkCreateBi(pNtk);
171 pLatchOut = Abc_NtkCreateBo(pNtk);
172
173 if ( fUseOldNames )
174 {
175 Abc_ObjAssignName( pLatchOut, Abc_ObjName(pLatch), "_out" );
176 Abc_ObjAssignName( pLatchIn, Abc_ObjName(pLatch), "_in" );
177 }
178 else
179 {
180 Abc_ObjAssignName( pLatchOut, Abc_ObjName(Abc_ObjFanin0(pLatch)), "_o2" );
181 Abc_ObjAssignName( pLatchIn, Abc_ObjName(Abc_ObjFanin0(pLatch)), "_i2" );
182 }
183 }
184 else
185 {
186 // this is an old latch
187 // get its number in the original order
188 if ( ! st__lookup_int( tLatches, (char *)pLatch, &Index ) )
189 {
190 printf( "Abc_NtkRetimeFinalizeLatches(): Internal error.\n" );
191 return 0;
192 }
193 assert( pLatch == Vec_PtrEntry(vBoxesOld, Vec_PtrSize(vBoxesOld) - st__count(tLatches) + Index) );
194 // reconnect with the old LIs/LOs
195 pLatchIn = (Abc_Obj_t *)Vec_PtrEntry( vCosOld, Vec_PtrSize(vCosOld) - st__count(tLatches) + Index );
196 pLatchOut = (Abc_Obj_t *)Vec_PtrEntry( vCisOld, Vec_PtrSize(vCisOld) - st__count(tLatches) + Index );
197 }
198 // connect
199 Abc_ObjAddFanin( pLatchIn, Abc_ObjFanin0(pLatch) );
200 Abc_ObjPatchFanin( pLatch, Abc_ObjFanin0(pLatch), pLatchIn );
201 if ( Abc_ObjFanoutNum(pLatch) > 0 )
202 Abc_ObjTransferFanout( pLatch, pLatchOut );
203 Abc_ObjAddFanin( pLatchOut, pLatch );
204 // add to the arrays
205 Vec_PtrPush( vCisNew, pLatchOut );
206 Vec_PtrPush( vCosNew, pLatchIn );
207 Vec_PtrPush( vBoxesNew, pLatch );
208 }
209 // free useless Cis/Cos
210 Vec_PtrForEachEntry( Abc_Obj_t *, vCisOld, pObj, i )
211 if ( !Abc_ObjIsPi(pObj) && Abc_ObjFaninNum(pObj) == 0 && Abc_ObjFanoutNum(pObj) == 0 )
212 Abc_NtkDeleteObj(pObj);
213 Vec_PtrForEachEntry( Abc_Obj_t *, vCosOld, pObj, i )
214 if ( !Abc_ObjIsPo(pObj) && Abc_ObjFaninNum(pObj) == 0 && Abc_ObjFanoutNum(pObj) == 0 )
215 Abc_NtkDeleteObj(pObj);
216 // set the new arrays
217 pNtk->vCis = vCisNew; Vec_PtrFree( vCisOld );
218 pNtk->vCos = vCosNew; Vec_PtrFree( vCosOld );
219 pNtk->vBoxes = vBoxesNew; Vec_PtrFree( vBoxesOld );
220 return 1;
221}
ABC_DLL void Abc_NtkDeleteObj(Abc_Obj_t *pObj)
Definition abcObj.c:170
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition abcNames.c:49
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition abcNames.c:69
ABC_DLL void Abc_ObjTransferFanout(Abc_Obj_t *pObjOld, Abc_Obj_t *pObjNew)
Definition abcFanio.c:292
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
Definition abcFanio.c:172
int st__lookup_int(st__table *table, char *key, int *value)
Definition st.c:134
#define st__count(table)
Definition st.h:71
Vec_Ptr_t * vCis
Definition abc.h:165
Vec_Ptr_t * vCos
Definition abc.h:166
Vec_Ptr_t * vBoxes
Definition abc.h:168
#define Vec_PtrForEachEntryStop(Type, vVec, pEntry, i, Stop)
Definition vecPtr.h:59
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkRetimeIncremental()

int Abc_NtkRetimeIncremental ( Abc_Ntk_t * pNtk,
int nDelayLim,
int fForward,
int fMinDelay,
int fOneStep,
int fUseOldNames,
int fVerbose )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Performs retiming in one direction.]

Description [Currently does not retime over black boxes.]

SideEffects []

SeeAlso []

Definition at line 47 of file retIncrem.c.

48{
49 Abc_Ntk_t * pNtkCopy = NULL;
50 Vec_Ptr_t * vBoxes;
51 st__table * tLatches;
52 int nLatches = Abc_NtkLatchNum(pNtk);
53 int nIdMaxStart = Abc_NtkObjNumMax(pNtk);
54 int RetValue;
55 int nIterLimit = -1; // Suppress "might be used uninitialized"
56 if ( Abc_NtkNodeNum(pNtk) == 0 )
57 return 0;
58 // reorder CI/CO/latch inputs
59 Abc_NtkOrderCisCos( pNtk );
60 if ( fMinDelay )
61 {
62 nIterLimit = fOneStep? 1 : 2 * Abc_NtkLevel(pNtk);
63 pNtkCopy = Abc_NtkDup( pNtk );
64 tLatches = Abc_NtkRetimePrepareLatches( pNtkCopy );
65 st__free_table( tLatches );
66 }
67 // collect latches and remove CIs/COs
68 tLatches = Abc_NtkRetimePrepareLatches( pNtk );
69 // share the latches
70 Abc_NtkRetimeShareLatches( pNtk, 0 );
71 // save boxes
72 vBoxes = pNtk->vBoxes; pNtk->vBoxes = NULL;
73 // perform the retiming
74 if ( fMinDelay )
75 Abc_NtkRetimeMinDelay( pNtk, pNtkCopy, nDelayLim, nIterLimit, fForward, fVerbose );
76 else
77 Abc_NtkRetimeOneWay( pNtk, fForward, fVerbose );
78 if ( fMinDelay )
79 Abc_NtkDelete( pNtkCopy );
80 // share the latches
81 Abc_NtkRetimeShareLatches( pNtk, 0 );
82 // restore boxes
83 pNtk->vBoxes = vBoxes;
84 // finalize the latches
85 RetValue = Abc_NtkRetimeFinalizeLatches( pNtk, tLatches, nIdMaxStart, fUseOldNames );
86 st__free_table( tLatches );
87 if ( RetValue == 0 )
88 return 0;
89 // fix the COs
90// Abc_NtkLogicMakeSimpleCos( pNtk, 0 );
91 // check for correctness
92 if ( !Abc_NtkCheck( pNtk ) )
93 fprintf( stdout, "Abc_NtkRetimeForward(): Network check has failed.\n" );
94 // return the number of latches saved
95 return nLatches - Abc_NtkLatchNum(pNtk);
96}
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition abcNtk.c:1421
ABC_DLL void Abc_NtkOrderCisCos(Abc_Ntk_t *pNtk)
Definition abcUtil.c:76
ABC_DLL Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
Definition abcNtk.c:472
int Abc_NtkRetimeMinDelay(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkCopy, int nDelayLim, int nIterLimit, int fForward, int fVerbose)
FUNCTION DEFINITIONS ///.
Definition retDelay.c:50
void Abc_NtkRetimeShareLatches(Abc_Ntk_t *pNtk, int fInitial)
Definition retIncrem.c:436
int Abc_NtkRetimeFinalizeLatches(Abc_Ntk_t *pNtk, st__table *tLatches, int nIdMaxStart, int fUseOldNames)
Definition retIncrem.c:146
st__table * Abc_NtkRetimePrepareLatches(Abc_Ntk_t *pNtk)
Definition retIncrem.c:109
void st__free_table(st__table *table)
Definition st.c:81
Definition st.h:52
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkRetimeInitialValues()

Vec_Int_t * Abc_NtkRetimeInitialValues ( Abc_Ntk_t * pNtkCone,
Vec_Int_t * vValues,
int fVerbose )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Computes initial values of the new latches.]

Description []

SideEffects []

SeeAlso []

Definition at line 47 of file retInit.c.

48{
49 Vec_Int_t * vSolution;
50 Abc_Ntk_t * pNtkMiter, * pNtkLogic;
51 int RetValue;
52 abctime clk;
53 if ( pNtkCone == NULL )
54 return Vec_IntDup( vValues );
55 // convert the target network to AIG
56 pNtkLogic = Abc_NtkDup( pNtkCone );
57 Abc_NtkToAig( pNtkLogic );
58 // get the miter
59 pNtkMiter = Abc_NtkCreateTarget( pNtkLogic, pNtkLogic->vCos, vValues );
60 if ( fVerbose )
61 printf( "The miter for initial state computation has %d AIG nodes. ", Abc_NtkNodeNum(pNtkMiter) );
62 // solve the miter
63 clk = Abc_Clock();
64 RetValue = Abc_NtkMiterSat( pNtkMiter, (ABC_INT64_T)500000, (ABC_INT64_T)50000000, 0, NULL, NULL );
65 if ( fVerbose )
66 { ABC_PRT( "SAT solving time", Abc_Clock() - clk ); }
67 // analyze the result
68 if ( RetValue == 1 )
69 printf( "Abc_NtkRetimeInitialValues(): The problem is unsatisfiable. DC latch values are used.\n" );
70 else if ( RetValue == -1 )
71 printf( "Abc_NtkRetimeInitialValues(): The SAT problem timed out. DC latch values are used.\n" );
72 else if ( !Abc_NtkRetimeVerifyModel( pNtkCone, vValues, pNtkMiter->pModel ) )
73 printf( "Abc_NtkRetimeInitialValues(): The computed counter-example is incorrect.\n" );
74 // set the values of the latches
75 vSolution = RetValue? NULL : Vec_IntAllocArray( pNtkMiter->pModel, Abc_NtkPiNum(pNtkLogic) );
76 pNtkMiter->pModel = NULL;
77 Abc_NtkDelete( pNtkMiter );
78 Abc_NtkDelete( pNtkLogic );
79 return vSolution;
80}
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_NtkToAig(Abc_Ntk_t *pNtk)
Definition abcFunc.c:1333
ABC_DLL Abc_Ntk_t * Abc_NtkCreateTarget(Abc_Ntk_t *pNtk, Vec_Ptr_t *vRoots, Vec_Int_t *vValues)
Definition abcNtk.c:1200
int * pModel
Definition abc.h:198
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkRetimeInsertLatchValues()

void Abc_NtkRetimeInsertLatchValues ( Abc_Ntk_t * pNtk,
Vec_Int_t * vValues )
extern

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

Synopsis [Transfer latch initial values from pCopy.]

Description []

SideEffects []

SeeAlso []

Definition at line 231 of file retInit.c.

232{
233 Abc_Obj_t * pObj;
234 int i, Counter = 0;
235 Abc_NtkForEachObj( pNtk, pObj, i )
236 if ( Abc_ObjIsLatch(pObj) )
237 pObj->pCopy = (Abc_Obj_t *)(ABC_PTRUINT_T)Counter++;
238 Abc_NtkForEachObj( pNtk, pObj, i )
239 if ( Abc_ObjIsLatch(pObj) )
240 pObj->pData = (Abc_Obj_t *)(ABC_PTRUINT_T)(vValues? (Vec_IntEntry(vValues,(int)(ABC_PTRUINT_T)pObj->pCopy)? ABC_INIT_ONE : ABC_INIT_ZERO) : ABC_INIT_DC);
241}
@ ABC_INIT_ZERO
Definition abc.h:104
@ ABC_INIT_ONE
Definition abc.h:105
@ ABC_INIT_DC
Definition abc.h:106
void * pData
Definition abc.h:145
Here is the caller graph for this function:

◆ Abc_NtkRetimeLValue()

int Abc_NtkRetimeLValue ( Abc_Ntk_t * pNtk,
int nIterLimit,
int fVerbose )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Implements Pan's retiming algorithm.]

Description []

SideEffects []

SeeAlso []

Definition at line 61 of file retLvalue.c.

62{
63 Vec_Int_t * vLags;
64 int nLatches = Abc_NtkLatchNum(pNtk);
65 assert( Abc_NtkIsLogic( pNtk ) );
66 // get the lags
67 vLags = Abc_NtkRetimeGetLags( pNtk, nIterLimit, fVerbose );
68 // compute the retiming
69// Abc_NtkRetimeUsingLags( pNtk, vLags, fVerbose );
70 Vec_IntFree( vLags );
71 // fix the COs
72// Abc_NtkLogicMakeSimpleCos( pNtk, 0 );
73 // check for correctness
74 if ( !Abc_NtkCheck( pNtk ) )
75 fprintf( stdout, "Abc_NtkRetimeLValue(): Network check has failed.\n" );
76 // return the number of latches saved
77 return nLatches - Abc_NtkLatchNum(pNtk);
78}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkRetimeMinArea()

ABC_NAMESPACE_HEADER_START int Abc_NtkRetimeMinArea ( Abc_Ntk_t * pNtk,
int fForwardOnly,
int fBackwardOnly,
int fUseOldNames,
int fVerbose )
extern

INCLUDES ///.

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

FileName [retInt.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Retiming package.]

Synopsis [Internal declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - Oct 31, 2006.]

Revision [

Id
retInt.h,v 1.00 2006/10/31 00:00:00 alanmi Exp

] PARAMETERS /// STRUCTURE DEFINITIONS /// MACRO DEFINITIONS /// FUNCTION DECLARATIONS ///

INCLUDES ///.

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

Synopsis [Performs min-area retiming.]

Description [Returns the number of latches reduced.]

SideEffects []

SeeAlso []

Definition at line 53 of file retArea.c.

54{
55 Abc_Ntk_t * pNtkTotal = NULL, * pNtkBottom;
56 Vec_Int_t * vValuesNew = NULL, * vValues;
57 int nLatches = Abc_NtkLatchNum(pNtk);
58 int fOneFrame = 0;
59 assert( !fForwardOnly || !fBackwardOnly );
60 // there should not be black boxes
61 assert( Abc_NtkIsSopLogic(pNtk) );
62 assert( Abc_NtkLatchNum(pNtk) == Vec_PtrSize(pNtk->vBoxes) );
63 // reorder CI/CO/latch inputs
64 Abc_NtkOrderCisCos( pNtk );
65 // perform forward retiming
66 if ( !fBackwardOnly )
67 {
68 if ( fOneFrame )
69 Abc_NtkRetimeMinAreaOne( pNtk, 1, fUseOldNames, fVerbose );
70 else
71 while ( Abc_NtkRetimeMinAreaOne( pNtk, 1, fUseOldNames, fVerbose ) );
72 }
73 // remember initial values
74 vValues = Abc_NtkCollectLatchValues( pNtk );
75 // perform backward retiming
76 if ( !fForwardOnly )
77 {
78 if ( fOneFrame )
79 pNtkTotal = Abc_NtkRetimeMinAreaOne( pNtk, 0, fUseOldNames, fVerbose );
80 else
81 while ( (pNtkBottom = Abc_NtkRetimeMinAreaOne( pNtk, 0, fUseOldNames, fVerbose )) )
82 pNtkTotal = Abc_NtkAttachBottom( pNtkTotal, pNtkBottom );
83 }
84 // compute initial values
85 vValuesNew = Abc_NtkRetimeInitialValues( pNtkTotal, vValues, fVerbose );
86 if ( pNtkTotal ) Abc_NtkDelete( pNtkTotal );
87 // insert new initial values
88 Abc_NtkInsertLatchValues( pNtk, vValuesNew );
89 if ( vValuesNew ) Vec_IntFree( vValuesNew );
90 if ( vValues ) Vec_IntFree( vValues );
91 // fix the COs (this changes the circuit structure)
92// Abc_NtkLogicMakeSimpleCos( pNtk, 0 );
93 // check for correctness
94 if ( !Abc_NtkCheck( pNtk ) )
95 fprintf( stdout, "Abc_NtkRetimeMinArea(): Network check has failed.\n" );
96 // return the number of latches saved
97 return nLatches - Abc_NtkLatchNum(pNtk);
98}
ABC_DLL void Abc_NtkInsertLatchValues(Abc_Ntk_t *pNtk, Vec_Int_t *vValues)
Definition abcLatch.c:235
ABC_DLL Vec_Int_t * Abc_NtkCollectLatchValues(Abc_Ntk_t *pNtk)
Definition abcLatch.c:181
Abc_Ntk_t * Abc_NtkAttachBottom(Abc_Ntk_t *pNtkTop, Abc_Ntk_t *pNtkBottom)
Definition abcNtk.c:866
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkRetimeMinDelay()

int Abc_NtkRetimeMinDelay ( Abc_Ntk_t * pNtk,
Abc_Ntk_t * pNtkCopy,
int nDelayLim,
int nIterLimit,
int fForward,
int fVerbose )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Retimes incrementally for minimum delay.]

Description [This procedure cannot be called in the application code because it assumes that the network is preprocessed by removing LIs/LOs.]

SideEffects []

SeeAlso []

Definition at line 50 of file retDelay.c.

51{
52 int IterBest, DelayBest;
53 int IterBest2, DelayBest2;
54 // try to find the best delay iteration on a copy
55 DelayBest = Abc_NtkRetimeMinDelayTry( pNtkCopy, nDelayLim, fForward, 0, nIterLimit, &IterBest, fVerbose );
56 if ( IterBest == 0 )
57 return 1;
58 // perform the given number of iterations on the original network
59 DelayBest2 = Abc_NtkRetimeMinDelayTry( pNtk, nDelayLim, fForward, 1, IterBest, &IterBest2, fVerbose );
60 assert( DelayBest == DelayBest2 );
61 assert( IterBest == IterBest2 );
62 return 1;
63}
Here is the caller graph for this function:

◆ Abc_NtkRetimeNode()

void Abc_NtkRetimeNode ( Abc_Obj_t * pObj,
int fForward,
int fInitial )
extern

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

Synopsis [Retimes the node backward or forward.]

Description []

SideEffects []

SeeAlso []

Definition at line 324 of file retIncrem.c.

325{
326 Abc_Ntk_t * pNtkNew = NULL;
327 Vec_Ptr_t * vNodes;
328 Abc_Obj_t * pNext, * pLatch;
329 int i;
330 vNodes = Vec_PtrAlloc( 10 );
331 if ( fForward )
332 {
333 // compute the initial value
334 if ( fInitial )
335 pObj->pCopy = (Abc_Obj_t *)(ABC_PTRUINT_T)Abc_ObjSopSimulate( pObj );
336 // collect fanins
337 Abc_NodeCollectFanins( pObj, vNodes );
338 // make the node point to the fanins fanins
339 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNext, i )
340 {
341 assert( Abc_ObjIsLatch(pNext) );
342 Abc_ObjPatchFanin( pObj, pNext, Abc_ObjFanin0(pNext) );
343 if ( Abc_ObjFanoutNum(pNext) == 0 )
344 Abc_NtkDeleteObj(pNext);
345 }
346 // add a new latch on top
347 pNext = Abc_NtkCreateLatch(pObj->pNtk);
348 if ( Abc_ObjFanoutNum(pObj) > 0 )
349 Abc_ObjTransferFanout( pObj, pNext );
350 Abc_ObjAddFanin( pNext, pObj );
351 // set the initial value
352 if ( fInitial )
353 pNext->pCopy = pObj->pCopy;
354 }
355 else
356 {
357 // compute the initial value
358 if ( fInitial )
359 {
360 pNtkNew = Abc_ObjFanout0(pObj)->pCopy->pNtk;
361 Abc_NtkDupObj( pNtkNew, pObj, 0 );
362 Abc_ObjForEachFanout( pObj, pNext, i )
363 {
364 assert( Abc_ObjFaninNum(pNext->pCopy) == 0 );
365 Abc_ObjAddFanin( pNext->pCopy, pObj->pCopy );
366 }
367 }
368 // collect fanouts
369 Abc_NodeCollectFanouts( pObj, vNodes );
370 // make the fanouts fanouts point to the node
371 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNext, i )
372 {
373 assert( Abc_ObjIsLatch(pNext) );
374 Abc_ObjTransferFanout( pNext, pObj );
375 Abc_NtkDeleteObj( pNext );
376 }
377 // add new latches to the fanins
378 Abc_ObjForEachFanin( pObj, pNext, i )
379 {
380 pLatch = Abc_NtkCreateLatch(pObj->pNtk);
381 Abc_ObjPatchFanin( pObj, pNext, pLatch );
382 Abc_ObjAddFanin( pLatch, pNext );
383 // create buffer isomorphic to this latch
384 if ( fInitial )
385 {
386 pLatch->pCopy = Abc_NtkCreateNodeBuf( pNtkNew, NULL );
387 Abc_ObjAssignName( pLatch->pCopy, Abc_ObjName(pNext), "_buf" );
388 Abc_ObjAddFanin( pObj->pCopy, pLatch->pCopy );
389 }
390 }
391 }
392 Vec_PtrFree( vNodes );
393}
ABC_DLL Abc_Obj_t * Abc_NtkDupObj(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pObj, int fCopyName)
Definition abcObj.c:342
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeBuf(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition abcObj.c:706
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition abc.h:527
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition abc.h:529
ABC_DLL void Abc_NodeCollectFanouts(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition abcUtil.c:1647
ABC_DLL void Abc_NodeCollectFanins(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition abcUtil.c:1627
int Abc_ObjSopSimulate(Abc_Obj_t *pObj)
Definition retInit.c:93
Abc_Ntk_t * pCopy
Definition abc.h:204
Abc_Ntk_t * pNtk
Definition abc.h:130
Here is the call graph for this function:

◆ Abc_NtkRetimeNodeIsEnabled()

int Abc_NtkRetimeNodeIsEnabled ( Abc_Obj_t * pObj,
int fForward )
extern

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

Synopsis [Returns 1 if retiming forward/backward is possible.]

Description []

SideEffects []

SeeAlso []

Definition at line 293 of file retIncrem.c.

294{
295 Abc_Obj_t * pNext;
296 int i;
297 assert( Abc_ObjIsNode(pObj) );
298 if ( fForward )
299 {
300 Abc_ObjForEachFanin( pObj, pNext, i )
301 if ( !Abc_ObjIsLatch(pNext) )
302 return 0;
303 }
304 else
305 {
306 Abc_ObjForEachFanout( pObj, pNext, i )
307 if ( !Abc_ObjIsLatch(pNext) )
308 return 0;
309 }
310 return 1;
311}

◆ Abc_NtkRetimePrepareLatches()

st__table * Abc_NtkRetimePrepareLatches ( Abc_Ntk_t * pNtk)
extern

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

Synopsis [Prepares the network for retiming.]

Description [Hash latches into their number in the original network.]

SideEffects []

SeeAlso []

Definition at line 109 of file retIncrem.c.

110{
111 st__table * tLatches;
112 Abc_Obj_t * pLatch, * pLatchIn, * pLatchOut, * pFanin;
113 int i, nOffSet = Abc_NtkBoxNum(pNtk) - Abc_NtkLatchNum(pNtk);
114 // collect latches and remove CIs/COs
116 Abc_NtkForEachLatch( pNtk, pLatch, i )
117 {
118 // map latch into its true number
119 st__insert( tLatches, (char *)(ABC_PTRUINT_T)pLatch, (char *)(ABC_PTRUINT_T)(i-nOffSet) );
120 // disconnect LI
121 pLatchIn = Abc_ObjFanin0(pLatch);
122 pFanin = Abc_ObjFanin0(pLatchIn);
123 Abc_ObjTransferFanout( pLatchIn, pFanin );
124 Abc_ObjDeleteFanin( pLatchIn, pFanin );
125 // disconnect LO
126 pLatchOut = Abc_ObjFanout0(pLatch);
127 pFanin = Abc_ObjFanin0(pLatchOut);
128 if ( Abc_ObjFanoutNum(pLatchOut) > 0 )
129 Abc_ObjTransferFanout( pLatchOut, pFanin );
130 Abc_ObjDeleteFanin( pLatchOut, pFanin );
131 }
132 return tLatches;
133}
ABC_DLL void Abc_ObjDeleteFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition abcFanio.c:111
int st__ptrhash(const char *, int)
Definition st.c:467
int st__ptrcmp(const char *, const char *)
Definition st.c:479
st__table * st__init_table(st__compare_func_type compare, st__hash_func_type hash)
Definition st.c:72
int st__insert(st__table *table, const char *key, char *value)
Definition st.c:171
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkRetimeShareLatches()

void Abc_NtkRetimeShareLatches ( Abc_Ntk_t * pNtk,
int fInitial )
extern

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

Synopsis [Retimes the node backward or forward.]

Description []

SideEffects []

SeeAlso []

Definition at line 436 of file retIncrem.c.

437{
438 Vec_Ptr_t * vNodes;
439 Abc_Obj_t * pFanin, * pLatchTop, * pLatchCur;
440 int i, k;
441 vNodes = Vec_PtrAlloc( 10 );
442 // consider latch fanins
443 Abc_NtkForEachObj( pNtk, pFanin, i )
444 {
446 continue;
447 // get the first latch
448 pLatchTop = NULL;
449 Abc_ObjForEachFanout( pFanin, pLatchTop, k )
450 if ( Abc_ObjIsLatch(pLatchTop) )
451 break;
452 assert( pLatchTop && Abc_ObjIsLatch(pLatchTop) );
453 // redirect compatible fanout latches to the first latch
454 Abc_NodeCollectFanouts( pFanin, vNodes );
455 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pLatchCur, k )
456 {
457 if ( !Abc_ObjIsLatch(pLatchCur) )
458 continue;
459 if ( pLatchCur == pLatchTop )
460 continue;
461 if ( pLatchCur->pData != pLatchTop->pData )
462 continue;
463 // connect the initial state
464 if ( fInitial )
465 Abc_ObjAddFanin( pLatchCur->pCopy, pLatchTop->pCopy );
466 // redirect the fanouts
467 Abc_ObjTransferFanout( pLatchCur, pLatchTop );
468 Abc_NtkDeleteObj(pLatchCur);
469 }
470 }
471 Vec_PtrFree( vNodes );
472}
int Abc_NtkRetimeCheckCompatibleLatchFanouts(Abc_Obj_t *pObj)
Definition retIncrem.c:406
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkRetimeTranferFromCopy()

void Abc_NtkRetimeTranferFromCopy ( Abc_Ntk_t * pNtk)
extern

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

Synopsis [Transfer latch initial values from pCopy.]

Description []

SideEffects []

SeeAlso []

Definition at line 188 of file retInit.c.

189{
190 Abc_Obj_t * pObj;
191 int i;
192 Abc_NtkForEachObj( pNtk, pObj, i )
193 if ( Abc_ObjIsLatch(pObj) )
194 pObj->pData = (void *)(ABC_PTRUINT_T)(pObj->pCopy? ABC_INIT_ONE : ABC_INIT_ZERO);
195}

◆ Abc_NtkRetimeTranferToCopy()

void Abc_NtkRetimeTranferToCopy ( Abc_Ntk_t * pNtk)
extern

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

Synopsis [Transfer latch initial values to pCopy.]

Description []

SideEffects []

SeeAlso []

Definition at line 168 of file retInit.c.

169{
170 Abc_Obj_t * pObj;
171 int i;
172 Abc_NtkForEachObj( pNtk, pObj, i )
173 if ( Abc_ObjIsLatch(pObj) )
174 pObj->pCopy = (Abc_Obj_t *)(ABC_PTRUINT_T)Abc_LatchIsInit1(pObj);
175}

◆ Abc_ObjSopSimulate()

int Abc_ObjSopSimulate ( Abc_Obj_t * pObj)
extern

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

Synopsis [Computes the results of simulating one node.]

Description [Assumes that fanins have pCopy set to the input values.]

SideEffects []

SeeAlso []

Definition at line 93 of file retInit.c.

94{
95 char * pCube, * pSop = (char *)pObj->pData;
96 int nVars, Value, v, ResOr, ResAnd, ResVar;
97 assert( pSop && !Abc_SopIsExorType(pSop) );
98 // simulate the SOP of the node
99 ResOr = 0;
100 nVars = Abc_SopGetVarNum(pSop);
101 Abc_SopForEachCube( pSop, nVars, pCube )
102 {
103 ResAnd = 1;
104 Abc_CubeForEachVar( pCube, Value, v )
105 {
106 if ( Value == '0' )
107 ResVar = 1 ^ ((int)(ABC_PTRUINT_T)Abc_ObjFanin(pObj, v)->pCopy);
108 else if ( Value == '1' )
109 ResVar = (int)(ABC_PTRUINT_T)Abc_ObjFanin(pObj, v)->pCopy;
110 else
111 continue;
112 ResAnd &= ResVar;
113 }
114 ResOr |= ResAnd;
115 }
116 // complement the result if necessary
117 if ( !Abc_SopGetPhase(pSop) )
118 ResOr ^= 1;
119 return ResOr;
120}
ABC_DLL int Abc_SopGetPhase(char *pSop)
Definition abcSop.c:604
#define Abc_CubeForEachVar(pCube, Value, i)
Definition abc.h:536
#define Abc_SopForEachCube(pSop, nFanins, pCube)
Definition abc.h:538
ABC_DLL int Abc_SopGetVarNum(char *pSop)
Definition abcSop.c:584
ABC_DLL int Abc_SopIsExorType(char *pSop)
Definition abcSop.c:850
Here is the call graph for this function:
Here is the caller graph for this function: