ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
ifDelay.c File Reference
#include "if.h"
#include "ifCount.h"
#include "bool/kit/kit.h"
Include dependency graph for ifDelay.c:

Go to the source code of this file.

Macros

#define IF_MAX_CUBES   70
 DECLARATIONS ///.
 

Functions

int If_CutDelaySop (If_Man_t *p, If_Cut_t *pCut)
 
int If_CutSopBalancePinDelaysInt (Vec_Int_t *vCover, int *pTimes, word *pFaninRes, int nSuppAll, word *pRes)
 
int If_CutSopBalancePinDelaysIntInt (Vec_Int_t *vCover, int *pTimes, int nSuppAll, char *pPerm)
 
int If_CutSopBalancePinDelays (If_Man_t *p, If_Cut_t *pCut, char *pPerm)
 
int If_CutSopBalanceEvalInt (Vec_Int_t *vCover, int *pTimes, int *pFaninLits, Vec_Int_t *vAig, int *piRes, int nSuppAll, int *pArea)
 
int If_CutSopBalanceEvalIntInt (Vec_Int_t *vCover, int nLeaves, int *pTimes, Vec_Int_t *vAig, int fCompl, int *pArea)
 
int If_CutSopBalanceEval (If_Man_t *p, If_Cut_t *pCut, Vec_Int_t *vAig)
 
int If_CutLutBalancePinDelays (If_Man_t *p, If_Cut_t *pCut, char *pPerm)
 
int If_CutLutBalanceEval (If_Man_t *p, If_Cut_t *pCut)
 
int If_LutDecEval (If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pObj, int optDelay, int fFirst)
 
int If_Lut2DecEval (If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pObj, int optDelay, int fFirst)
 
int If_LutDecReEval (If_Man_t *p, If_Cut_t *pCut)
 
float If_LutDecPinRequired (If_Man_t *p, If_Cut_t *pCut, int i, float required)
 

Macro Definition Documentation

◆ IF_MAX_CUBES

#define IF_MAX_CUBES   70

DECLARATIONS ///.

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

