51 int fVerbose =
p->pPars->fVeryVerbose;
56 int i, Config, iClass;
58 vClasses = Vec_WecStart( 600 );
64 printf(
"Skipping cell %s with %d inputs and %d outputs\n", pRepr->
pName, pRepr->
n_inputs, pRepr->
n_outputs );
67 Truth = *Vec_WrdArray( &SC_CellPin(pRepr, pRepr->
n_inputs)->vFunc );
72 printf(
"Skipping cell %s with non-DSD function\n", pRepr->
pName );
75 iClass = Config >> 17;
76 Config = (pRepr->
Id << 17) | (Config & 0x1FFFF);
78 vClass = Vec_WecEntry( vClasses, iClass );
79 Vec_IntPush( vClass, Config );
83 printf(
"Gate %5d %-30s : ", pRepr->
Id, pRepr->
pName );
84 printf(
"Class %3d ", iClass );
85 printf(
"Area %10.3f ", pRepr->
area );
111 vNpnGatesMio = Vec_PtrStart( Vec_WecSize(vNpnConfigs) );
114 if ( Vec_IntSize(vClass) == 0 )
116 Config = Vec_IntEntry(vClass, 0);
117 pCell = SC_LibCell( pScl, (Config >> 17) );
119 if ( pMioGate == NULL )
121 Vec_PtrFree( vNpnGatesMio );
124 assert( pMioGate != NULL );
125 Vec_PtrWriteEntry( vNpnGatesMio, iClass, pMioGate );
145 vNodes = Vec_IntAlloc( 1000 );
147 if ( Mig_ObjIsNode(pObj) && Mpm_ObjMapRef(
p, pObj) )
148 Vec_IntPush( vNodes, Mig_ObjId(pObj) );
154 int iObjId = Vec_IntEntry( vCopy, iMigLit );
156 return Abc_NtkObj( pNtk, iObjId );
157 iObjId = Vec_IntEntry( vCopy, Abc_LitNot(iMigLit) );
160 Vec_IntWriteEntry( vCopy, iMigLit, Abc_ObjId(pObj) );
171 int i, k, iNode, iMigLit, fCompl, Config;
175 if ( vNpnGatesMio == NULL )
177 printf(
"Genlib library does not match SCL library.\n" );
182 vCopy = Vec_IntStartFull( 2 * Mig_ManObjNum(
p->pMig) );
195 pObj = Abc_NtkCreatePi(pNtk);
196 Vec_IntWriteEntry( vCopy, Abc_Var2Lit( Mig_ObjId(pNode), 0 ), Abc_ObjId(pObj) );
202 if ( Mig_ObjFaninLit(pNode, 0) == 0 )
205 Vec_IntWriteEntry( vCopy, Abc_Var2Lit( 0, 0 ), Abc_ObjId(pObj) );
209 if ( Mig_ObjFaninLit(pNode, 0) == 1 )
212 Vec_IntWriteEntry( vCopy, Abc_Var2Lit( 0, 1 ), Abc_ObjId(pObj) );
219 pCutBest = Mpm_ObjCutBestP(
p, Mig_ManObj(
p->pMig, iNode) );
220 vClass = Vec_WecEntry(
p->vNpnConfigs, Abc_Lit2Var(pCutBest->
iFunc) );
221 Config = Vec_IntEntry( vClass, 0 );
222 pObj = Abc_NtkCreateNode( pNtk );
223 pObj->
pData = Vec_PtrEntry( vNpnGatesMio, Abc_Lit2Var(pCutBest->
iFunc) );
225 fCompl = pCutBest->
fCompl ^ Abc_LitIsCompl(pCutBest->
iFunc) ^ ((Config >> 16) & 1);
227 for ( k = 0; k < (int)pCutBest->
nLeaves; k++ )
229 assert( (Config >> 6) < 720 );
230 iMigLit = pCutBest->
pLeaves[ (int)(
p->Perm6[Config >> 6][k]) ];
231 pFanin =
Mpm_ManGetAbcNode( pNtk, vCopy, Abc_LitNotCond(iMigLit, (Config >> k) & 1) );
234 Vec_IntWriteEntry( vCopy, Abc_Var2Lit(iNode, fCompl), Abc_ObjId(pObj) );
240 pObj = Abc_NtkCreatePo(pNtk);
247 Vec_PtrFree( vNpnGatesMio );
248 Vec_IntFree( vNodes );
249 Vec_IntFree( vCopy );
270 if (
p->pPars->fVerbose )
275 if (
p->pPars->fVerbose )
struct Abc_Obj_t_ Abc_Obj_t
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst1(Abc_Ntk_t *pNtk)
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst0(Abc_Ntk_t *pNtk)
struct Abc_Ntk_t_ Abc_Ntk_t
ABC_DLL void Abc_NtkAddDummyPoNames(Abc_Ntk_t *pNtk)
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeInv(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
ABC_DLL void Abc_NtkAddDummyPiNames(Abc_Ntk_t *pNtk)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
void Gia_ManStop(Gia_Man_t *p)
Gia_Man_t * Gia_ManDupMuxes(Gia_Man_t *p, int Limit)
struct Gia_Man_t_ Gia_Man_t
void Extra_PrintBinary(FILE *pFile, unsigned Sign[], int nBits)
unsigned __int64 word
DECLARATIONS ///.
void Kit_DsdPrintFromTruth(unsigned *pTruth, int nVars)
struct Mio_LibraryStruct_t_ Mio_Library_t
Mio_Gate_t * Mio_LibraryReadGateByName(Mio_Library_t *pLib, char *pName, char *pOutName)
struct Mio_GateStruct_t_ Mio_Gate_t
Mig_Man_t * Mig_ManCreate(void *pGia)
FUNCTION DECLARATIONS ///.
int Mpm_CutCheckDsd6(Mpm_Man_t *p, word t)
Vec_Int_t * Mpm_ManFindMappedNodes(Mpm_Man_t *p)
ABC_NAMESPACE_IMPL_START Vec_Wec_t * Mpm_ManFindDsdMatches(Mpm_Man_t *p, void *pScl)
DECLARATIONS ///.
Abc_Obj_t * Mpm_ManGetAbcNode(Abc_Ntk_t *pNtk, Vec_Int_t *vCopy, int iMigLit)
Vec_Ptr_t * Mpm_ManFindCells(Mio_Library_t *pMio, SC_Lib *pScl, Vec_Wec_t *vNpnConfigs)
Abc_Ntk_t * Mpm_ManPerformCellMapping(Mig_Man_t *pMig, Mpm_Par_t *pPars, Mio_Library_t *pMio)
Abc_Ntk_t * Mpm_ManDeriveMappedAbcNtk(Mpm_Man_t *p, Mio_Library_t *pMio)
Abc_Ntk_t * Mpm_ManCellMapping(Gia_Man_t *pGia, Mpm_Par_t *pPars, void *pMio)
void Mpm_ManPrintStatsInit(Mpm_Man_t *p)
struct Mpm_Man_t_ Mpm_Man_t
#define MPM_CUT_MAX
INCLUDES ///.
Mpm_Man_t * Mpm_ManStart(Mig_Man_t *pMig, Mpm_Par_t *pPars)
DECLARATIONS ///.
void Mpm_ManPrintStats(Mpm_Man_t *p)
struct Mpm_Cut_t_ Mpm_Cut_t
BASIC TYPES ///.
void Mpm_ManPerform(Mpm_Man_t *p)
void Mpm_ManPrepare(Mpm_Man_t *p)
void Mpm_ManStop(Mpm_Man_t *p)
void Mig_ManStop(Mig_Man_t *p)
struct Mig_Obj_t_ Mig_Obj_t
#define Mig_ManForEachObj(p, pObj)
MACRO DEFINITIONS ///.
#define Mig_ManForEachCi(p, pObj, i)
struct Mig_Man_t_ Mig_Man_t
#define Mig_ManForEachCo(p, pObj, i)
#define MPM_VAR_MAX
INCLUDES ///.
struct Mpm_Par_t_ Mpm_Par_t
#define SC_LibForEachCellClass(p, pCell, i)
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.