21 #ifndef ABC__map__if__if_Count_h
22 #define ABC__map__if__if_Count_h
84 for ( i = nFanins - 1; i > 0; i-- )
85 pFaninLits[i-1] =
If_LogCreateAndXor( vAig, pFaninLits[i], pFaninLits[i-1], nSuppAll, fXor );
88 static inline int If_LogCounterAddAig(
int * pTimes,
int * pnTimes,
int * pFaninLits,
int Num,
int iLit,
Vec_Int_t * vAig,
int nSuppAll,
int fXor,
int fXorFunc )
90 int nTimes = *pnTimes;
92 pFaninLits[nTimes] = iLit;
93 pTimes[nTimes++] = Num;
97 for ( k = nTimes-1; k > 0; k-- )
99 if ( pTimes[k] < pTimes[k-1] )
101 if ( pTimes[k] > pTimes[k-1] )
103 ABC_SWAP(
int, pTimes[k], pTimes[k-1] );
105 ABC_SWAP(
int, pFaninLits[k], pFaninLits[k-1] );
108 pTimes[k-1] += 1 + fXor;
110 pFaninLits[k-1] =
If_LogCreateAndXor( vAig, pFaninLits[k], pFaninLits[k-1], nSuppAll, fXorFunc );
111 for ( nTimes--, i = k; i < nTimes; i++ )
113 pTimes[i] = pTimes[i+1];
115 pFaninLits[i] = pFaninLits[i+1];
121 return pTimes[0] + (nTimes > 1 ? 1 + fXor : 0);
127 for ( i = nTimes - 1; i > 0; i-- )
128 pTimes[i-1] = 2 +
Abc_MaxInt( pTimes[i], pTimes[i-1] );
151 for ( v = 0; v < nVars; v++ )
160 for ( v = 0; v < nVars; v++ )
168 for ( v = 0; v < nVars; v++ )
176 for ( v = 0; v < nVars; v++ )
184 for ( v = 0; v < nVars; v++ )
188 pPerm[v] = Delay - 1;
194 printf(
"Delay profile = {" );
195 for ( v = 0; v < nVars; v++ )
201 int nTimes = *pnTimes;
202 pPinDels[nTimes] = PinDel;
203 pTimes[nTimes++] = Num;
207 for ( k = nTimes-1; k > 0; k-- )
209 if ( pTimes[k] < pTimes[k-1] )
211 if ( pTimes[k] > pTimes[k-1] )
213 ABC_SWAP(
int, pTimes[k], pTimes[k-1] );
217 pTimes[k-1] += 1 + fXor;
218 pPinDels[k-1] =
If_CutPinDelayMax( pPinDels[k], pPinDels[k-1], nSuppAll, 1 + fXor );
219 for ( nTimes--, i = k; i < nTimes; i++ )
221 pTimes[i] = pTimes[i+1];
222 pPinDels[i] = pPinDels[i+1];
228 return pTimes[0] + (nTimes > 1 ? 1 + fXor : 0);
234 for ( i = nFanins - 1; i > 0; i-- )
235 pPinDels[i-1] =
If_CutPinDelayMax( pPinDels[i], pPinDels[i-1], nSuppAll, 1 + fXor );
264 word Truth0 = 0, Truth1 = 0, TruthR;
265 int i, iVar0, iVar1, iLit0, iLit1;
281 TruthR = Truth0 & Truth1;
307 printf(
"Variable %s\n",
Vec_IntEntry(vAig, 1) ?
"Compl" :
"" );
313 printf(
"%d %d\n", iLit0, iLit1 );
333 int n = ((Count & (Count - 1)) > 0) ? -1 : 0;
335 if ( (Count &
ABC_CONST(0xFFFFFFFF00000000)) == 0 ) { n += 32; Count <<= 32; }
336 if ( (Count &
ABC_CONST(0xFFFF000000000000)) == 0 ) { n += 16; Count <<= 16; }
337 if ( (Count &
ABC_CONST(0xFF00000000000000)) == 0 ) { n += 8; Count <<= 8; }
338 if ( (Count &
ABC_CONST(0xF000000000000000)) == 0 ) { n += 4; Count <<= 4; }
339 if ( (Count &
ABC_CONST(0xC000000000000000)) == 0 ) { n += 2; Count <<= 2; }
340 if ( (Count &
ABC_CONST(0x8000000000000000)) == 0 ) { n++; }
346 return Count + (((
word)1) << Num);
363 int n = (
Abc_LitIsCompl(Start) || (Count & (Count - 1)) > 0) ? -1 : 0;
365 if ( (Count & 0xFFFF0000) == 0 ) { n += 16; Count <<= 16; }
366 if ( (Count & 0xFF000000) == 0 ) { n += 8; Count <<= 8; }
367 if ( (Count & 0xF0000000) == 0 ) { n += 4; Count <<= 4; }
368 if ( (Count & 0xC0000000) == 0 ) { n += 2; Count <<= 2; }
369 if ( (Count & 0x80000000) == 0 ) { n++; }
380 if ( Num > Start + 16 )
382 int Shift = Num - (Start + 16);
383 if ( !
Abc_LitIsCompl(*pStart) && (Shift >= 32 ? Count : Count & ~(~0 << Shift)) > 0 )
388 assert( Num <= Start + 16 );
390 return Count + (1 << (Num-Start));
456 int nTimes = *pnTimes;
457 pTimes[nTimes++] = Num;
461 for ( k = nTimes-1; k > 0; k-- )
463 if ( pTimes[k] < pTimes[k-1] )
465 if ( pTimes[k] > pTimes[k-1] )
467 ABC_SWAP(
int, pTimes[k], pTimes[k-1] );
470 pTimes[k-1] += 1 + fXor;
471 for ( nTimes--, i = k; i < nTimes; i++ )
472 pTimes[i] = pTimes[i+1];
477 return pTimes[0] + (nTimes > 1 ? 1 + fXor : 0);
static void If_AigPrintArray(Vec_Int_t *vAig, int nLeaves)
static int If_LogCounterAddAig(int *pTimes, int *pnTimes, int *pFaninLits, int Num, int iLit, Vec_Int_t *vAig, int nSuppAll, int fXor, int fXorFunc)
static word If_CutPinDelayInit(int v)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
static word If_CutPinDelayMax(word D1, word D2, int nVars, int AddOn)
static int If_LogCreateAndXor(Vec_Int_t *vAig, int iLit0, int iLit1, int nSuppAll, int fXor)
static int Abc_Var2Lit(int Var, int fCompl)
static word If_LogPinDelaysMulti(word *pPinDels, int nFanins, int nSuppAll, int fXor)
static int Abc_MaxInt(int a, int b)
static int If_CutPinDelayDom(word D1, word D2, int nVars)
static int If_LogCounterAdd(int *pTimes, int *pnTimes, int Num, int fXor)
#define ABC_SWAP(Type, a, b)
static unsigned If_LogCounter32Add(unsigned Count, int *pStart, int Num)
static int If_LogCounterPinDelays(int *pTimes, int *pnTimes, word *pPinDels, int Num, word PinDel, int nSuppAll, int fXor)
static int If_LogCounter32Eval(unsigned Count, int Start)
static int Abc_MinInt(int a, int b)
static int Abc_LitIsCompl(int Lit)
static ABC_NAMESPACE_HEADER_START int If_LogCreateAnd(Vec_Int_t *vAig, int iLit0, int iLit1, int nSuppAll)
INCLUDES ///.
static word If_LogCounter64Add(word Count, int Num)
static void Vec_WrdWriteEntry(Vec_Wrd_t *p, int i, word Entry)
static int Vec_IntEntry(Vec_Int_t *p, int i)
unsigned __int64 word
DECLARATIONS ///.
static int If_LogCounter64Eval(word Count)
static word If_AigVerifyArray(Vec_Int_t *vAig, int nLeaves)
#define IF_MAX_FUNC_LUTSIZE
static void Vec_IntPush(Vec_Int_t *p, int Entry)
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
static void If_CutPinDelayPrint(word D, int nVars)
static int If_LogCreateMux(Vec_Int_t *vAig, int iLitC, int iLit1, int iLit0, int nSuppAll)
#define ABC_NAMESPACE_HEADER_END
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
static int If_LogCreateAndXorMulti(Vec_Int_t *vAig, int *pFaninLits, int nFanins, int nSuppAll, int fXor)
static void If_CutPinDelaySet(word *pD, int v, int d)
static int Vec_IntEntryLast(Vec_Int_t *p)
static int Abc_LitNot(int Lit)
static int If_CutPinDelayEqual(word D1, word D2, int nVars)
static int Vec_IntSize(Vec_Int_t *p)
#define ABC_CONST(number)
PARAMETERS ///.
static void If_CutPinDelayTranslate(word D, int nVars, char *pPerm)
static word Vec_WrdEntry(Vec_Wrd_t *p, int i)
static int Abc_Lit2Var(int Lit)
static word If_CutPinDelayDecrement(word D1, int nVars)
static int If_LogCounterDelayXor(int *pTimes, int nTimes)
static int If_CutPinDelayGet(word D, int v)
static void Vec_IntClear(Vec_Int_t *p)
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
static int If_LogCreateXor(Vec_Int_t *vAig, int iLit0, int iLit1, int nSuppAll)