FileName [ifDelay.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [FPGA mapping based on priority cuts.]

Synopsis [Delay balancing for cut functions.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - November 21, 2006.]

Revision [

Id
ifDelay.c,v 1.00 2006/11/21 00:00:00 alanmi Exp

]

Definition at line 31 of file ifDelay.c.

Function Documentation

◆ If_CutDelaySop()

int If_CutDelaySop ( If_Man_t * p,
If_Cut_t * pCut )

Definition at line 64 of file ifDelay.c.

65{
66 char * pPerm = If_CutPerm( pCut );
67 // delay is calculated using 1+log2(NumFanins)
68 static double GateDelays[20] = { 1.00, 1.00, 2.00, 2.58, 3.00, 3.32, 3.58, 3.81, 4.00, 4.17, 4.32, 4.46, 4.58, 4.70, 4.81, 4.91, 5.00, 5.09, 5.17, 5.25 };
69 Vec_Int_t * vCover;
70 If_Obj_t * pLeaf;
71 int i, nLitMax, Delay, DelayMax;
72 // mark cut as a user cut
73 pCut->fUser = 1;
74 if ( pCut->nLeaves == 0 )
75 return 0;
76 if ( pCut->nLeaves == 1 )
77 return (int)If_ObjCutBest(If_CutLeaf(p, pCut, 0))->Delay;
78 vCover = Vec_WecEntry( p->vTtIsops[pCut->nLeaves], Abc_Lit2Var(If_CutTruthLit(pCut)) );
79 if ( Vec_IntSize(vCover) == 0 )
80 return -1;
81 // mark the output as complemented
82// vAnds = If_CutDelaySopAnds( p, pCut, vCover, RetValue ^ pCut->fCompl );
83 if ( Vec_IntSize(vCover) > p->pPars->nGateSize )
84 return -1;
85 // set the area cost
86 assert( If_CutLeaveNum(pCut) >= 0 && If_CutLeaveNum(pCut) <= 16 );
87 // compute the gate delay
88 nLitMax = If_CutMaxCubeSize( vCover, If_CutLeaveNum(pCut) );
89 if ( Vec_IntSize(vCover) < 2 )
90 {
91 pCut->Cost = Vec_IntSize(vCover);
92 Delay = (int)(GateDelays[If_CutLeaveNum(pCut)] + 0.5);
93 DelayMax = 0;
94 If_CutForEachLeaf( p, pCut, pLeaf, i )
95 DelayMax = Abc_MaxInt( DelayMax, If_ObjCutBest(pLeaf)->Delay + (pPerm[i] = (char)Delay) );
96 }
97 else
98 {
99 pCut->Cost = Vec_IntSize(vCover) + 1;
100 Delay = (int)(GateDelays[If_CutLeaveNum(pCut)] + GateDelays[nLitMax] + 0.5);
101 DelayMax = 0;
102 If_CutForEachLeaf( p, pCut, pLeaf, i )
103 DelayMax = Abc_MaxInt( DelayMax, If_ObjCutBest(pLeaf)->Delay + (pPerm[i] = (char)Delay) );
104 }
105 return DelayMax;
106}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Cube * p
Definition exorList.c:222
#define If_CutForEachLeaf(p, pCut, pLeaf, i)
Definition if.h:503
struct If_Obj_t_ If_Obj_t
Definition if.h:79
unsigned Cost
Definition if.h:310
unsigned nLeaves
Definition if.h:316
unsigned fUser
Definition if.h:312
#define assert(ex)
Definition util_old.h:213
Here is the caller graph for this function:

◆ If_CutLutBalanceEval()

int If_CutLutBalanceEval ( If_Man_t * p,
If_Cut_t * pCut )

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

Synopsis [Evaluate delay using SOP balancing.]

Description []

SideEffects []

SeeAlso []

Definition at line 369 of file ifDelay.c.

370{
371 pCut->fUser = 1;
372 pCut->Cost = pCut->nLeaves > 1 ? 1 : 0;
373 pCut->uMaskFunc = 0;
374 if ( pCut->nLeaves == 0 ) // const
375 {
376 assert( Abc_Lit2Var(If_CutTruthLit(pCut)) == 0 );
377 return 0;
378 }
379 if ( pCut->nLeaves == 1 ) // variable
380 {
381 assert( Abc_Lit2Var(If_CutTruthLit(pCut)) == 1 );
382 return (int)If_ObjCutBest(If_CutLeaf(p, pCut, 0))->Delay;
383 }
384 else
385 {
386 char * pCutPerm = If_CutDsdPerm( p, pCut );
387 int LutSize = p->pPars->pLutStruct[0] - '0';
388 int i, pTimes[IF_MAX_FUNC_LUTSIZE];
389 int DelayMax = -1, nLeafMax = 0;
390 unsigned uLeafMask = 0;
391 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
392 {
393 pTimes[i] = (int)If_ObjCutBest(If_CutLeaf(p, pCut, Abc_Lit2Var((int)pCutPerm[i])))->Delay;
394 if ( DelayMax < pTimes[i] )
395 DelayMax = pTimes[i], nLeafMax = 1, uLeafMask = (1 << (i << 1));
396 else if ( DelayMax == pTimes[i] )
397 nLeafMax++, uLeafMask |= (1 << (i << 1));
398 }
399 if ( If_CutLeaveNum(pCut) <= LutSize )
400 return DelayMax + 1;
401 pCut->Cost = 2;
402 if ( nLeafMax <= LutSize - 1 )
403 {
404 pCut->uMaskFunc = If_DsdManCheckXY( p->pIfDsdMan, If_CutDsdLit(p, pCut), LutSize, 1, uLeafMask, 0, 0 );
405 if ( pCut->uMaskFunc > 0 )
406 return DelayMax + 1;
407 }
408 pCut->uMaskFunc = If_DsdManCheckXY( p->pIfDsdMan, If_CutDsdLit(p, pCut), LutSize, 1, 0, 0, 0 );
409 if ( pCut->uMaskFunc == 0 )
410 return -1;
411 return DelayMax + 2;
412 }
413}
unsigned If_DsdManCheckXY(If_DsdMan_t *p, int iDsd, int LutSize, int fDerive, unsigned uMaskNot, int fHighEffort, int fVerbose)
Definition ifDsd.c:2017
#define IF_MAX_FUNC_LUTSIZE
Definition if.h:55
int uMaskFunc
Definition if.h:308
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutLutBalancePinDelays()

int If_CutLutBalancePinDelays ( If_Man_t * p,
If_Cut_t * pCut,
char * pPerm )

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

Synopsis [Evaluate delay using SOP balancing.]

Description []

SideEffects []

SeeAlso []

Definition at line 327 of file ifDelay.c.

328{
329 if ( pCut->nLeaves == 0 ) // const
330 return 0;
331 if ( pCut->nLeaves == 1 ) // variable
332 {
333 pPerm[0] = 0;
334 return (int)If_ObjCutBest(If_CutLeaf(p, pCut, 0))->Delay;
335 }
336 else
337 {
338 char * pCutPerm = If_CutDsdPerm( p, pCut );
339 int LutSize = p->pPars->pLutStruct[0] - '0';
340 int i, Delay, DelayMax = -1;
341 assert( (If_CutLeaveNum(pCut) > LutSize) == (pCut->uMaskFunc > 0) );
342 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
343 {
344 if ( If_CutLeaveNum(pCut) > LutSize && ((pCut->uMaskFunc >> (i << 1)) & 1) )
345 pPerm[Abc_Lit2Var((int)pCutPerm[i])] = 2;
346 else
347 pPerm[Abc_Lit2Var((int)pCutPerm[i])] = 1;
348 }
349 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
350 {
351 Delay = (int)If_ObjCutBest(If_CutLeaf(p, pCut, i))->Delay;
352 DelayMax = Abc_MaxInt( DelayMax, Delay + (int)pPerm[i] );
353 }
354 return DelayMax;
355 }
356}
Here is the caller graph for this function:

◆ If_CutSopBalanceEval()

int If_CutSopBalanceEval ( If_Man_t * p,
If_Cut_t * pCut,
Vec_Int_t * vAig )

Definition at line 248 of file ifDelay.c.

249{
250 pCut->fUser = 1;
251 if ( vAig )
252 Vec_IntClear( vAig );
253 if ( pCut->nLeaves == 0 ) // const
254 {
255 assert( Abc_Lit2Var(If_CutTruthLit(pCut)) == 0 );
256 if ( vAig )
257 Vec_IntPush( vAig, Abc_LitIsCompl(If_CutTruthLit(pCut)) );
258 pCut->Cost = 0;
259 return 0;
260 }
261 if ( pCut->nLeaves == 1 ) // variable
262 {
263 assert( Abc_Lit2Var(If_CutTruthLit(pCut)) == 1 );
264 if ( vAig )
265 Vec_IntPush( vAig, 0 );
266 if ( vAig )
267 Vec_IntPush( vAig, Abc_LitIsCompl(If_CutTruthLit(pCut)) );
268 pCut->Cost = 0;
269 return (int)If_ObjCutBest(If_CutLeaf(p, pCut, 0))->Delay;
270 }
271 else
272 {
273 int fVerbose = 0;
274 Vec_Int_t * vCover = Vec_WecEntry( p->vTtIsops[pCut->nLeaves], Abc_Lit2Var(If_CutTruthLit(pCut)) );
275 int Delay, Area = 0;
276 int i, pTimes[IF_MAX_FUNC_LUTSIZE];
277 if ( vCover == NULL )
278 return -1;
279 assert( Vec_IntSize(vCover) > 0 );
280 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
281 pTimes[i] = (int)If_ObjCutBest(If_CutLeaf(p, pCut, i))->Delay;
282 Delay = If_CutSopBalanceEvalIntInt( vCover, If_CutLeaveNum(pCut), pTimes, vAig, Abc_LitIsCompl(If_CutTruthLit(pCut)) ^ pCut->fCompl, &Area );
283 pCut->Cost = Area;
284 if ( fVerbose )
285 {
286 int Max = 0, Two = 0;
287 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
288 Max = Abc_MaxInt( Max, pTimes[i] );
289 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
290 if ( pTimes[i] != Max )
291 Two = Abc_MaxInt( Two, pTimes[i] );
292 if ( Two + 2 < Max && Max + 3 < Delay )
293 {
294 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
295 printf( "%3d ", pTimes[i] );
296 for ( ; i < p->pPars->nLutSize; i++ )
297 printf( " " );
298 printf( "-> %3d ", Delay );
299 Dau_DsdPrintFromTruth( If_CutTruthW(p, pCut), If_CutLeaveNum(pCut) );
300 Kit_TruthIsopPrintCover( vCover, If_CutLeaveNum(pCut), Abc_LitIsCompl(If_CutTruthLit(pCut)) ^ pCut->fCompl );
301 {
302 Vec_Int_t vIsop;
303 int pIsop[64];
304 vIsop.nCap = vIsop.nSize = Abc_Tt6Esop( *If_CutTruthW(p, pCut), pCut->nLeaves, pIsop );
305 vIsop.pArray = pIsop;
306 printf( "ESOP (%d -> %d)\n", Vec_IntSize(vCover), vIsop.nSize );
307 Kit_TruthIsopPrintCover( &vIsop, If_CutLeaveNum(pCut), 0 );
308 }
309 printf( "\n" );
310 }
311 }
312 return Delay;
313 }
314}
void Dau_DsdPrintFromTruth(word *pTruth, int nVarsInit)
Definition dauDsd.c:1968
int If_CutSopBalanceEvalIntInt(Vec_Int_t *vCover, int nLeaves, int *pTimes, Vec_Int_t *vAig, int fCompl, int *pArea)
Definition ifDelay.c:232
void Kit_TruthIsopPrintCover(Vec_Int_t *vCover, int nVars, int fCompl)
Definition kitIsop.c:183
unsigned fCompl
Definition if.h:311
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutSopBalanceEvalInt()

int If_CutSopBalanceEvalInt ( Vec_Int_t * vCover,
int * pTimes,
int * pFaninLits,
Vec_Int_t * vAig,
int * piRes,
int nSuppAll,
int * pArea )

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

Synopsis [Evaluate delay using SOP balancing.]

Description []

SideEffects []

SeeAlso []

Definition at line 192 of file ifDelay.c.

193{
194 int nCounterAnd, pCounterAnd[IF_MAX_FUNC_LUTSIZE], pFaninLitsAnd[IF_MAX_FUNC_LUTSIZE];
195 int nCounterOr, pCounterOr[IF_MAX_CUBES], pFaninLitsOr[IF_MAX_CUBES];
196 int i, k, Entry, Literal, nLits, Delay = 0, iRes = 0;
197 if ( Vec_IntSize(vCover) > IF_MAX_CUBES )
198 return -1;
199 nCounterOr = 0;
200 Vec_IntForEachEntry( vCover, Entry, i )
201 {
202 nCounterAnd = nLits = 0;
203 for ( k = 0; k < nSuppAll; k++ )
204 {
205 Literal = 3 & (Entry >> (k << 1));
206 if ( Literal == 1 ) // neg literal
207 nLits++, Delay = If_LogCounterAddAig( pCounterAnd, &nCounterAnd, pFaninLitsAnd, pTimes[k], vAig ? Abc_LitNot(pFaninLits[k]) : -1, vAig, nSuppAll, 0, 0 );
208 else if ( Literal == 2 ) // pos literal
209 nLits++, Delay = If_LogCounterAddAig( pCounterAnd, &nCounterAnd, pFaninLitsAnd, pTimes[k], vAig ? pFaninLits[k] : -1, vAig, nSuppAll, 0, 0 );
210 else if ( Literal != 0 )
211 assert( 0 );
212 }
213 assert( nCounterAnd > 0 );
214 assert( nLits > 0 );
215 if ( vAig )
216 iRes = If_LogCreateAndXorMulti( vAig, pFaninLitsAnd, nCounterAnd, nSuppAll, 0 );
217 else
218 *pArea += nLits == 1 ? 0 : nLits - 1;
219 Delay = If_LogCounterAddAig( pCounterOr, &nCounterOr, pFaninLitsOr, Delay, vAig ? Abc_LitNot(iRes) : -1, vAig, nSuppAll, 0, 0 );
220 }
221 assert( nCounterOr > 0 );
222 if ( vAig )
223 {
224 *piRes = Abc_LitNot( If_LogCreateAndXorMulti( vAig, pFaninLitsOr, nCounterOr, nSuppAll, 0 ) );
225 if ( ((vCover->nCap >> 16) & 1) ) // hack to remember complemented attribute
226 *piRes = Abc_LitNot( *piRes );
227 }
228 else
229 *pArea += Vec_IntSize(vCover) == 1 ? 0 : Vec_IntSize(vCover) - 1;
230 return Delay;
231}
#define IF_MAX_CUBES
DECLARATIONS ///.
Definition ifDelay.c:31
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the caller graph for this function:

◆ If_CutSopBalanceEvalIntInt()

int If_CutSopBalanceEvalIntInt ( Vec_Int_t * vCover,
int nLeaves,
int * pTimes,
Vec_Int_t * vAig,
int fCompl,
int * pArea )

Definition at line 232 of file ifDelay.c.

233{
234 int pFaninLits[IF_MAX_FUNC_LUTSIZE];
235 int iRes = 0, Res, k;
236 if ( vAig )
237 for ( k = 0; k < nLeaves; k++ )
238 pFaninLits[k] = Abc_Var2Lit(k, 0);
239 Res = If_CutSopBalanceEvalInt( vCover, pTimes, pFaninLits, vAig, &iRes, nLeaves, pArea );
240 if ( Res == -1 )
241 return -1;
242 assert( vAig == NULL || Abc_Lit2Var(iRes) == nLeaves + Abc_Lit2Var(Vec_IntSize(vAig)) - 1 );
243 if ( vAig )
244 Vec_IntPush( vAig, Abc_LitIsCompl(iRes) ^ fCompl );
245 assert( vAig == NULL || (Vec_IntSize(vAig) & 1) );
246 return Res;
247}
int If_CutSopBalanceEvalInt(Vec_Int_t *vCover, int *pTimes, int *pFaninLits, Vec_Int_t *vAig, int *piRes, int nSuppAll, int *pArea)
Definition ifDelay.c:192
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutSopBalancePinDelays()

int If_CutSopBalancePinDelays ( If_Man_t * p,
If_Cut_t * pCut,
char * pPerm )

Definition at line 159 of file ifDelay.c.

160{
161 if ( pCut->nLeaves == 0 ) // const
162 return 0;
163 if ( pCut->nLeaves == 1 ) // variable
164 {
165 pPerm[0] = 0;
166 return (int)If_ObjCutBest(If_CutLeaf(p, pCut, 0))->Delay;
167 }
168 else
169 {
170 Vec_Int_t * vCover;
171 int i, pTimes[IF_MAX_FUNC_LUTSIZE];
172 vCover = Vec_WecEntry( p->vTtIsops[pCut->nLeaves], Abc_Lit2Var(If_CutTruthLit(pCut)) );
173 if ( Vec_IntSize(vCover) == 0 )
174 return -1;
175 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
176 pTimes[i] = (int)If_ObjCutBest(If_CutLeaf(p, pCut, i))->Delay;
177 return If_CutSopBalancePinDelaysIntInt( vCover, pTimes, If_CutLeaveNum(pCut), pPerm );
178 }
179}
int If_CutSopBalancePinDelaysIntInt(Vec_Int_t *vCover, int *pTimes, int nSuppAll, char *pPerm)
Definition ifDelay.c:149
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutSopBalancePinDelaysInt()

int If_CutSopBalancePinDelaysInt ( Vec_Int_t * vCover,
int * pTimes,
word * pFaninRes,
int nSuppAll,
word * pRes )

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

Synopsis [Compute pin delays.]

Description []

SideEffects []

SeeAlso []

Definition at line 120 of file ifDelay.c.

121{
122 word pPinDelsAnd[IF_MAX_FUNC_LUTSIZE], pPinDelsOr[IF_MAX_CUBES];
123 int nCounterAnd, pCounterAnd[IF_MAX_FUNC_LUTSIZE];
124 int nCounterOr, pCounterOr[IF_MAX_CUBES];
125 int i, k, Entry, Literal, Delay = 0;
126 word ResAnd;
127 if ( Vec_IntSize(vCover) > IF_MAX_CUBES )
128 return -1;
129 nCounterOr = 0;
130 Vec_IntForEachEntry( vCover, Entry, i )
131 {
132 nCounterAnd = 0;
133 for ( k = 0; k < nSuppAll; k++ )
134 {
135 Literal = 3 & (Entry >> (k << 1));
136 if ( Literal == 1 || Literal == 2 ) // neg or pos literal
137 Delay = If_LogCounterPinDelays( pCounterAnd, &nCounterAnd, pPinDelsAnd, pTimes[k], pFaninRes[k], nSuppAll, 0 );
138 else if ( Literal != 0 )
139 assert( 0 );
140 }
141 assert( nCounterAnd > 0 );
142 ResAnd = If_LogPinDelaysMulti( pPinDelsAnd, nCounterAnd, nSuppAll, 0 );
143 Delay = If_LogCounterPinDelays( pCounterOr, &nCounterOr, pPinDelsOr, Delay, ResAnd, nSuppAll, 0 );
144 }
145 assert( nCounterOr > 0 );
146 *pRes = If_LogPinDelaysMulti( pPinDelsOr, nCounterOr, nSuppAll, 0 );
147 return Delay;
148}
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
Here is the caller graph for this function:

◆ If_CutSopBalancePinDelaysIntInt()

int If_CutSopBalancePinDelaysIntInt ( Vec_Int_t * vCover,
int * pTimes,
int nSuppAll,
char * pPerm )

Definition at line 149 of file ifDelay.c.

150{
151 int i, Delay;
152 word Res, FaninRes[IF_MAX_FUNC_LUTSIZE];
153 for ( i = 0; i < nSuppAll; i++ )
154 FaninRes[i] = If_CutPinDelayInit(i);
155 Delay = If_CutSopBalancePinDelaysInt( vCover, pTimes, FaninRes, nSuppAll, &Res );
156 If_CutPinDelayTranslate( Res, nSuppAll, pPerm );
157 return Delay;
158}
int If_CutSopBalancePinDelaysInt(Vec_Int_t *vCover, int *pTimes, word *pFaninRes, int nSuppAll, word *pRes)
Definition ifDelay.c:120
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_Lut2DecEval()

int If_Lut2DecEval ( If_Man_t * p,
If_Cut_t * pCut,
If_Obj_t * pObj,
int optDelay,
int fFirst )

Definition at line 508 of file ifDelay.c.

509{
510 pCut->fUser = 1;
511 pCut->Cost = pCut->nLeaves > 1 ? 1 : 0;
512 pCut->decDelay = 0;
513 if ( pCut->nLeaves == 0 ) // const
514 {
515 assert( Abc_Lit2Var(If_CutTruthLit(pCut)) == 0 );
516 return 0;
517 }
518 if ( pCut->nLeaves == 1 ) // variable
519 {
520 assert( Abc_Lit2Var(If_CutTruthLit(pCut)) == 1 );
521 return (int)If_ObjCutBest(If_CutLeaf(p, pCut, 0))->Delay;
522 }
523
524 int LutSize = p->pPars->nLutDecSize;
525 int i, leaf_delay;
526 int DelayMax = -1, nLeafMax = 0;
527 unsigned uLeafMask = 0;
528 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
529 {
530 leaf_delay = If_ObjCutBest(If_CutLeaf(p, pCut, i))->Delay;
531
532 if ( DelayMax < leaf_delay )
533 {
534 DelayMax = leaf_delay;
535 nLeafMax = 1;
536 uLeafMask = (1 << i);
537 }
538 else if ( DelayMax == leaf_delay )
539 {
540 nLeafMax++;
541 uLeafMask |= (1 << i);
542 }
543 }
544 if ( If_CutLeaveNum(pCut) <= LutSize )
545 {
546 pCut->decDelay = ( 1 << LutSize ) - 1;
547 return DelayMax + 1;
548 }
549
550 /* compute the decomposition */
551 int use_late_arrival = 0;
552 unsigned cost = 1;
553
554 if ( !fFirst )
555 {
556 if ( optDelay )
557 {
558 /* checks based on delay: must be better than the previous best cut */
559 use_late_arrival = DelayMax + 2 >= If_ObjCutBest(pObj)->Delay;
560 }
561 else
562 {
563 /* checks based on delay: look at the required time */
564 use_late_arrival = DelayMax + 2 > pObj->Required + p->fEpsilon;
565 }
566 }
567
568 /* Too many late-arriving signals */
569 if ( nLeafMax == LutSize && use_late_arrival )
570 {
571 /* unfeasible decomposition */
572 pCut->Cost = IF_COST_MAX;
573 return ABC_INFINITY;
574 }
575
576 if ( !use_late_arrival )
577 {
578 uLeafMask = 0;
579 }
580
581 /* returns the delay of the decomposition */
582 word *pTruth = If_CutTruthW( p, pCut );
583 int val = acd2_evaluate( pTruth, pCut->nLeaves, LutSize, &uLeafMask, &cost, !use_late_arrival );
584
585 /* not feasible decomposition */
586 pCut->decDelay = uLeafMask;
587 if ( val < 0 )
588 {
589 pCut->Cost = IF_COST_MAX;
590 return ABC_INFINITY;
591 }
592
593 pCut->Cost = 2;
594 return DelayMax + val;
595}
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition abc_global.h:250
int acd2_evaluate(word *pTruth, unsigned nVars, int lutSize, unsigned *pdelay, unsigned *cost, int try_no_late_arrival)
#define IF_COST_MAX
Definition if.h:59
unsigned decDelay
Definition if.h:317
float Required
Definition if.h:353
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_LutDecEval()

int If_LutDecEval ( If_Man_t * p,
If_Cut_t * pCut,
If_Obj_t * pObj,
int optDelay,
int fFirst )

Definition at line 415 of file ifDelay.c.

416{
417 pCut->fUser = 1;
418 pCut->Cost = pCut->nLeaves > 1 ? 1 : 0;
419 pCut->decDelay = 0;
420 if ( pCut->nLeaves == 0 ) // const
421 {
422 assert( Abc_Lit2Var(If_CutTruthLit(pCut)) == 0 );
423 return 0;
424 }
425 if ( pCut->nLeaves == 1 ) // variable
426 {
427 assert( Abc_Lit2Var(If_CutTruthLit(pCut)) == 1 );
428 return (int)If_ObjCutBest(If_CutLeaf(p, pCut, 0))->Delay;
429 }
430
431 int LutSize = p->pPars->nLutDecSize;
432 int i, leaf_delay;
433 int DelayMax = -1, nLeafMax = 0;
434 unsigned uLeafMask = 0;
435 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
436 {
437 leaf_delay = If_ObjCutBest(If_CutLeaf(p, pCut, i))->Delay;
438
439 if ( DelayMax < leaf_delay )
440 {
441 DelayMax = leaf_delay;
442 nLeafMax = 1;
443 uLeafMask = (1 << i);
444 }
445 else if ( DelayMax == leaf_delay )
446 {
447 nLeafMax++;
448 uLeafMask |= (1 << i);
449 }
450 }
451 if ( If_CutLeaveNum(pCut) <= LutSize )
452 {
453 pCut->decDelay = ( 1 << LutSize ) - 1;
454 return DelayMax + 1;
455 }
456
457 /* compute the decomposition */
458 int use_late_arrival = 0;
459 unsigned cost = 1;
460
461 if ( !fFirst )
462 {
463 if ( optDelay )
464 {
465 /* checks based on delay: must be better than the previous best cut */
466 use_late_arrival = DelayMax + 2 >= If_ObjCutBest(pObj)->Delay;
467 }
468 else
469 {
470 /* checks based on delay: look at the required time */
471 use_late_arrival = DelayMax + 2 > pObj->Required + p->fEpsilon;
472 }
473 }
474
475 /* Too many late-arriving signals */
476 if ( nLeafMax == LutSize )
477 {
478 if ( use_late_arrival )
479 {
480 /* unfeasible decomposition */
481 pCut->Cost = IF_COST_MAX;
482 return ABC_INFINITY;
483 }
484 else
485 {
486 /* remove critical signals as not needed */
487 uLeafMask = 0;
488 }
489 }
490
491 /* returns the delay of the decomposition */
492 word *pTruth = If_CutTruthW( p, pCut );
493 int val = acd_evaluate( pTruth, pCut->nLeaves, LutSize, &uLeafMask, &cost, !use_late_arrival );
494
495 /* not feasible decomposition */
496 pCut->decDelay = uLeafMask;
497 if ( val < 0 )
498 {
499 pCut->Cost = IF_COST_MAX;
500 return ABC_INFINITY;
501 }
502
503 pCut->Cost = cost;
504
505 return DelayMax + val;
506}
ABC_NAMESPACE_IMPL_START int acd_evaluate(word *pTruth, unsigned nVars, int lutSize, unsigned *pdelay, unsigned *cost, int try_no_late_arrival)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_LutDecPinRequired()

float If_LutDecPinRequired ( If_Man_t * p,
If_Cut_t * pCut,
int i,
float required )

Definition at line 625 of file ifDelay.c.

626{
627 if ( pCut->nLeaves == 0 ) // const
628 {
629 assert( Abc_Lit2Var(If_CutTruthLit(pCut)) == 0 );
630 return required;
631 }
632 if ( pCut->nLeaves == 1 ) // variable
633 {
634 assert( Abc_Lit2Var(If_CutTruthLit(pCut)) == 1 );
635 return 0;
636 }
637
638 return ( ( pCut->decDelay >> i ) & 1 ) == 0 ? 2 : 1;
639}
Here is the caller graph for this function:

◆ If_LutDecReEval()

int If_LutDecReEval ( If_Man_t * p,
If_Cut_t * pCut )

Definition at line 597 of file ifDelay.c.

598{
599 // pCut->fUser = 1;
600
601 if ( pCut->nLeaves == 0 ) // const
602 {
603 assert( Abc_Lit2Var(If_CutTruthLit(pCut)) == 0 );
604 return 0;
605 }
606 if ( pCut->nLeaves == 1 ) // variable
607 {
608 assert( Abc_Lit2Var(If_CutTruthLit(pCut)) == 1 );
609 return (int)If_ObjCutBest(If_CutLeaf(p, pCut, 0))->Delay;
610 }
611
612 // int LutSize = p->pPars->pLutStruct[0] - '0';
613 int i, leaf_delay;
614 int DelayMax = -1;
615 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
616 {
617 leaf_delay = If_ObjCutBest(If_CutLeaf(p, pCut, i))->Delay;
618 leaf_delay += ( ( pCut->decDelay >> i ) & 1 ) == 0 ? 2 : 1;
619 DelayMax = Abc_MaxInt( leaf_delay, DelayMax );
620 }
621
622 return DelayMax;
623}
Here is the caller graph for this function: