47 int fDumpLeftOver = 0;
48 int i, iXor, iMaj, iAnd, Entry, Iter, fFound, fFoundAll = 1;
49 Vec_Int_t * vRecord = Vec_IntAlloc( 100 ), * vLeft, * vRecord2;
50 Vec_Int_t * vMap = Vec_IntStart( Gia_ManObjNum(pGia) );
52 Vec_IntWriteEntry( vMap, iAnd, 1 );
55 Vec_IntFreeP( &pGia->
vXors );
57 printf(
"Collected %d topmost XORs\n", Vec_IntSize(pGia->
vXors) );
61 Gia_Obj_t * pAnd = Gia_ManObj( pGia, iAnd );
62 assert( Vec_IntEntry(vMap, iAnd) );
63 Vec_IntWriteEntry( vMap, iAnd, 0 );
64 Vec_IntWriteEntry( vMap, Gia_ObjFaninId0(pAnd, iAnd), 1 );
65 Vec_IntWriteEntry( vMap, Gia_ObjFaninId1(pAnd, iAnd), 1 );
66 Vec_IntPush( vRecord, Abc_Var2Lit2(iAnd, 3) );
68 printf(
"Recognizing %d => XXXOR(%d %d)\n", iAnd, Gia_ObjFaninId0(pAnd, iAnd), Gia_ObjFaninId1(pAnd, iAnd) );
72 for ( Iter = 0; fFoundAll; Iter++ )
75 printf(
"Iteration %d\n", Iter );
81 for ( i = Vec_IntSize(vFadds)/5 - 1; i >= 0; i-- )
83 iXor = Vec_IntEntry(vFadds, 5*i+3);
84 iMaj = Vec_IntEntry(vFadds, 5*i+4);
85 if ( Vec_IntEntry(vMap, iXor) && Vec_IntEntry(vMap, iMaj) )
87 Vec_IntWriteEntry( vMap, iXor, 0 );
88 Vec_IntWriteEntry( vMap, iMaj, 0 );
89 Vec_IntWriteEntry( vMap, Vec_IntEntry(vFadds, 5*i+0), 1 );
90 Vec_IntWriteEntry( vMap, Vec_IntEntry(vFadds, 5*i+1), 1 );
91 Vec_IntWriteEntry( vMap, Vec_IntEntry(vFadds, 5*i+2), 1 );
92 Vec_IntPush( vRecord, Abc_Var2Lit2(i, 2) );
96 printf(
"Recognizing (%d %d) => FA(%d %d %d)\n", iXor, iMaj, Vec_IntEntry(vFadds, 5*i+0), Vec_IntEntry(vFadds, 5*i+1), Vec_IntEntry(vFadds, 5*i+2) );
103 for ( i = Vec_IntSize(vHadds)/2 - 1; i >= 0; i-- )
105 iXor = Vec_IntEntry(vHadds, 2*i+0);
106 iMaj = Vec_IntEntry(vHadds, 2*i+1);
107 if ( Vec_IntEntry(vMap, iXor) && Vec_IntEntry(vMap, iMaj) )
109 Gia_Obj_t * pAnd = Gia_ManObj( pGia, iMaj );
110 Vec_IntWriteEntry( vMap, iXor, 0 );
111 Vec_IntWriteEntry( vMap, iMaj, 0 );
112 Vec_IntWriteEntry( vMap, Gia_ObjFaninId0(pAnd, iMaj), 1 );
113 Vec_IntWriteEntry( vMap, Gia_ObjFaninId1(pAnd, iMaj), 1 );
114 Vec_IntPush( vRecord, Abc_Var2Lit2(i, 1) );
118 printf(
"Recognizing (%d %d) => HA(%d %d)\n", iXor, iMaj, Gia_ObjFaninId0(pAnd, iMaj), Gia_ObjFaninId1(pAnd, iMaj) );
158 vLeft = Vec_IntAlloc( 100 );
160 if ( Entry && Gia_ObjIsAnd(Gia_ManObj(pGia, i)) )
161 Vec_IntPush( vLeft, i );
165 vRecord2 = Vec_IntAlloc( 100 );
169 Vec_IntWriteEntry( vRecord2, i, Abc_Var2Lit2(iAnd, 0) );
177 printf(
"Leftover AIG with %d nodes is dumped into file \"%s\".\n", Gia_ManAndNum(pNew),
"leftover.aig" );
180 Vec_IntFree( vLeft );
182 Vec_IntReverseOrder( vRecord );
183 Vec_IntAppend( vRecord2, vRecord );
184 Vec_IntFree( vRecord );
204 Vec_Int_t * vOrder = Vec_IntAlloc( Gia_ManAndNum(pGia) );
205 Vec_Int_t * vOrder2 = Vec_IntStart( Gia_ManObjNum(pGia) );
212 int Node = Abc_Lit2Var2(Entry);
213 int Attr = Abc_Lit2Att2(Entry);
216 int * pFanins = Vec_IntEntryP( vFadds, 5*Node );
217 for ( k = 3; k < 5; k++ )
220 else if ( Attr == 1 )
222 int * pFanins = Vec_IntEntryP( vHadds, 2*Node );
223 for ( k = 0; k < 2; k++ )
235 Vec_IntWriteEntry( vOrder2, Entry, 1+i );
237 Vec_IntWriteEntry( vOrder2, Entry, 1+Gia_ManCiNum(pGia)+i );
240 Vec_IntFree( vRecord );
241 Vec_IntFree( vFadds );
242 Vec_IntFree( vHadds );
243 Vec_IntFree( vOrder );