DECLARATIONS ///.
Date [Ver. 1.0. Started - June 20, 2005.]
] FUNCTION DEFINITIONS /// Function*************************************************************
46{
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 );
53
54
55 Vec_IntFreeP( &pGia->
vXors );
57 printf(
"Collected %d topmost XORs\n", Vec_IntSize(pGia->
vXors) );
58
60 {
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) );
67 if ( fVeryVerbose )
68 printf( "Recognizing %d => XXXOR(%d %d)\n", iAnd, Gia_ObjFaninId0(pAnd, iAnd), Gia_ObjFaninId1(pAnd, iAnd) );
69 }
70
71
72 for ( Iter = 0; fFoundAll; Iter++ )
73 {
74 if ( fVeryVerbose )
75 printf( "Iteration %d\n", Iter );
76
77
78 fFoundAll = 0;
79 do {
80 fFound = 0;
81 for ( i = Vec_IntSize(vFadds)/5 - 1; i >= 0; i-- )
82 {
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) )
86 {
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) );
93 fFound = 1;
94 fFoundAll = 1;
95 if ( fVeryVerbose )
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) );
97 }
98 }
99 } while ( fFound );
100
101 do {
102 fFound = 0;
103 for ( i = Vec_IntSize(vHadds)/2 - 1; i >= 0; i-- )
104 {
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) )
108 {
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) );
115 fFound = 1;
116 fFoundAll = 1;
117 if ( fVeryVerbose )
118 printf( "Recognizing (%d %d) => HA(%d %d)\n", iXor, iMaj, Gia_ObjFaninId0(pAnd, iMaj), Gia_ObjFaninId1(pAnd, iMaj) );
119 }
120 }
121 break;
122 } while ( fFound );
123 if ( fFoundAll )
124 continue;
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154 }
155
156
157
158 vLeft = Vec_IntAlloc( 100 );
160 if ( Entry && Gia_ObjIsAnd(Gia_ManObj(pGia, i)) )
161 Vec_IntPush( vLeft, i );
162 Vec_IntFree( vMap );
163
164
165 vRecord2 = Vec_IntAlloc( 100 );
169 Vec_IntWriteEntry( vRecord2, i, Abc_Var2Lit2(iAnd, 0) );
170
171
172 if ( fDumpLeftOver )
173 {
177 printf( "Leftover AIG with %d nodes is dumped into file \"%s\".\n", Gia_ManAndNum(pNew), "leftover.aig" );
179 }
180 Vec_IntFree( vLeft );
181
182 Vec_IntReverseOrder( vRecord );
183 Vec_IntAppend( vRecord2, vRecord );
184 Vec_IntFree( vRecord );
185 return vRecord2;
186}
Vec_Int_t * Gia_PolynCollectLastXor(Gia_Man_t *pGia, int fVerbose)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
void Gia_ManStop(Gia_Man_t *p)
#define Gia_ManForEachCoDriverId(p, DriverId, i)
struct Gia_Obj_t_ Gia_Obj_t
struct Gia_Man_t_ Gia_Man_t
void Gia_ManIncrementTravId(Gia_Man_t *p)
Gia_Man_t * Gia_ManDupAndCones(Gia_Man_t *p, int *pAnds, int nAnds, int fTrimPis)
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact, int fWriteNewLine)
void Gia_ManCollectAnds(Gia_Man_t *p, int *pNodes, int nNodes, Vec_Int_t *vNodes, Vec_Int_t *vLeaves)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.