Commit eb5c12a9 by Alan Mishchenko

New technology mapper.

parent bbbfe0e8
...@@ -79,8 +79,6 @@ Gia_Man_t * Mpm_ManPerformLutMapping( Mig_Man_t * pMig, Mpm_Par_t * pPars ) ...@@ -79,8 +79,6 @@ Gia_Man_t * Mpm_ManPerformLutMapping( Mig_Man_t * pMig, Mpm_Par_t * pPars )
p = Mpm_ManStart( pMig, pPars ); p = Mpm_ManStart( pMig, pPars );
if ( p->pPars->fVerbose ) if ( p->pPars->fVerbose )
Mpm_ManPrintStatsInit( p ); Mpm_ManPrintStatsInit( p );
// if ( p->pPars->fMap4Gates )
// p->vGateNpnConfig = Mpm_ManFindDsdMatches( p, p->pPars->pScl, &p->vNpnCosts );
Mpm_ManPrepare( p ); Mpm_ManPrepare( p );
Mpm_ManPerform( p ); Mpm_ManPerform( p );
if ( p->pPars->fVerbose ) if ( p->pPars->fVerbose )
......
...@@ -986,7 +986,7 @@ Kit_DsdPrintFromTruth( (unsigned *)&t, 6 ); printf( "\n" ); ...@@ -986,7 +986,7 @@ Kit_DsdPrintFromTruth( (unsigned *)&t, 6 ); printf( "\n" );
// check if the gate exists // check if the gate exists
if ( p->pPars->fMap4Gates ) if ( p->pPars->fMap4Gates )
{ {
if ( Vec_IntEntry(p->vGateNpnConfig, iClass) < 0 ) if ( Vec_IntEntry(p->vNpnConfigs, iClass) < 0 )
{ {
p->nNoMatch++; p->nNoMatch++;
return 0; return 0;
......
...@@ -100,19 +100,24 @@ Vec_Int_t * Mpm_ManFindDsdMatches( Mpm_Man_t * p, void * pScl, Vec_Int_t ** pvNp ...@@ -100,19 +100,24 @@ Vec_Int_t * Mpm_ManFindDsdMatches( Mpm_Man_t * p, void * pScl, Vec_Int_t ** pvNp
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
Vec_Ptr_t * Mpm_ManFindCells( Mio_Library_t * pMio, SC_Lib * pScl, Vec_Int_t * vNpnGates ) Vec_Ptr_t * Mpm_ManFindCells( Mio_Library_t * pMio, SC_Lib * pScl, Vec_Int_t * vNpnConfigs )
{ {
Vec_Ptr_t * vNpnGatesMio; Vec_Ptr_t * vNpnGatesMio;
Mio_Gate_t * pMioGate; Mio_Gate_t * pMioGate;
SC_Cell * pCell; SC_Cell * pCell;
int iCell, iClass; int Config, iClass;
vNpnGatesMio = Vec_PtrStart( Vec_IntSize(vNpnGates) ); vNpnGatesMio = Vec_PtrStart( Vec_IntSize(vNpnConfigs) );
Vec_IntForEachEntry( vNpnGates, iCell, iClass ) Vec_IntForEachEntry( vNpnConfigs, Config, iClass )
{ {
if ( iCell == -1 ) if ( Config == -1 )
continue; continue;
pCell = SC_LibCell( pScl, (iCell >> 17) ); pCell = SC_LibCell( pScl, (Config >> 17) );
pMioGate = Mio_LibraryReadGateByName( pMio, pCell->pName, NULL ); pMioGate = Mio_LibraryReadGateByName( pMio, pCell->pName, NULL );
if ( pMioGate == NULL )
{
Vec_PtrFree( vNpnGatesMio );
return NULL;
}
assert( pMioGate != NULL ); assert( pMioGate != NULL );
Vec_PtrWriteEntry( vNpnGatesMio, iClass, pMioGate ); Vec_PtrWriteEntry( vNpnGatesMio, iClass, pMioGate );
} }
...@@ -160,10 +165,15 @@ Abc_Ntk_t * Mpm_ManDeriveMappedAbcNtk( Mpm_Man_t * p, Mio_Library_t * pMio ) ...@@ -160,10 +165,15 @@ Abc_Ntk_t * Mpm_ManDeriveMappedAbcNtk( Mpm_Man_t * p, Mio_Library_t * pMio )
Abc_Obj_t * pObj, * pFanin; Abc_Obj_t * pObj, * pFanin;
Mig_Obj_t * pNode; Mig_Obj_t * pNode;
Mpm_Cut_t * pCutBest; Mpm_Cut_t * pCutBest;
int i, k, iNode, iMigLit, fCompl; int i, k, iNode, iMigLit, fCompl, Config;
// find mapping of SCL cells into MIO cells // find mapping of SCL cells into MIO cells
vNpnGatesMio = Mpm_ManFindCells( pMio, (SC_Lib *)p->pPars->pScl, p->vGateNpnConfig ); vNpnGatesMio = Mpm_ManFindCells( pMio, (SC_Lib *)p->pPars->pScl, p->vNpnConfigs );
if ( vNpnGatesMio == NULL )
{
printf( "Genlib library does not match SCL library.\n" );
return NULL;
}
// create mapping for each phase of each node // create mapping for each phase of each node
vCopy = Vec_IntStartFull( 2 * Mig_ManObjNum(p->pMig) ); vCopy = Vec_IntStartFull( 2 * Mig_ManObjNum(p->pMig) );
...@@ -185,25 +195,39 @@ Abc_Ntk_t * Mpm_ManDeriveMappedAbcNtk( Mpm_Man_t * p, Mio_Library_t * pMio ) ...@@ -185,25 +195,39 @@ Abc_Ntk_t * Mpm_ManDeriveMappedAbcNtk( Mpm_Man_t * p, Mio_Library_t * pMio )
Abc_NtkAddDummyPiNames( pNtk ); Abc_NtkAddDummyPiNames( pNtk );
// create constant nodes // create constant nodes
pObj = Abc_NtkCreateNodeConst0(pNtk); Mig_ManForEachCo( p->pMig, pNode, i )
Vec_IntWriteEntry( vCopy, Abc_Var2Lit( 0, 0 ), Abc_ObjId(pObj) ); if ( Mig_ObjFaninLit(pNode, 0) == 0 )
pObj = Abc_NtkCreateNodeConst1(pNtk); {
Vec_IntWriteEntry( vCopy, Abc_Var2Lit( 0, 1 ), Abc_ObjId(pObj) ); pObj = Abc_NtkCreateNodeConst0(pNtk);
Vec_IntWriteEntry( vCopy, Abc_Var2Lit( 0, 0 ), Abc_ObjId(pObj) );
break;
}
Mig_ManForEachCo( p->pMig, pNode, i )
if ( Mig_ObjFaninLit(pNode, 0) == 1 )
{
pObj = Abc_NtkCreateNodeConst1(pNtk);
Vec_IntWriteEntry( vCopy, Abc_Var2Lit( 0, 1 ), Abc_ObjId(pObj) );
break;
}
// create internal nodes // create internal nodes
Vec_IntForEachEntry( vNodes, iNode, i ) Vec_IntForEachEntry( vNodes, iNode, i )
{ {
pNode = Mig_ManObj( p->pMig, iNode ); pCutBest = Mpm_ObjCutBestP( p, Mig_ManObj(p->pMig, iNode) );
pCutBest = Mpm_ObjCutBestP( p, pNode ); Config = Vec_IntEntry( p->vNpnConfigs, Abc_Lit2Var(pCutBest->iFunc) );
pObj = Abc_NtkCreateNode( pNtk ); pObj = Abc_NtkCreateNode( pNtk );
pObj->pData = Vec_PtrEntry( vNpnGatesMio, Abc_Lit2Var(pCutBest->iFunc) ); pObj->pData = Vec_PtrEntry( vNpnGatesMio, Abc_Lit2Var(pCutBest->iFunc) );
fCompl = Abc_LitIsCompl(pCutBest->iFunc); assert( pObj->pData != NULL );
Mpm_CutForEachLeafLit( pCutBest, iMigLit, k ) fCompl = Abc_LitIsCompl(pCutBest->iFunc) ^ ((Config >> 16) & 1);
Config &= 0xFFFF;
for ( k = 0; k < (int)pCutBest->nLeaves; k++ )
{ {
pFanin = Mpm_ManGetAbcNode( pNtk, vCopy, iMigLit ); assert( (Config >> 6) < 720 );
iMigLit = pCutBest->pLeaves[ (int)(p->Perm6[Config >> 6][k]) ];
pFanin = Mpm_ManGetAbcNode( pNtk, vCopy, Abc_LitNotCond(iMigLit, (Config >> k) & 1) );
Abc_ObjAddFanin( pObj, pFanin ); Abc_ObjAddFanin( pObj, pFanin );
} }
Vec_IntWriteEntry( vCopy, Abc_Var2Lit( iNode, fCompl ), Abc_ObjId(pObj) ); Vec_IntWriteEntry( vCopy, Abc_Var2Lit(iNode, fCompl), Abc_ObjId(pObj) );
} }
// create primary outputs // create primary outputs
...@@ -241,7 +265,7 @@ Abc_Ntk_t * Mpm_ManPerformCellMapping( Mig_Man_t * pMig, Mpm_Par_t * pPars, Mio_ ...@@ -241,7 +265,7 @@ Abc_Ntk_t * Mpm_ManPerformCellMapping( Mig_Man_t * pMig, Mpm_Par_t * pPars, Mio_
p = Mpm_ManStart( pMig, pPars ); p = Mpm_ManStart( pMig, pPars );
if ( p->pPars->fVerbose ) if ( p->pPars->fVerbose )
Mpm_ManPrintStatsInit( p ); Mpm_ManPrintStatsInit( p );
p->vGateNpnConfig = Mpm_ManFindDsdMatches( p, p->pPars->pScl, &p->vNpnCosts ); p->vNpnConfigs = Mpm_ManFindDsdMatches( p, p->pPars->pScl, &p->vNpnCosts );
Mpm_ManPrepare( p ); Mpm_ManPrepare( p );
Mpm_ManPerform( p ); Mpm_ManPerform( p );
if ( p->pPars->fVerbose ) if ( p->pPars->fVerbose )
......
...@@ -140,7 +140,7 @@ struct Mpm_Man_t_ ...@@ -140,7 +140,7 @@ struct Mpm_Man_t_
Vec_Int_t * vMap2Perm; // maps number into its permutation Vec_Int_t * vMap2Perm; // maps number into its permutation
unsigned uPermMask[3]; unsigned uPermMask[3];
unsigned uComplMask[3]; unsigned uComplMask[3];
Vec_Int_t * vGateNpnConfig; Vec_Int_t * vNpnConfigs;
Vec_Int_t * vNpnCosts; // area cost of each NPN class Vec_Int_t * vNpnCosts; // area cost of each NPN class
// mapping attributes // mapping attributes
Vec_Int_t vCutBests; // cut best Vec_Int_t vCutBests; // cut best
......
...@@ -139,7 +139,7 @@ void Mpm_ManStop( Mpm_Man_t * p ) ...@@ -139,7 +139,7 @@ void Mpm_ManStop( Mpm_Man_t * p )
Hsh_IntManStop( p->pHash ); Hsh_IntManStop( p->pHash );
} }
Vec_IntFreeP( &p->vNpnCosts ); Vec_IntFreeP( &p->vNpnCosts );
Vec_IntFreeP( &p->vGateNpnConfig ); Vec_IntFreeP( &p->vNpnConfigs );
Vec_PtrFree( p->vTemp ); Vec_PtrFree( p->vTemp );
Mmr_StepStop( p->pManCuts ); Mmr_StepStop( p->pManCuts );
ABC_FREE( p->vObjPresUsed.pArray ); ABC_FREE( p->vObjPresUsed.pArray );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment