90 pNew->
pName = Abc_UtilStrsav(
p->pName );
91 Gia_ManConst0(
p)->Value = 0;
94 if ( Gia_ObjIsMuxId(
p, i) )
95 pObj->
Value = Mig_ManAppendMux( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj), Gia_ObjFanin2Copy(
p, pObj) );
96 else if ( Gia_ObjIsXor(pObj) )
97 pObj->
Value = Mig_ManAppendXor( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
98 else if ( Gia_ObjIsAnd(pObj) )
99 pObj->
Value = Mig_ManAppendAnd( pNew, Mig_ObjFanin0Copy(pObj), Mig_ObjFanin1Copy(pObj) );
100 else if ( Gia_ObjIsCi(pObj) )
101 pObj->
Value = Mig_ManAppendCi( pNew );
102 else if ( Gia_ObjIsCo(pObj) )
103 pObj->
Value = Mig_ManAppendCo( pNew, Mig_ObjFanin0Copy(pObj) );
106 Mig_ManSetRegNum( pNew, Gia_ManRegNum(
p) );
107 if ( Gia_ManHasChoices(
p) )
129 int iFunc, iFunc0, iFunc1, iFunc2 = 0;
132 pCut = Mpm_ObjCutBestP( pMan, pObj );
134 if ( Mpm_CutDataInt(pCut) )
135 return Mpm_CutDataInt(pCut);
137 Vec_PtrPush( vVisited, pCut );
139 Mpm_CutSetDataInt( pCut, ~0 );
141 if ( Mig_ObjIsCi(pObj) )
142 return Mpm_CutDataInt(pCut);
144 for ( pTemp = pObj; pTemp; pTemp = Mig_ObjSibl(pTemp) )
152 if ( Mig_ObjIsNode3(pTemp) )
157 iFunc2 = Abc_LitNotCond(iFunc2, Mig_ObjFaninC2(pTemp));
159 iFunc0 = Abc_LitNotCond(iFunc0, Mig_ObjFaninC0(pTemp));
160 iFunc1 = Abc_LitNotCond(iFunc1, Mig_ObjFaninC1(pTemp));
164 if ( Mig_ObjIsMux(pTemp) )
166 else if ( Mig_ObjIsXor(pTemp) )
173 if ( Mig_ObjIsMux(pTemp) )
174 iFunc = Gia_ManAppendMux( pNew, iFunc2, iFunc1, iFunc0 );
175 else if ( Mig_ObjIsXor(pTemp) )
176 iFunc = Gia_ManAppendXor( pNew, iFunc0, iFunc1 );
178 iFunc = Gia_ManAppendAnd( pNew, iFunc0, iFunc1 );
180 if ( Mig_ObjPhase(pTemp) != Mig_ObjPhase(pObj) )
181 iFunc = Abc_LitNot(iFunc);
182 Mpm_CutSetDataInt( pCut, iFunc );
185 return Mpm_CutDataInt(pCut);
218 Vec_Int_t * vMapping, * vMapping2, * vPacking = NULL;
219 Vec_Int_t * vLeaves, * vLeaves2, * vCover;
220 word uTruth, * pTruth = &uTruth;
221 int i, k, Entry, iLitNew = 0;
224 vMapping = Vec_IntStart( Mig_ManObjNum(pMan->
pMig) );
225 vMapping2 = Vec_IntStart( 1 );
228 vPacking = Vec_IntAlloc( 1000 );
229 Vec_IntPush( vPacking, 0 );
234 vCover = Vec_IntAlloc( 1 << 16 );
235 vLeaves = Vec_IntAlloc( 16 );
236 vLeaves2 = Vec_IntAlloc( 16 );
237 Mig_ManCleanCopy( pMan->
pMig );
240 if ( !Mpm_ObjMapRef(pMan, pObj) && !Mig_ObjIsTerm(pObj) )
242 if ( Mig_ObjIsNode(pObj) )
245 Vec_IntClear( vLeaves );
246 pCutBest = Mpm_ObjCutBestP( pMan, pObj );
248 Vec_IntPush( vLeaves, Mig_ObjCopy(pFanin) );
254 pTruth = Mpm_CutTruth(pMan, Abc_Lit2Var(pCutBest->
iFunc));
259 iLitNew =
Gia_ManFromIfLogicNode( NULL, pNew, Mig_ObjId(pObj), vLeaves, vLeaves2, pTruth, NULL, vCover, vMapping, vMapping2, vPacking, 0, 0 );
260 iLitNew = Abc_LitNotCond( iLitNew, pCutBest->
fCompl ^ Abc_LitIsCompl(pCutBest->
iFunc) );
267 Vec_IntSetEntry( vMapping, Abc_Lit2Var(iLitNew), Vec_IntSize(vMapping2) );
268 Vec_IntPush( vMapping2, Vec_IntSize(vLeaves) );
270 assert( Abc_Lit2Var(Entry) < Abc_Lit2Var(iLitNew) );
272 Vec_IntPush( vMapping2, Abc_Lit2Var(Entry) );
273 Vec_IntPush( vMapping2, Abc_Lit2Var(iLitNew) );
276 else if ( Mig_ObjIsCi(pObj) )
277 iLitNew = Gia_ManAppendCi(pNew);
278 else if ( Mig_ObjIsCo(pObj) )
279 iLitNew = Gia_ManAppendCo( pNew, Abc_LitNotCond(Mig_ObjCopy(Mig_ObjFanin0(pObj)), Mig_ObjFaninC0(pObj)) );
280 else if ( Mig_ObjIsConst0(pObj) )
284 Vec_IntWriteEntry( vMapping, 0, Vec_IntSize(vMapping2) );
285 Vec_IntPush( vMapping2, 0 );
286 Vec_IntPush( vMapping2, 0 );
289 Mig_ObjSetCopy( pObj, iLitNew );
291 Vec_IntFree( vCover );
292 Vec_IntFree( vLeaves );
293 Vec_IntFree( vLeaves2 );
297 if ( Vec_IntSize(vMapping) > Gia_ManObjNum(pNew) )
298 Vec_IntShrink( vMapping, Gia_ManObjNum(pNew) );
300 Vec_IntFillExtra( vMapping, Gia_ManObjNum(pNew), 0 );
301 assert( Vec_IntSize(vMapping) == Gia_ManObjNum(pNew) );
304 Vec_IntAddToEntry( vMapping, i, Gia_ManObjNum(pNew) );
305 Vec_IntAppend( vMapping, vMapping2 );
306 Vec_IntFree( vMapping2 );
316 assert( !Gia_ObjIsAnd(Gia_ObjFanin0(pObj)) || Gia_ObjIsLut(pNew, Gia_ObjFaninId0p(pNew, pObj)) );
int Gia_ManFromIfLogicNode(void *pIfMan, Gia_Man_t *pNew, int iObj, Vec_Int_t *vLeaves, Vec_Int_t *vLeavesTemp, word *pRes, char *pStr, Vec_Int_t *vCover, Vec_Int_t *vMapping, Vec_Int_t *vMapping2, Vec_Int_t *vPacking, int fCheck75, int fCheck44e)