54 for ( i = 0; i < nLeaves - 1; i++ )
56 if ( pDelays[i] >= pDelays[i+1] )
58 ABC_SWAP(
float, pDelays[i], pDelays[i+1] );
59 ABC_SWAP(
int, pVars[i], pVars[i+1] );
61 Abc_TtSwapAdjacent( pTruth,
nWords, i );
73 assert( !
p->pPars->fUseTtPerm );
75 PinDelays[i] = If_ObjCutBest(pLeaf)->Delay;
76 if (
p->vTtMem[pCut->
nLeaves] == NULL )
81 Abc_TtCopy(
p->puTempW, If_CutTruthWR(
p, pCut),
p->nTruth6Words[pCut->
nLeaves], 0 );
83 truthId = Vec_MemHashInsert(
p->vTtMem[pCut->
nLeaves],
p->puTempW );
84 pCut->
iCutFunc = Abc_Var2Lit( truthId, If_CutTruthIsCompl(pCut) );
85 assert( (
p->puTempW[0] & 1) == 0 );
101 int fCompl, truthId, nLeavesNew, PrevSize, RetValue = 0;
107 Abc_TtCopy( pTruth0, pTruth0s,
p->nTruth6Words[pCut0->
nLeaves], fCompl0 ^ pCut0->
fCompl ^ Abc_LitIsCompl(pCut0->
iCutFunc) );
108 Abc_TtCopy( pTruth1, pTruth1s,
p->nTruth6Words[pCut1->
nLeaves], fCompl1 ^ pCut1->
fCompl ^ Abc_LitIsCompl(pCut1->
iCutFunc) );
113 fCompl = (pTruth0[0] & pTruth1[0] & 1);
114 Abc_TtAnd( pTruth, pTruth0, pTruth1,
p->nTruth6Words[pCut->
nLeaves], fCompl );
118 if ( nLeavesNew < If_CutLeaveNum(pCut) )
121 pCut->
uSign = If_ObjCutSignCompute( pCut );
125 PrevSize = Vec_MemEntryNum(
p->vTtMem[pCut->
nLeaves] );
126 truthId = Vec_MemHashInsert(
p->vTtMem[pCut->
nLeaves], pTruth );
127 pCut->
iCutFunc = Abc_Var2Lit( truthId, fCompl );
128 assert( (pTruth[0] & 1) == 0 );
137 if (
p->vTtIsops[pCut->
nLeaves] && PrevSize != Vec_MemEntryNum(
p->vTtMem[pCut->
nLeaves]) )
143 Vec_IntGrow( vLevel, Vec_IntSize(
p->vCover) );
144 Vec_IntAppend( vLevel,
p->vCover );
146 vLevel->nCap ^= (1<<16);
169 int v, Place, fCompl, truthId, nLeavesNew, RetValue = 0;
170 word * pTruth0s = Vec_MemReadEntry(
p->vTtMem[pCut0->
nLeaves], Abc_Lit2Var(iCutFunc0) );
171 word * pTruth1s = Vec_MemReadEntry(
p->vTtMem[pCut1->
nLeaves], Abc_Lit2Var(iCutFunc1) );
177 Abc_TtCopy( pTruth0, pTruth0s,
p->nTruth6Words[pCut0->
nLeaves], Abc_LitIsCompl(iCutFunc0) );
178 Abc_TtCopy( pTruth1, pTruth1s,
p->nTruth6Words[pCut1->
nLeaves], Abc_LitIsCompl(iCutFunc1) );
188 for ( v = 0; v < (int)pCut0->
nLeaves; v++ )
189 pCut->
pLeaves[v] = Abc_Var2Lit( pCut0->
pLeaves[v], If_CutLeafBit(pCut0, v) );
190 for ( v = 0; v < (int)pCut1->
nLeaves; v++ )
191 if (
p->pPerm[1][v] >= (
int)pCut0->
nLeaves )
192 pCut->
pLeaves[
p->pPerm[1][v]] = Abc_Var2Lit( pCut1->
pLeaves[v], If_CutLeafBit(pCut1, v) );
193 else if ( If_CutLeafBit(pCut0,
p->pPerm[1][v]) != If_CutLeafBit(pCut1, v) )
194 Abc_TtFlip( pTruth1,
p->nTruth6Words[pCut1->
nLeaves], v );
198 for ( v = 0; v < (int)pCut1->
nLeaves; v++ )
200 Place =
p->pPerm[1][v];
201 if ( Place == v || Place == -1 )
203 Abc_TtSwapVars( pTruth1, pCut->
nLeaves, v, Place );
204 p->pPerm[1][v] =
p->pPerm[1][Place];
205 p->pPerm[1][Place] = Place;
216 Abc_TtAnd( pTruth, pTruth0, pTruth1,
p->nTruth6Words[pCut->
nLeaves], 0 );
221 if ( nLeavesNew < If_CutLeaveNum(pCut) )
228if (
p->pPars->fVerbose )
231if (
p->pPars->fVerbose )
232p->timeCache[3] += Abc_Clock() - clk;
233 for ( v = 0; v < (int)pCut->
nLeaves; v++ )
234 pPerm[v] = Abc_LitNotCond( pCut->
pLeaves[(
int)
p->pCanonPerm[v]], ((
p->uCanonPhase>>v)&1) );
236 for ( v = 0; v < (int)pCut->
nLeaves; v++ )
238 pCut->
pLeaves[v] = Abc_Lit2Var(pPerm[v]);
239 if ( Abc_LitIsCompl(pPerm[v]) )
244 pCut->
uSign = If_ObjCutSignCompute( pCut );
246 assert( pCut->
uSign == If_ObjCutSignCompute( pCut ) );
250 fCompl = ((
p->uCanonPhase >> pCut->
nLeaves) & 1);
251 truthId = Vec_MemHashInsert(
p->vTtMem[pCut->
nLeaves], pTruth );
252 pCut->
iCutFunc = Abc_Var2Lit( truthId, fCompl );
254 if ( Vec_IntSize(
p->vTtOccurs[pCut->
nLeaves]) < Vec_MemEntryNum(
p->vTtMem[pCut->
nLeaves]) )
255 Vec_IntPush(
p->vTtOccurs[pCut->
nLeaves], 0 );
256 Vec_IntAddToEntry(
p->vTtOccurs[pCut->
nLeaves], truthId, 1 );
272 int i, Num, nEntriesOld, RetValue;
275if (
p->pPars->fVerbose )
278if (
p->pPars->fVerbose )
279p->timeCache[0] += Abc_Clock() - clk;
283 nEntriesOld = Hash_IntManEntryNum(
p->vPairHash);
284 Num = Hash_Int2ManInsert(
p->vPairHash, (iCutFunc0 << 5)|pCut0->
nLeaves, (iCutFunc1 << 5)|pCut1->
nLeaves, -1 );
286 if ( nEntriesOld == Hash_IntManEntryNum(
p->vPairHash) )
290 pCut->
iCutFunc = Vec_IntEntry(
p->vPairRes, Num );
292 for ( v = 0; v < (int)pCut->
nLeaves; v++ )
294 pCut->
pLeaves[v] = Abc_Var2Lit( pCut->
pLeaves[v], If_CutLeafBit(pCut0, v) );
298 pCanonPerm = Vec_StrEntryP(
p->vPairPerms, Num * pCut->
nLimit );
299 for ( v = 0; v < (int)pCut->
nLeaves; v++ )
300 pPerm[v] = Abc_LitNotCond( pCut->
pLeaves[Abc_Lit2Var((
int)pCanonPerm[v])], Abc_LitIsCompl((
int)pCanonPerm[v]) );
303 for ( v = 0; v < (int)pCut->
nLeaves; v++ )
305 pCut->
pLeaves[v] = Abc_Lit2Var(pPerm[v]);
306 if ( Abc_LitIsCompl(pPerm[v]) )
314if (
p->pPars->fVerbose )
321 assert( Num == Vec_IntSize(
p->vPairRes) );
322 Vec_IntPush(
p->vPairRes, pCut->
iCutFunc );
324 assert( Num * (
int)pCut->
nLimit == Vec_StrSize(
p->vPairPerms) );
325 for ( i = 0; i < (int)pCut->
nLeaves; i++ )
326 Vec_StrPush(
p->vPairPerms, (
char)Abc_Var2Lit((
int)
p->pCanonPerm[i], ((
p->uCanonPhase>>i)&1)) );
328 Vec_StrPush(
p->vPairPerms, (
char)-1 );
329if (
p->pPars->fVerbose )
330p->timeCache[2] += Abc_Clock() - clk;
348 int nMints = (1 << nVars);
353 word tCur, tTemp1, tTemp2;
354 Vec_Mem_t * vTtMem6 = Vec_MemAllocForTTSimple( nVars );
356 for ( i = 0; i < 2; i++ )
358 tCur = i ? ~uTruth : uTruth;
360 for (
p = 0;
p < nPerms;
p++ )
363 for ( c = 0; c < nMints; c++ )
367 Vec_MemHashInsert( vTtMem6, &tCur );
368 tCur = Abc_Tt6Flip( tCur, pComp[c] );
371 tCur = Abc_Tt6SwapAdjacent( tCur, pPerm[
p] );
389 Extra_PrintHex( stdout, (
unsigned*)&uTruth, nVars ); printf(
"\n" );
390 Extra_PrintHex( stdout, (
unsigned*)&Canon, nVars ); printf(
"\n" );
391 printf(
"Members = %d.\n", Vec_MemEntryNum(vTtMem6) );
int If_CutComputeTruthPerm_int(If_Man_t *p, If_Cut_t *pCut, If_Cut_t *pCut0, If_Cut_t *pCut1, int iCutFunc0, int iCutFunc1)
int If_CutComputeTruthPerm(If_Man_t *p, If_Cut_t *pCut, If_Cut_t *pCut0, If_Cut_t *pCut1, int iCutFunc0, int iCutFunc1)
ABC_NAMESPACE_IMPL_START void If_CutTruthPermute(word *pTruth, int nLeaves, int nVars, int nWords, float *pDelays, int *pVars)
DECLARATIONS ///.
int If_CutComputeTruth(If_Man_t *p, If_Cut_t *pCut, If_Cut_t *pCut0, If_Cut_t *pCut1, int fCompl0, int fCompl1)