abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ifDelay.c File Reference
#include "if.h"
#include "ifCount.h"
#include "bool/kit/kit.h"

Go to the source code of this file.

Macros

#define IF_MAX_CUBES   70
 DECLARATIONS ///. More...
 

Functions

static int If_CutMaxCubeSize (Vec_Int_t *vCover, int nVars)
 FUNCTION DEFINITIONS ///. More...
 
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)
 

Macro Definition Documentation

#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

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 }
unsigned nLeaves
Definition: if.h:289
Vec_Wec_t * vTtIsops[IF_MAX_FUNC_LUTSIZE+1]
Definition: if.h:245
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Definition: if.h:303
#define If_CutForEachLeaf(p, pCut, pLeaf, i)
Definition: if.h:474
static int If_CutLeaveNum(If_Cut_t *pCut)
Definition: if.h:390
static char * If_CutPerm(If_Cut_t *pCut)
Definition: if.h:397
static If_Cut_t * If_ObjCutBest(If_Obj_t *pObj)
Definition: if.h:401
unsigned fUser
Definition: if.h:286
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
int nGateSize
Definition: if.h:107
unsigned Cost
Definition: if.h:284
static int If_CutTruthLit(If_Cut_t *pCut)
Definition: if.h:417
static If_Obj_t * If_CutLeaf(If_Man_t *p, If_Cut_t *pCut, int i)
Definition: if.h:392
else
Definition: sparse_int.h:55
static int pPerm[13719]
Definition: rwrTemp.c:32
static Vec_Int_t * Vec_WecEntry(Vec_Wec_t *p, int i)
Definition: vecWec.h:142
If_Par_t * pPars
Definition: if.h:184
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define assert(ex)
Definition: util_old.h:213
static int If_CutMaxCubeSize(Vec_Int_t *vCover, int nVars)
FUNCTION DEFINITIONS ///.
Definition: ifDelay.c:48
float Delay
Definition: if.h:280
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 }
If_DsdMan_t * pIfDsdMan
Definition: if.h:243
unsigned nLeaves
Definition: if.h:289
unsigned If_DsdManCheckXY(If_DsdMan_t *p, int iDsd, int LutSize, int fDerive, unsigned uMaskNot, int fHighEffort, int fVerbose)
Definition: ifDsd.c:1986
static int If_CutLeaveNum(If_Cut_t *pCut)
Definition: if.h:390
char * pLutStruct
Definition: if.h:141
static If_Cut_t * If_ObjCutBest(If_Obj_t *pObj)
Definition: if.h:401
unsigned fUser
Definition: if.h:286
unsigned Cost
Definition: if.h:284
static int If_CutTruthLit(If_Cut_t *pCut)
Definition: if.h:417
static If_Obj_t * If_CutLeaf(If_Man_t *p, If_Cut_t *pCut, int i)
Definition: if.h:392
#define IF_MAX_FUNC_LUTSIZE
Definition: if.h:54
static int If_CutDsdLit(If_Man_t *p, If_Cut_t *pCut)
Definition: if.h:424
If_Par_t * pPars
Definition: if.h:184
int uMaskFunc
Definition: if.h:282
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define assert(ex)
Definition: util_old.h:213
static char * If_CutDsdPerm(If_Man_t *p, If_Cut_t *pCut)
Definition: if.h:426
float Delay
Definition: if.h:280
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 }
unsigned nLeaves
Definition: if.h:289
static int If_CutLeaveNum(If_Cut_t *pCut)
Definition: if.h:390
char * pLutStruct
Definition: if.h:141
static If_Cut_t * If_ObjCutBest(If_Obj_t *pObj)
Definition: if.h:401
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static If_Obj_t * If_CutLeaf(If_Man_t *p, If_Cut_t *pCut, int i)
Definition: if.h:392
static int pPerm[13719]
Definition: rwrTemp.c:32
If_Par_t * pPars
Definition: if.h:184
int uMaskFunc
Definition: if.h:282
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define assert(ex)
Definition: util_old.h:213
static char * If_CutDsdPerm(If_Man_t *p, If_Cut_t *pCut)
Definition: if.h:426
float Delay
Definition: if.h:280
static int If_CutMaxCubeSize ( Vec_Int_t vCover,
int  nVars 
)
inlinestatic

FUNCTION DEFINITIONS ///.

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

Synopsis [Computes the SOP delay using balanced AND decomposition.]

Description []

SideEffects []

SeeAlso []

Definition at line 48 of file ifDelay.c.

