140{
142 Vec_Int_t * vCopy = Vec_IntStartFull( Gia_ManObjNum(
p) );
143 Vec_Int_t * vCopy2 = Vec_IntStartFull( Gia_ManObjNum(
p) );
144 Vec_Int_t * vLuts[3], * vRos[3], * vRegs[2], * vInits[2], * vTemp;
145 int i, k, Id, iFan;
146 for ( i = 0; i < 3; i++ )
147 {
148 vLuts[i] = Vec_IntAlloc(100);
149 vRos[i] = Vec_IntAlloc(100);
150 if ( i == 2 ) break;
151 vRegs[i] = Vec_IntAlloc(100);
152 }
154 if ( Vec_IntEntry(vCounts, i) == 1 )
155 Vec_IntPush( vLuts[0], i );
156 else if ( Vec_IntEntry(vCounts, i) == -1 )
157 Vec_IntPush( vLuts[1], i );
158 else if ( Vec_IntEntry(vCounts, i) == 0 )
159 Vec_IntPush( vLuts[2], i );
161 assert( Vec_IntSize(vLuts[0]) || Vec_IntSize(vLuts[1]) );
162 if ( Vec_IntSize(vLuts[0]) )
163 {
166 Gia_ObjSetTravIdCurrentId(
p, Id);
168 if ( Gia_ObjIsTravIdCurrent(
p, Gia_ObjFanin0(Gia_ObjRoToRi(
p, pObj))) )
169 Vec_IntPush( vRos[0], Gia_ObjId(
p, pObj) );
170 assert( !Vec_IntSize(vLuts[0]) == !Vec_IntSize(vRos[0]) );
171 }
172 if ( Vec_IntSize(vLuts[1]) )
173 {
177 Gia_ObjSetTravIdCurrentId(
p, iFan);
179 if ( Gia_ObjIsTravIdCurrent(
p, pObj) )
180 Vec_IntPush( vRos[1], Gia_ObjId(
p, pObj) );
181 assert( !Vec_IntSize(vLuts[1]) == !Vec_IntSize(vRos[1]) );
182 }
184 for ( k = 0; k < 2; k++ )
186 Gia_ObjSetTravIdCurrentId(
p, Id);
188 if ( !Gia_ObjIsTravIdCurrent(
p, pObj) )
189 Vec_IntPush( vRos[2], Gia_ObjId(
p, pObj) );
190
193 Gia_ObjSetTravIdCurrentId(
p, Id);
196 if ( !Gia_ObjUpdateTravIdCurrentId(
p, iFan) )
197 Vec_IntPush( vRegs[0], iFan );
198 Vec_IntSort( vRegs[0], 0 );
199 assert( Vec_IntCountDuplicates(vRegs[1]) == 0 );
200 assert( !Vec_IntSize(vLuts[0]) == !Vec_IntSize(vRegs[0]) );
201
205 Gia_ObjSetTravIdCurrentId(
p, iFan);
208 Gia_ObjSetTravIdCurrentId(
p, iFan);
210 Gia_ObjSetTravIdCurrentId(
p, Gia_ObjFaninId0p(
p, pObj));
212 if ( Gia_ObjIsTravIdCurrentId(
p, Id) )
213 Vec_IntPush( vRegs[1], Id );
215 if ( Gia_ObjIsTravIdCurrentId(
p, Id) )
216 Vec_IntPush( vRegs[1], Id );
217 Vec_IntSort( vRegs[1], 0 );
218 assert( Vec_IntCountDuplicates(vRegs[1]) == 0 );
219 assert( !Vec_IntSize(vLuts[1]) == !Vec_IntSize(vRegs[1]) );
220
221 vInits[0] = Vec_IntSize(vLuts[0]) ?
Gia_ManSifInitPos(
p, vLuts[0], vRegs[0] ) : Vec_IntAlloc(0);
222 vInits[1] = Vec_IntSize(vLuts[1]) ?
Gia_ManSifInitNeg(
p, vLuts[1], vRegs[1] ) : Vec_IntAlloc(0);
223
224 if ( fVerbose )
225 {
226 printf( "Flops : %5d %5d %5d\n", Vec_IntSize(vRos[0]), Vec_IntSize(vRos[1]), Vec_IntSize(vRos[2]) );
227 printf( "LUTs : %5d %5d %5d\n", Vec_IntSize(vLuts[0]), Vec_IntSize(vLuts[1]), Vec_IntSize(vLuts[2]) );
228 printf( "Spots : %5d %5d %5d\n", Vec_IntSize(vRegs[0]), Vec_IntSize(vRegs[1]), 0 );
229 }
230
231 pNew =
Gia_ManStart( Gia_ManObjNum(
p) + Vec_IntSize(vRegs[0]) + Vec_IntSize(vRegs[1]) );
232 pNew->
pName = Abc_UtilStrsav(
p->pName );
233 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
234
235 Vec_IntWriteEntry( vCopy, 0, 0 );
237 Vec_IntWriteEntry( vCopy, Gia_ObjId(
p, pObj), Gia_ManAppendCi(pNew) );
239 Vec_IntWriteEntry( vCopy, Id, Gia_ManAppendCi(pNew) );
241 Vec_IntWriteEntry( vCopy, Id, Abc_LitNotCond(Gia_ManAppendCi(pNew), Vec_IntEntry(vInits[1], i)) );
242
243 vTemp = Vec_IntAlloc(100);
245 Vec_IntPush( vTemp, Vec_IntEntry(vCopy, Id) );
247 Vec_IntWriteEntry( vCopy, Id, Abc_LitNotCond(Gia_ManAppendCi(pNew), Vec_IntEntry(vInits[0], i)) );
251 Vec_IntWriteEntry( vCopy, Id, Vec_IntEntry(vTemp, i) );
252 Vec_IntFree( vTemp );
253
255 Vec_IntWriteEntry( vCopy, Vec_IntEntry(vRos[0], i), Abc_LitNotCond(Vec_IntEntry(vCopy, Gia_ObjFaninId0p(
p, pObj)), Gia_ObjFaninC0(pObj)) );
258
260 Vec_IntWriteEntry( vCopy2, Vec_IntEntry(vRos[1], i), Abc_LitNotCond(Vec_IntEntry(vCopy, Gia_ObjFaninId0p(
p, pObj)), Gia_ObjFaninC0(pObj)) );
263
265 Gia_ManAppendCo( pNew, Abc_LitNotCond(Vec_IntEntry(vCopy, Gia_ObjFaninId0p(
p, pObj)), Gia_ObjFaninC0(pObj)) );
267 Gia_ManAppendCo( pNew, Abc_LitNotCond(Vec_IntEntry(vCopy, Gia_ObjFaninId0p(
p, pObj)), Gia_ObjFaninC0(pObj)) );
269 Gia_ManAppendCo( pNew, Abc_LitNotCond(Vec_IntEntry(vCopy2, Id), Vec_IntEntry(vInits[1], i)) );
271 Gia_ManAppendCo( pNew, Abc_LitNotCond(Vec_IntEntry(vCopy, Id), Vec_IntEntry(vInits[0], i)) );
272
273 Gia_ManSetRegNum( pNew, Vec_IntSize(vRos[2]) + Vec_IntSize(vRegs[0]) + Vec_IntSize(vRegs[1]) );
274
275 for ( i = 0; i < 3; i++ )
276 {
277 Vec_IntFreeP( &vLuts[i] );
278 Vec_IntFreeP( &vRos[i] );
279 if ( i == 2 ) break;
280 Vec_IntFreeP( &vRegs[i] );
281 Vec_IntFreeP( &vInits[i] );
282 }
283 Vec_IntFree( vCopy );
284 Vec_IntFree( vCopy2 );
285 return pNew;
286}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
void Gia_ManSifDupNode(Gia_Man_t *pNew, Gia_Man_t *p, int iObj, Vec_Int_t *vCopy)
Vec_Int_t * Gia_ManSifInitPos(Gia_Man_t *p, Vec_Int_t *vMoves, Vec_Int_t *vRegs)
Vec_Int_t * Gia_ManSifInitNeg(Gia_Man_t *p, Vec_Int_t *vMoves, Vec_Int_t *vRegs)
#define Gia_ManForEachRo(p, pObj, i)
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
#define Gia_ManForEachLut(p, i)
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
#define Gia_LutForEachFanin(p, i, iFan, k)
struct Gia_Man_t_ Gia_Man_t
#define Gia_ManForEachRoToRiVec(vRoIds, p, pObj, i)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.