77 p->nVarsMax = nVarsMax;
85 p->pTruthIn =
ABC_ALLOC(
unsigned, p->nWordsMax );
86 p->pTruthOut =
ABC_ALLOC(
unsigned, p->nWordsMax );
128 int i, v, iVar, nLuts, Delay;
132 for ( v = 0; v < nVars; v++ )
133 ATimesOut[v] = ATimesIn[v];
134 for ( v = 0; v < nLuts; v++ )
137 for ( i = 0; i < LutSize; i++ )
140 assert( iVar < nVars + v );
143 ATimesOut[nVars + v] = Delay + 1;
145 return ATimesOut[nVars + nLuts - 1];
163 for ( i = 0; i < (1<<LutSize); i++ )
168 for ( v = 0; v < LutSize; v++ )
190 unsigned * pResult, * pTruthLuts, *
pTruths[17];
191 int nTruthLutWords, i, v, iVar, nLuts;
198 for ( v = 0; v < nLuts; v++ )
200 for ( i = 0; i < LutSize; i++ )
203 assert( iVar < nVars + v );
204 pTruths[i] = (iVar < nVars)? (
unsigned *)
Vec_PtrEntry(p->vTruthVars, iVar) : (
unsigned *)
Vec_PtrEntry(p->vTruthNodes, iVar-nVars);
206 pResult = (v == nLuts - 1) ? pRes : (
unsigned *)
Vec_PtrEntry(p->vTruthNodes, v);
208 pTruthLuts += nTruthLutWords;
225 int nCofs = (1 << LutSize);
228 assert( LutSize < nVars );
229 if ( nVars - LutSize <= 5 )
232 int nBits = (1 << (nVars - LutSize));
233 for ( i = 0; i < nCofs; i++ )
234 uCofs[i] = (pTruth[(i*nBits)/32] >> ((i*nBits)%32)) & ((1<<nBits)-1);
235 for ( i = 0; i < nCofs; i++ )
237 for ( k = 0; k < nMyu; k++ )
238 if ( uCofs[i] == uCofs[k] )
249 unsigned * puCofs[64];
250 int nWords = (1 << (nVars - LutSize - 5));
251 for ( i = 0; i < nCofs; i++ )
252 puCofs[i] = pTruth + nWords;
253 for ( i = 0; i < nCofs; i++ )
255 for ( k = 0; k < nMyu; k++ )
281 int Pat0[32], Pat1[32], Shared0[5], Shared1[5], VarsNext[5];
282 int v, u, iVarsNext, iPat0, iPat1, m, nMints = (1 << nVars);
283 int nShared0, nShared1, nShared = 0;
284 for ( v = iVarTry; v < nVars; v++ )
287 for ( u = 0; u < nVars; u++ )
289 VarsNext[iVarsNext++] = Vars[u];
291 for ( m = 0; m < nMints; m++ )
296 assert( iPat0 == nMints / 2 );
297 assert( iPat1 == nMints / 2 );
304 Shared[nShared++] = v;
305 for ( u = 0; u < nShared0; u++ )
306 for ( m = 0; m < nShared1; m++ )
307 if ( Shared0[u] >= 0 && Shared1[m] >= 0 && Shared0[u] == Shared1[m] )
309 Shared[nShared++] = Shared0[u];
310 Shared0[u] = Shared1[m] = -1;
332 for ( i = 0; i < LutSize; i++ )
static ABC_NAMESPACE_IMPL_START int pTruths[13719]
DECLARATIONS ///.
static int * Vec_IntArray(Vec_Int_t *p)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
static int Kit_DecOuputArrival(int nVars, Vec_Int_t *vLuts, char ATimes[])
static int Kit_TruthWordNum(int nVars)
static void Kit_TruthFill(unsigned *pOut, int nVars)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
int Kit_DecComputeOuputArrival(int nVars, Vec_Int_t *vSupps, int LutSize, char ATimesIn[], char ATimesOut[])
int Kit_DecComputeShared(int Pattern[], int LutSize, int Shared[])
#define ABC_ALLOC(type, num)
static int Kit_TruthIsEqual(unsigned *pIn0, unsigned *pIn1, int nVars)
static int Abc_MaxInt(int a, int b)
static int Kit_TruthHasBit(unsigned *p, int Bit)
void Kit_DecComputeTruthOne(int LutSize, unsigned *pTruthLut, int nVars, unsigned *pTruths[], unsigned *pTemp, unsigned *pRes)
static void Kit_TruthAnd(unsigned *pOut, unsigned *pIn0, unsigned *pIn1, int nVars)
static Vec_Ptr_t * Vec_PtrAllocTruthTables(int nVars)
void Kit_ManDecStop(Kit_ManDec_t *p)
int Kit_DecComputePattern(int nVars, unsigned *pTruth, int LutSize, int Pattern[])
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
static int Vec_IntEntry(Vec_Int_t *p, int i)
#define ABC_NAMESPACE_IMPL_END
int Kit_DecComputeShared_rec(int Pattern[], int Vars[], int nVars, int Shared[], int iVarTry)
static void Vec_IntFreeP(Vec_Int_t **p)
Kit_ManDec_t * Kit_ManDecStart(int nVarsMax)
FUNCTION DEFINITIONS ///.
#define ABC_NAMESPACE_IMPL_START
static void Kit_TruthSharp(unsigned *pOut, unsigned *pIn0, unsigned *pIn1, int nVars)
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static int Vec_IntSize(Vec_Int_t *p)
typedefABC_NAMESPACE_IMPL_START struct Kit_ManDec_t_ Kit_ManDec_t
DECLARATIONS ///.
void Kit_DecComputeTruth(Kit_ManDec_t *p, int nVars, Vec_Int_t *vSupps, int LutSize, Vec_Int_t *vLuts, unsigned *pRes)
#define ABC_CALLOC(type, num)
static void Vec_PtrFreeP(Vec_Ptr_t **p)
static void Kit_TruthClear(unsigned *pOut, int nVars)
static void Kit_TruthOr(unsigned *pOut, unsigned *pIn0, unsigned *pIn1, int nVars)
static Vec_Ptr_t * Vec_PtrAllocSimInfo(int nEntries, int nWords)