49 {
50  int i, k, Entry, Literal, Count, CountMax = 0;
51  Vec_IntForEachEntry( vCover, Entry, i )
52  {
53  Count = 0;
54  for ( k = 0; k < nVars; k++ )
55  {
56  Literal = (3 & (Entry >> (k << 1)));
57  if ( Literal == 1 || Literal == 2 )
58  Count++;
59  }
60  CountMax = Abc_MaxInt( CountMax, Count );
61  }
62  return CountMax;
63 }
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
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 );
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 }
unsigned nLeaves
Definition: if.h:289
int nLutSize
Definition: if.h:103
Vec_Wec_t * vTtIsops[IF_MAX_FUNC_LUTSIZE+1]
Definition: if.h:245
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int If_CutLeaveNum(If_Cut_t *pCut)
Definition: if.h:390
void Dau_DsdPrintFromTruth(word *pTruth, int nVarsInit)
Definition: dauDsd.c:1968
static If_Cut_t * If_ObjCutBest(If_Obj_t *pObj)
Definition: if.h:401
unsigned fUser
Definition: if.h:286
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
unsigned Cost
Definition: if.h:284
static word * If_CutTruthW(If_Man_t *p, If_Cut_t *pCut)
Definition: if.h:421
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
void Kit_TruthIsopPrintCover(Vec_Int_t *vCover, int nVars, int fCompl)
Definition: kitIsop.c:104
int If_CutSopBalanceEvalIntInt(Vec_Int_t *vCover, int nLeaves, int *pTimes, Vec_Int_t *vAig, int fCompl, int *pArea)
Definition: ifDelay.c:232
static int If_CutTruthLit(If_Cut_t *pCut)
Definition: if.h:417
static If_Obj_t * If_CutLeaf(If_Man_t *p, If_Cut_t *pCut, int i)
Definition: if.h:392
#define IF_MAX_FUNC_LUTSIZE
Definition: if.h:54
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static Vec_Int_t * Vec_WecEntry(Vec_Wec_t *p, int i)
Definition: vecWec.h:142
If_Par_t * pPars
Definition: if.h:184
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define assert(ex)
Definition: util_old.h:213
unsigned fCompl
Definition: if.h:285
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
float Delay
Definition: if.h:280
static int Abc_Tt6Esop(word t, int nVars, int *pCover)
Definition: utilTruth.h:2000
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], Abc_LitNot(pFaninLits[k]), vAig, nSuppAll, 0, 0 );
208  else if ( Literal == 2 ) // pos literal
209  nLits++, Delay = If_LogCounterAddAig( pCounterAnd, &nCounterAnd, pFaninLitsAnd, pTimes[k], pFaninLits[k], 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, Abc_LitNot(iRes), 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 }
static int If_LogCounterAddAig(int *pTimes, int *pnTimes, int *pFaninLits, int Num, int iLit, Vec_Int_t *vAig, int nSuppAll, int fXor, int fXorFunc)
Definition: ifCount.h:88
#define IF_MAX_CUBES
DECLARATIONS ///.
Definition: ifDelay.c:31
#define IF_MAX_FUNC_LUTSIZE
Definition: if.h:54
static int If_LogCreateAndXorMulti(Vec_Int_t *vAig, int *pFaninLits, int nFanins, int nSuppAll, int fXor)
Definition: ifCount.h:80
static int Abc_LitNot(int Lit)
Definition: abc_global.h:266
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
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 }
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
#define IF_MAX_FUNC_LUTSIZE
Definition: if.h:54
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
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
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define assert(ex)
Definition: util_old.h:213
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 }
unsigned nLeaves
Definition: if.h:289
Vec_Wec_t * vTtIsops[IF_MAX_FUNC_LUTSIZE+1]
Definition: if.h:245
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int If_CutLeaveNum(If_Cut_t *pCut)
Definition: if.h:390
static If_Cut_t * If_ObjCutBest(If_Obj_t *pObj)
Definition: if.h:401
int If_CutSopBalancePinDelaysIntInt(Vec_Int_t *vCover, int *pTimes, int nSuppAll, char *pPerm)
Definition: ifDelay.c:149
static int If_CutTruthLit(If_Cut_t *pCut)
Definition: if.h:417
static If_Obj_t * If_CutLeaf(If_Man_t *p, If_Cut_t *pCut, int i)
Definition: if.h:392
#define IF_MAX_FUNC_LUTSIZE
Definition: if.h:54
static int pPerm[13719]
Definition: rwrTemp.c:32
static Vec_Int_t * Vec_WecEntry(Vec_Wec_t *p, int i)
Definition: vecWec.h:142
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
float Delay
Definition: if.h:280
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 }
static word If_LogPinDelaysMulti(word *pPinDels, int nFanins, int nSuppAll, int fXor)
Definition: ifCount.h:230
static int If_LogCounterPinDelays(int *pTimes, int *pnTimes, word *pPinDels, int Num, word PinDel, int nSuppAll, int fXor)
Definition: ifCount.h:199
#define IF_MAX_CUBES
DECLARATIONS ///.
Definition: ifDelay.c:31
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
#define IF_MAX_FUNC_LUTSIZE
Definition: if.h:54
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
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 }
static word If_CutPinDelayInit(int v)
Definition: ifCount.h:146
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
#define IF_MAX_FUNC_LUTSIZE
Definition: if.h:54
static int pPerm[13719]
Definition: rwrTemp.c:32
int If_CutSopBalancePinDelaysInt(Vec_Int_t *vCover, int *pTimes, word *pFaninRes, int nSuppAll, word *pRes)
Definition: ifDelay.c:120
static void If_CutPinDelayTranslate(word D, int nVars, char *pPerm)
Definition: ifCount.h:181