45static inline int Vec_IntCheckWithMask(
Vec_Int_t *
p,
int Entry )
48 for ( i = 0; i <
p->nSize; i++ )
49 if ( (0xffff &
p->pArray[i]) == (0xffff & Entry) )
50 return p->pArray[i] >> 16;
65static inline void Vec_IntPushOrderWithMask(
Vec_Int_t *
p,
int Entry )
68 if (
p->nSize ==
p->nCap )
69 Vec_IntGrow(
p, 2 *
p->nCap );
71 for ( i =
p->nSize-2; i >= 0; i-- )
72 if ( (0xffff &
p->pArray[i]) > (0xffff & Entry) )
73 p->pArray[i+1] =
p->pArray[i];
76 p->pArray[i+1] = Entry;
93 return Vec_IntCheckWithMask( (
Vec_Int_t *)Vec_PtrEntry(pLib->vRulesX, iFan0), iFan1 );
95 return Vec_IntCheckWithMask( (
Vec_Int_t *)Vec_PtrEntry(pLib->vRules, iFan0), iFan1 );
112 for ( x = 0; x < Vec_IntSize(
p->vRules3); x += 4 )
114 if ( Vec_IntEntry(
p->vRules3, x) == iFan0 &&
115 Vec_IntEntry(
p->vRules3, x+1) == iFan1 &&
116 Vec_IntEntry(
p->vRules3, x+2) == iFan2 )
118 return Vec_IntEntry(
p->vRules3, x+3);
138 if (
p->nNodes ==
p->nNodesAlloc )
143 pNode = Amap_LibNod(
p,
p->nNodes );
145 pNode->
Id =
p->nNodes++;
146 Vec_PtrPush(
p->vRules, Vec_IntAlloc(8) );
147 Vec_PtrPush(
p->vRules, Vec_IntAlloc(8) );
148 Vec_PtrPush(
p->vRulesX, Vec_IntAlloc(8) );
149 Vec_PtrPush(
p->vRulesX, Vec_IntAlloc(8) );
169 p->nNodesAlloc = 256;
174 p->pNodes->nSuppSize = 1;
201 pNode->
nSuppSize =
p->pNodes[Abc_Lit2Var(iFan0)].nSuppSize +
p->pNodes[Abc_Lit2Var(iFan1)].nSuppSize;
202 pNode->
iFan0 = iFan0;
203 pNode->
iFan1 = iFan1;
205printf(
"Creating node %5d %c : iFan0 = %5d%c iFan1 = %5d%c\n",
206pNode->
Id, (fXor?
'x':
' '),
207Abc_Lit2Var(iFan0), (Abc_LitIsCompl(iFan0)?
'-':
'+'),
208Abc_Lit2Var(iFan1), (Abc_LitIsCompl(iFan1)?
'-':
'+') );
212 if ( iFan0 == iFan1 )
213 Vec_IntPushOrderWithMask( (
Vec_Int_t *)Vec_PtrEntry(
p->vRulesX, iFan0), (pNode->
Id << 16) | iFan1 );
216 Vec_IntPushOrderWithMask( (
Vec_Int_t *)Vec_PtrEntry(
p->vRulesX, iFan0), (pNode->
Id << 16) | iFan1 );
217 Vec_IntPushOrderWithMask( (
Vec_Int_t *)Vec_PtrEntry(
p->vRulesX, iFan1), (pNode->
Id << 16) | iFan0 );
222 if ( iFan0 == iFan1 )
223 Vec_IntPushOrderWithMask( (
Vec_Int_t *)Vec_PtrEntry(
p->vRules, iFan0), (pNode->
Id << 16) | iFan1 );
226 Vec_IntPushOrderWithMask( (
Vec_Int_t *)Vec_PtrEntry(
p->vRules, iFan0), (pNode->
Id << 16) | iFan1 );
227 Vec_IntPushOrderWithMask( (
Vec_Int_t *)Vec_PtrEntry(
p->vRules, iFan1), (pNode->
Id << 16) | iFan0 );
249 pNode->
nSuppSize =
p->pNodes[Abc_Lit2Var(iFan0)].nSuppSize +
p->pNodes[Abc_Lit2Var(iFan1)].nSuppSize +
p->pNodes[Abc_Lit2Var(iFan2)].nSuppSize;
250 pNode->
iFan0 = iFan0;
251 pNode->
iFan1 = iFan1;
252 pNode->
iFan2 = iFan2;
254printf(
"Creating node %5d %c : iFan0 = %5d%c iFan1 = %5d%c iFan2 = %5d%c\n",
256Abc_Lit2Var(iFan0), (Abc_LitIsCompl(iFan0)?
'-':
'+'),
257Abc_Lit2Var(iFan1), (Abc_LitIsCompl(iFan1)?
'-':
'+'),
258Abc_Lit2Var(iFan2), (Abc_LitIsCompl(iFan2)?
'-':
'+') );
260 Vec_IntPush(
p->vRules3, iFan0 );
261 Vec_IntPush(
p->vRules3, iFan1 );
262 Vec_IntPush(
p->vRules3, iFan2 );
263 Vec_IntPush(
p->vRules3, pNode->
Id );
282 int i, k,
nTotal, nSize, nEntries, Value;
284 nEntries = nSize = Vec_PtrSize( vVec );
286 nEntries += Vec_IntSize(vOne);
287 pRes = (
int **)
ABC_ALLOC(
char, nSize *
sizeof(
void *) + nEntries *
sizeof(
int) );
288 pRes[0] = (
int *)((
char *)pRes + nSize *
sizeof(
void *));
292 pRes[i] = pRes[0] +
nTotal;
293 nTotal += Vec_IntSize(vOne) + 1;
295 printf(
"%d : ", i );
300 printf(
"%d(%d) ", Value&0xffff, Value>>16 );
#define ABC_ALLOC(type, num)
#define ABC_REALLOC(type, obj, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
struct Amap_Nod_t_ Amap_Nod_t
int Amap_LibCreateMux(Amap_Lib_t *p, int iFan0, int iFan1, int iFan2)
int Amap_LibFindNode(Amap_Lib_t *pLib, int iFan0, int iFan1, int fXor)
Amap_Nod_t * Amap_LibCreateObj(Amap_Lib_t *p)
int Amap_LibCreateVar(Amap_Lib_t *p)
int ** Amap_LibLookupTableAlloc(Vec_Ptr_t *vVec, int fVerbose)
int Amap_LibCreateNode(Amap_Lib_t *p, int iFan0, int iFan1, int fXor)
int Amap_LibFindMux(Amap_Lib_t *p, int iFan0, int iFan1, int iFan2)
typedefABC_NAMESPACE_HEADER_START struct Amap_Lib_t_ Amap_Lib_t
INCLUDES ///.
int nTotal
DECLARATIONS ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.