51 int i, k, j, iNod, iNod0, iNod1, iNod2;
52 if (
p->vRules3 == NULL )
53 p->vRules3 = Vec_IntAlloc( 100 );
54 vRes = Vec_IntAlloc( 10 );
62 Vec_IntPush( vRes, Abc_Var2Lit(iNod, 0) );
80 int i, k, iNod, iNod0, iNod1;
87 Vec_IntPushUnique( vNods, Abc_Var2Lit(iNod, 0) );
107 if ( Vec_IntSize(vNods) != 1 || Vec_IntEntry(vNods,0) != 0 )
126 Vec_Int_t * vRes, * vNods, * vNods0, * vNods1;
128 if ( Vec_PtrSize(vVecNods) == 1 )
129 return Vec_IntDup( (
Vec_Int_t *)Vec_PtrEntry(vVecNods, 0) );
130 vRes = Vec_IntAlloc( 10 );
131 vVecNods0 = Vec_PtrAlloc( Vec_PtrSize(vVecNods) );
132 vVecNods1 = Vec_PtrAlloc( Vec_PtrSize(vVecNods) );
135 for ( i = Vec_PtrSize(vVecNods)-1; i > 0; i-- )
137 Vec_PtrClear( vVecNods0 );
138 Vec_PtrClear( vVecNods1 );
140 Vec_PtrPush( vVecNods0, vNods );
142 Vec_PtrPush( vVecNods1, vNods );
146 Vec_IntFree( vNods0 );
147 Vec_IntFree( vNods1 );
152 int Limit = (1 << Vec_PtrSize(vVecNods))-2;
153 for ( i = 1; i < Limit; i++ )
155 Vec_PtrClear( vVecNods0 );
156 Vec_PtrClear( vVecNods1 );
160 Vec_PtrPush( vVecNods1, vNods );
162 Vec_PtrPush( vVecNods0, vNods );
164 assert( Vec_PtrSize(vVecNods0) > 0 );
165 assert( Vec_PtrSize(vVecNods1) > 0 );
166 assert( Vec_PtrSize(vVecNods0) < Vec_PtrSize(vVecNods) );
167 assert( Vec_PtrSize(vVecNods1) < Vec_PtrSize(vVecNods) );
171 Vec_IntFree( vNods0 );
172 Vec_IntFree( vNods1 );
175 Vec_PtrFree( vVecNods0 );
176 Vec_PtrFree( vVecNods1 );
199 assert( !Abc_LitIsCompl(iLit) );
200 pObj = Kit_DsdNtkObj(
p, Abc_Lit2Var(iLit) );
202 return Vec_IntStartNatural( 1 );
204 vVecNods = Vec_PtrAlloc( pObj->
nFans );
208 if ( Abc_LitIsCompl(iFanin) )
212 Vec_IntWriteEntry( vNodsFanin, k, Abc_LitNot(iNod) );
214 Vec_PtrPush( vVecNods, vNodsFanin );
223 assert( Kit_DsdObjTruth(pObj)[0] == 0xCACACACA );
229 Vec_IntFree( vNodsFanin );
230 Vec_PtrFree( vVecNods );
241 if ( Abc_LitIsCompl(
p->Root) )
244 Vec_IntWriteEntry( vNods, i, Abc_LitNot(iNod) );
264 assert( !Abc_LitIsCompl(iLit0) );
265 assert( !Abc_LitIsCompl(iLit1) );
266 pObj0 = Kit_DsdNtkObj(
p, Abc_Lit2Var(iLit0) );
267 pObj1 = Kit_DsdNtkObj(
p, Abc_Lit2Var(iLit1) );
268 if ( pObj0 == NULL && pObj1 == NULL )
270 if ( pObj0 == NULL || pObj1 == NULL )
279 for ( i = 0; i < (int)pObj0->
nFans; i++ )
281 if ( Abc_LitIsCompl(pObj0->
pFans[i]) != Abc_LitIsCompl(pObj1->
pFans[i]) )
292 assert( !Abc_LitIsCompl(iLit) );
293 pObj = Kit_DsdNtkObj(
p, Abc_Lit2Var(iLit) );
301 for ( i = 0; i < (int)pObj->
nFans; i++ )
302 for ( k = i+1; k < (int)pObj->
nFans; k++ )
304 if ( Abc_LitIsCompl(pObj->
pFans[i]) != Abc_LitIsCompl(pObj->
pFans[k]) &&
305 Kit_DsdNtkObj(
p, Abc_Lit2Var(pObj->
pFans[i])) == NULL &&
306 Kit_DsdNtkObj(
p, Abc_Lit2Var(pObj->
pFans[k])) == NULL )
308 if ( *pvSyms == NULL )
309 *pvSyms = Vec_IntAlloc( 16 );
310 Vec_IntPush( *pvSyms, (Abc_Lit2Var(pObj->
pFans[i]) << 8) | Abc_Lit2Var(pObj->
pFans[k]) );
337 int iNod, i, k, Entry;
341 if ( pGate->
nPins == 2 && (pGate->
pFunc[0] == 0x66666666 || pGate->
pFunc[0] == ~0x66666666) )
344 pLib->fHasMux = pGate->
fMux = 1;
356printf(
"\nProcessing library gate %4d: %10s ", pGate->
Id, pGate->
pName );
365 pNod = Amap_LibNod( pLib, Abc_Lit2Var(iNod) );
370 pSet->
fInv = Abc_LitIsCompl(iNod);
376 printf(
"Cound not prepare gate \"%s\": ", pGate->
pName );
390 int iThis = Entry & 0xff;
391 int iThat = Entry >> 8;
397 pSet2->
fInv = Abc_LitIsCompl(iNod);
401 pSet2->
Ins[iThis] = Abc_Var2Lit( Abc_Lit2Var(pSet->
Ins[iThat]), Abc_LitIsCompl(pSet->
Ins[iThis]) );
402 pSet2->
Ins[iThat] = Abc_Var2Lit( Abc_Lit2Var(pSet->
Ins[iThis]), Abc_LitIsCompl(pSet->
Ins[iThat]) );
409 Vec_IntFree( vNods );
412 Vec_IntFreeP( &vSyms );
431 pLib->fVerbose = fVeryVerbose;
432 pLib->vRules = Vec_PtrAlloc( 100 );
433 pLib->vRulesX = Vec_PtrAlloc( 100 );
434 pLib->vRules3 = Vec_IntAlloc( 100 );
438 if ( pGate->
nPins < 2 )
440 if ( pGate->
pFunc == NULL )
442 printf(
"Amap_LibCreateRules(): Skipping gate %s (%s).\n", pGate->
pName, pGate->
pForm );
448 assert( Vec_PtrSize(pLib->vRules) == 2*pLib->nNodes );
449 assert( Vec_PtrSize(pLib->vRulesX) == 2*pLib->nNodes );
452 Vec_VecFree( (
Vec_Vec_t *)pLib->vRules ); pLib->vRules = NULL;
453 Vec_VecFree( (
Vec_Vec_t *)pLib->vRulesX ); pLib->vRulesX = NULL;
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
char * Aig_MmFlexEntryFetch(Aig_MmFlex_t *p, int nBytes)
struct Amap_Set_t_ Amap_Set_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)
int Amap_LibCreateVar(Amap_Lib_t *p)
struct Amap_Gat_t_ Amap_Gat_t
int ** Amap_LibLookupTableAlloc(Vec_Ptr_t *vVec, int fVerbose)
int Amap_LibCreateNode(Amap_Lib_t *p, int iFan0, int iFan1, int fXor)
struct Amap_Nod_t_ Amap_Nod_t
int Amap_LibFindMux(Amap_Lib_t *p, int iFan0, int iFan1, int iFan2)
void Amap_LibCreateRules(Amap_Lib_t *pLib, int fVeryVerbose)
Vec_Int_t * Amap_CreateRulesVector_rec(Amap_Lib_t *p, Vec_Ptr_t *vVecNods, int fXor)
Vec_Int_t * Amap_CreateRulesFromDsd(Amap_Lib_t *pLib, Kit_DsdNtk_t *p)
void Amap_CreateCheckAsym_rec(Kit_DsdNtk_t *p, int iLit, Vec_Int_t **pvSyms)
int Amap_CreateCheckEqual_rec(Kit_DsdNtk_t *p, int iLit0, int iLit1)
Vec_Int_t * Amap_CreateRulesFromDsd_rec(Amap_Lib_t *pLib, Kit_DsdNtk_t *p, int iLit)
int Amap_CreateCheckAllZero(Vec_Ptr_t *vVecNods)
void Amap_CreateRulesForGate(Amap_Lib_t *pLib, Amap_Gat_t *pGate)
void Amap_CreateRulesTwo(Amap_Lib_t *p, Vec_Int_t *vNods, Vec_Int_t *vNods0, Vec_Int_t *vNods1, int fXor)
void Amap_CreateCheckAsym(Kit_DsdNtk_t *p, Vec_Int_t **pvSyms)
Vec_Int_t * Amap_CreateRulesPrime(Amap_Lib_t *p, Vec_Int_t *vNods0, Vec_Int_t *vNods1, Vec_Int_t *vNods2)
FUNCTION DEFINITIONS ///.
ABC_NAMESPACE_IMPL_START int Amap_LibDeriveGatePerm(Amap_Lib_t *pLib, Amap_Gat_t *pGate, Kit_DsdNtk_t *pNtk, Amap_Nod_t *pNod, char *pArray)
DECLARATIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Amap_Lib_t_ Amap_Lib_t
INCLUDES ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
int Kit_DsdNonDsdSizeMax(Kit_DsdNtk_t *pNtk)
void Kit_DsdVerify(Kit_DsdNtk_t *pNtk, unsigned *pTruth, int nVars)
void Kit_DsdPrint(FILE *pFile, Kit_DsdNtk_t *pNtk)
void Kit_DsdNtkFree(Kit_DsdNtk_t *pNtk)
struct Kit_DsdObj_t_ Kit_DsdObj_t
#define Kit_DsdObjForEachFanin(pNtk, pObj, iLit, i)
struct Kit_DsdNtk_t_ Kit_DsdNtk_t
Kit_DsdNtk_t * Kit_DsdDecomposeMux(unsigned *pTruth, int nVars, int nDecMux)
Kit_DsdNtk_t * Kit_DsdExpand(Kit_DsdNtk_t *p)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
#define Vec_PtrForEachEntryReverse(Type, vVec, pEntry, i)
#define Vec_PtrForEachEntryStop(Type, vVec, pEntry, i, Stop)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.