55 Vec_IntPushTwo( vXorPairs, Gia_ObjId(pGia, Gia_Regular(pFan0)), Gia_ObjId(pGia, Gia_Regular(pFan1)) );
60 Vec_Int_t * vNewOuts = Vec_IntAlloc( 100 );
61 Vec_Int_t * vXorPairs = Vec_IntAlloc( 100 );
62 Gia_Obj_t * pObj = Gia_ManCo( pGia, Gia_ManCoNum(pGia)-1 );
68 Gia_Obj_t * pFan0 = Gia_ManObj( pGia, iFan0 );
69 Gia_Obj_t * pFan1 = Gia_ManObj( pGia, iFan1 );
70 int iLit0 = Abc_Var2Lit( iFan0, pFan0->
fPhase );
71 int iLit1 = Abc_Var2Lit( iFan1, pFan1->
fPhase );
72 int iRoot = Gia_ManAppendAnd( pGia, iLit0, iLit1 );
73 Vec_IntPush( vNewOuts, Abc_Lit2Var(iRoot) );
75 Vec_IntFree( vXorPairs );
76 Vec_IntReverseOrder( vNewOuts );
96 Vec_Wec_t * vMap = Vec_WecStart( nObjs );
int i;
97 for ( i = 0; 6*i < Vec_IntSize(vAdds); i++ )
99 int Entry1 = Vec_IntEntry( vAdds, 6*i + 3 );
100 int Entry2 = Vec_IntEntry( vAdds, 6*i + 4 );
101 Vec_WecPush( vMap, Entry1, i );
102 Vec_WecPush( vMap, Entry1, Entry2 );
103 Vec_WecPush( vMap, Entry2, i );
104 Vec_WecPush( vMap, Entry2, Entry1 );
110 Vec_Int_t * vOrder = Vec_IntAlloc( 1000 );
111 Vec_Bit_t * vIsRoot = Vec_BitStart( Gia_ManObjNum(pGia) );
112 int i, k, Index = -1, Driver, Entry1, Entry2 = -1;
115 Vec_BitWriteEntry( vIsRoot, Driver, 1 );
122 Vec_Int_t * vLevel = Vec_WecEntry( vMap, Entry1 );
124 if ( Vec_BitEntry(vIsRoot, Entry2) )
126 if ( k == Vec_IntSize(vLevel) )
128 assert( Vec_BitEntry(vIsRoot, Entry1) );
129 assert( Vec_BitEntry(vIsRoot, Entry2) );
131 Vec_IntPush( vOrder, Index );
133 Vec_BitWriteEntry( vIsRoot, Entry1, 0 );
134 Vec_BitWriteEntry( vIsRoot, Entry2, 0 );
135 Vec_IntRemove( vRoots, Entry1 );
136 Vec_IntRemove( vRoots, Entry2 );
138 Entry1 = Vec_IntEntry( vAdds, 6*Index + 0 );
139 Entry2 = Vec_IntEntry( vAdds, 6*Index + 1 );
140 Driver = Vec_IntEntry( vAdds, 6*Index + 2 );
141 Vec_BitWriteEntry( vIsRoot, Entry1, 1 );
142 Vec_BitWriteEntry( vIsRoot, Entry2, 1 );
143 Vec_BitWriteEntry( vIsRoot, Driver, 1 );
144 Vec_IntPushUnique( vRoots, Entry1 );
145 Vec_IntPushUnique( vRoots, Entry2 );
146 Vec_IntPushUnique( vRoots, Driver );
149 if ( i == Vec_IntSize(vRoots) )
155 *pvIns = Vec_IntAlloc( Vec_BitSize(vIsRoot) );
158 Vec_IntPush( *pvIns, i );
160 Vec_BitFree( vIsRoot );
167 Vec_Int_t * vRoots = Vec_IntAlloc( Gia_ManCoNum(pGia) );
171 Vec_IntPush( vRoots, Driver );
175 Vec_IntPush( vRoots, Driver );
178 *pvOuts = Vec_IntDup( vRoots );
181 Vec_IntFree( vRoots );
183 printf(
"Collected %d boxes.\n", Vec_IntSize(vOrder) );
201 for ( k = 0; k < 3; k++ )
203 int i, Index, Sum, Carry = Vec_IntEntry( vAdds, 6*iBox+k );
204 Vec_Int_t * vLevel = Vec_WecEntry( vMap, Carry );
208 if ( Vec_IntEntry(vAdds, 6*Index+4) == Carry && !Vec_BitEntry(vMarks, Sum) )
210 Vec_IntPush( vRoots, Sum );
217 Vec_IntClear( vRoots );
218 Vec_IntPush( vRoots, Vec_IntEntry(vAdds, 6*iBox+3) );
219 Vec_IntPush( vRoots, Vec_IntEntry(vAdds, 6*iBox+4) );
227 Vec_Wec_t * vRes = Vec_WecStart( Vec_IntSize(vRootBoxes) );
235 Vec_IntAppend( Vec_WecEntry(vRes, i), vOrder );
236 Vec_IntFree( vOrder );
238 Vec_BitFree( vMarks );
239 Vec_IntFree( vRoots );
257 if ( Vec_BitEntry(vVisited, iObj) )
259 Vec_BitSetEntry( vVisited, iObj, 1 );
262 Vec_IntPush( vNodes, iObj );
266 Vec_Int_t * vNodes = Vec_IntAlloc( 1000 );
267 Vec_Bit_t * vVisited = Vec_BitStart( Gia_ManObjNum(pGia) );
268 int i, Index, Entry1, Entry2, Entry3;
272 Entry1 = Vec_IntEntry( vAdds, 6*Index + 0 );
273 Entry2 = Vec_IntEntry( vAdds, 6*Index + 1 );
274 Entry3 = Vec_IntEntry( vAdds, 6*Index + 2 );
275 Vec_BitWriteEntry( vVisited, Entry1, 1 );
276 Vec_BitWriteEntry( vVisited, Entry2, 1 );
277 Vec_BitWriteEntry( vVisited, Entry3, 1 );
279 Entry1 = Vec_IntEntry( vAdds, 6*Index + 3 );
280 Entry2 = Vec_IntEntry( vAdds, 6*Index + 4 );
284 Vec_BitFree( vVisited );
306 printf(
"%4d : ", i );
314 int SuppMax = 0, ConeMax = 0;
320 printf(
"Remaining cones: Count = %d. SuppMax = %d. ConeMax = %d.\n", Vec_IntSize(vLeaves), SuppMax, ConeMax );
339 assert( Gia_ObjIsAnd(pObj) );
342 return pObj->
Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
349 assert( Gia_ManRegNum(
p) == 0 );
352 pNew->
pName = Abc_UtilStrsav(
p->pName );
353 pNew->
pSpec = Abc_UtilStrsav(
p->pSpec );
354 Gia_ManConst0(
p)->Value = 0;
358 pObj->
Value = Gia_ManAppendCi(pNew);
365 pObj->
Value = Gia_ManAppendCi(pNew);
368 pObj->
Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
370 Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
372 Gia_ManAppendCo( pNew, pObj->
Value );
399 printf(
"Detected %d FAs/HAs. Roots = %d. Leaves = %d. Nodes = %d. Adds = %d. ",
400 Vec_IntSize(vAdds)/6, Vec_IntSize(vLeaves), Vec_IntSize(vRoots), Vec_IntSize(vNodes), Vec_IntSize(vOrder) );
401 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
407 Vec_IntFree( vAdds );
408 Vec_IntFree( vLeaves );
409 Vec_IntFree( vRoots );
410 Vec_IntFree( vOrder );
411 Vec_IntFree( vNodes );
418 printf(
"On top of %d COs, created %d new adder outputs.\n", Gia_ManCoNum(pGia), Vec_IntSize(vAddCos) );
419 Vec_IntFree( vAddCos );
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
void Gia_PolyCollectRoots_rec(Vec_Int_t *vAdds, Vec_Wec_t *vMap, Vec_Bit_t *vMarks, int iBox, Vec_Int_t *vRoots)
ABC_NAMESPACE_IMPL_START void Gia_PolynCoreNonXors_rec(Gia_Man_t *pGia, Gia_Obj_t *pObj, Vec_Int_t *vXorPairs)
DECLARATIONS ///.
Vec_Int_t * Gia_PolynCoreOrder(Gia_Man_t *pGia, Vec_Int_t *vAdds, Vec_Int_t *vAddCos, Vec_Int_t **pvIns, Vec_Int_t **pvOuts)
ITERATORS ///.
void Gia_PolyCollectRoots(Vec_Int_t *vAdds, Vec_Wec_t *vMap, Vec_Bit_t *vMarks, int iBox, Vec_Int_t *vRoots)
Gia_Man_t * Gia_PolynCoreDupTree(Gia_Man_t *p, Vec_Int_t *vAddCos, Vec_Int_t *vLeaves, Vec_Int_t *vNodes, int fAddCones)
void Gia_PolynCoreCollect_rec(Gia_Man_t *pGia, int iObj, Vec_Int_t *vNodes, Vec_Bit_t *vVisited)
int Gia_PolynCoreDupTreePlus_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Vec_Wec_t * Gia_PolynComputeMap(Vec_Int_t *vAdds, int nObjs)
Vec_Int_t * Gia_PolynCoreCollect(Gia_Man_t *pGia, Vec_Int_t *vAdds, Vec_Int_t *vOrder)
Gia_Man_t * Gia_PolynCoreDetectTest(Gia_Man_t *pGia, int fAddExtra, int fAddCones, int fVerbose)
Vec_Int_t * Gia_PolynCoreOrder_int(Gia_Man_t *pGia, Vec_Int_t *vAdds, Vec_Wec_t *vMap, Vec_Int_t *vRoots, Vec_Int_t **pvIns)
Vec_Wec_t * Gia_PolynCoreOrderArray(Gia_Man_t *pGia, Vec_Int_t *vAdds, Vec_Int_t *vRootBoxes)
void Gia_PolynCorePrintCones(Gia_Man_t *pGia, Vec_Int_t *vLeaves, int fVerbose)
Gia_Man_t * Gia_PolynCoreDetectTest_int(Gia_Man_t *pGia, Vec_Int_t *vAddCos, int fAddCones, int fVerbose)
Vec_Int_t * Gia_PolynAddHaRoots(Gia_Man_t *pGia)
Vec_Bit_t * Acec_ManPoolGetPointed(Gia_Man_t *p, Vec_Int_t *vAdds)
Vec_Int_t * Ree_ManComputeCuts(Gia_Man_t *p, Vec_Int_t **pvXors, int fVerbose)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
int Gia_ManSuppSizeOne(Gia_Man_t *p, Gia_Obj_t *pObj)
int Gia_ManSuppSize(Gia_Man_t *p, int *pNodes, int nNodes)
#define Gia_ManForEachCoDriverId(p, DriverId, i)
#define Gia_ManForEachPi(p, pObj, i)
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
struct Gia_Obj_t_ Gia_Obj_t
void Gia_ManFillValue(Gia_Man_t *p)
struct Gia_Man_t_ Gia_Man_t
#define Gia_ManForEachObjVec(vVec, p, pObj, i)
int Gia_ObjRecognizeExor(Gia_Obj_t *pObj, Gia_Obj_t **ppFan0, Gia_Obj_t **ppFan1)
int Gia_ManConeSize(Gia_Man_t *p, int *pNodes, int nNodes)
#define Gia_ManForEachCo(p, pObj, i)
void Gia_ManSetPhase(Gia_Man_t *p)
#define Vec_BitForEachEntryStart(vVec, Entry, i, Start)
typedefABC_NAMESPACE_HEADER_START struct Vec_Bit_t_ Vec_Bit_t
INCLUDES ///.
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
#define Vec_IntForEachEntryReverse(vVec, pEntry, i)
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.