mirror of https://github.com/YosysHQ/abc.git
New technology mapper.
This commit is contained in:
parent
a9afe7e8b7
commit
1bdb3773f9
|
|
@ -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->vNpnConfigs, iClass) < 0 )
|
if ( Vec_IntSize(Vec_WecEntry(p->vNpnConfigs, iClass)) == 0 )
|
||||||
{
|
{
|
||||||
p->nNoMatch++;
|
p->nNoMatch++;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -45,16 +45,16 @@ ABC_NAMESPACE_IMPL_START
|
||||||
SeeAlso []
|
SeeAlso []
|
||||||
|
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
Vec_Int_t * Mpm_ManFindDsdMatches( Mpm_Man_t * p, void * pScl, Vec_Int_t ** pvNpnCosts )
|
Vec_Wec_t * Mpm_ManFindDsdMatches( Mpm_Man_t * p, void * pScl )
|
||||||
{
|
{
|
||||||
int fVerbose = p->pPars->fVeryVerbose;
|
int fVerbose = p->pPars->fVeryVerbose;
|
||||||
SC_Lib * pLib = (SC_Lib *)pScl;
|
SC_Lib * pLib = (SC_Lib *)pScl;
|
||||||
Vec_Int_t * vClasses;
|
Vec_Wec_t * vClasses;
|
||||||
|
Vec_Int_t * vClass;
|
||||||
SC_Cell * pRepr;
|
SC_Cell * pRepr;
|
||||||
int i, Config, iClass;
|
int i, Config, iClass;
|
||||||
word Truth;
|
word Truth;
|
||||||
vClasses = Vec_IntStartFull( 600 );
|
vClasses = Vec_WecStart( 600 );
|
||||||
*pvNpnCosts = Vec_IntStartFull( 600 );
|
|
||||||
SC_LibForEachCellClass( pLib, pRepr, i )
|
SC_LibForEachCellClass( pLib, pRepr, i )
|
||||||
{
|
{
|
||||||
if ( pRepr->n_inputs > 6 || pRepr->n_outputs > 1 )
|
if ( pRepr->n_inputs > 6 || pRepr->n_outputs > 1 )
|
||||||
|
|
@ -74,8 +74,8 @@ Vec_Int_t * Mpm_ManFindDsdMatches( Mpm_Man_t * p, void * pScl, Vec_Int_t ** pvNp
|
||||||
iClass = Config >> 17;
|
iClass = Config >> 17;
|
||||||
Config = (pRepr->Id << 17) | (Config & 0x1FFFF);
|
Config = (pRepr->Id << 17) | (Config & 0x1FFFF);
|
||||||
// write gate and NPN config for this DSD class
|
// write gate and NPN config for this DSD class
|
||||||
Vec_IntWriteEntry( vClasses, iClass, Config );
|
vClass = Vec_WecEntry( vClasses, iClass );
|
||||||
Vec_IntWriteEntry( *pvNpnCosts, iClass, (int)(100 * pRepr->area) );
|
Vec_IntPush( vClass, Config );
|
||||||
if ( !fVerbose )
|
if ( !fVerbose )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -100,17 +100,19 @@ 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 * vNpnConfigs )
|
Vec_Ptr_t * Mpm_ManFindCells( Mio_Library_t * pMio, SC_Lib * pScl, Vec_Wec_t * vNpnConfigs )
|
||||||
{
|
{
|
||||||
Vec_Ptr_t * vNpnGatesMio;
|
Vec_Ptr_t * vNpnGatesMio;
|
||||||
|
Vec_Int_t * vClass;
|
||||||
Mio_Gate_t * pMioGate;
|
Mio_Gate_t * pMioGate;
|
||||||
SC_Cell * pCell;
|
SC_Cell * pCell;
|
||||||
int Config, iClass;
|
int Config, iClass;
|
||||||
vNpnGatesMio = Vec_PtrStart( Vec_IntSize(vNpnConfigs) );
|
vNpnGatesMio = Vec_PtrStart( Vec_WecSize(vNpnConfigs) );
|
||||||
Vec_IntForEachEntry( vNpnConfigs, Config, iClass )
|
Vec_WecForEachLevel( vNpnConfigs, vClass, iClass )
|
||||||
{
|
{
|
||||||
if ( Config == -1 )
|
if ( Vec_IntSize(vClass) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
Config = Vec_IntEntry(vClass, 0);
|
||||||
pCell = SC_LibCell( pScl, (Config >> 17) );
|
pCell = SC_LibCell( pScl, (Config >> 17) );
|
||||||
pMioGate = Mio_LibraryReadGateByName( pMio, pCell->pName, NULL );
|
pMioGate = Mio_LibraryReadGateByName( pMio, pCell->pName, NULL );
|
||||||
if ( pMioGate == NULL )
|
if ( pMioGate == NULL )
|
||||||
|
|
@ -161,7 +163,7 @@ Abc_Ntk_t * Mpm_ManDeriveMappedAbcNtk( Mpm_Man_t * p, Mio_Library_t * pMio )
|
||||||
{
|
{
|
||||||
Abc_Ntk_t * pNtk;
|
Abc_Ntk_t * pNtk;
|
||||||
Vec_Ptr_t * vNpnGatesMio;
|
Vec_Ptr_t * vNpnGatesMio;
|
||||||
Vec_Int_t * vNodes, * vCopy;
|
Vec_Int_t * vNodes, * vCopy, * vClass;
|
||||||
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;
|
||||||
|
|
@ -214,7 +216,8 @@ Abc_Ntk_t * Mpm_ManDeriveMappedAbcNtk( Mpm_Man_t * p, Mio_Library_t * pMio )
|
||||||
Vec_IntForEachEntry( vNodes, iNode, i )
|
Vec_IntForEachEntry( vNodes, iNode, i )
|
||||||
{
|
{
|
||||||
pCutBest = Mpm_ObjCutBestP( p, Mig_ManObj(p->pMig, iNode) );
|
pCutBest = Mpm_ObjCutBestP( p, Mig_ManObj(p->pMig, iNode) );
|
||||||
Config = Vec_IntEntry( p->vNpnConfigs, Abc_Lit2Var(pCutBest->iFunc) );
|
vClass = Vec_WecEntry( p->vNpnConfigs, Abc_Lit2Var(pCutBest->iFunc) );
|
||||||
|
Config = Vec_IntEntry( vClass, 0 );
|
||||||
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) );
|
||||||
assert( pObj->pData != NULL );
|
assert( pObj->pData != NULL );
|
||||||
|
|
@ -265,7 +268,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->vNpnConfigs = Mpm_ManFindDsdMatches( p, p->pPars->pScl, &p->vNpnCosts );
|
p->vNpnConfigs = Mpm_ManFindDsdMatches( p, p->pPars->pScl );
|
||||||
Mpm_ManPrepare( p );
|
Mpm_ManPrepare( p );
|
||||||
Mpm_ManPerform( p );
|
Mpm_ManPerform( p );
|
||||||
if ( p->pPars->fVerbose )
|
if ( p->pPars->fVerbose )
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@
|
||||||
#include "misc/vec/vec.h"
|
#include "misc/vec/vec.h"
|
||||||
#include "misc/vec/vecMem.h"
|
#include "misc/vec/vecMem.h"
|
||||||
#include "misc/vec/vecHsh.h"
|
#include "misc/vec/vecHsh.h"
|
||||||
|
#include "misc/vec/vecWec.h"
|
||||||
#include "misc/util/utilTruth.h"
|
#include "misc/util/utilTruth.h"
|
||||||
#include "mpmMig.h"
|
#include "mpmMig.h"
|
||||||
#include "mpm.h"
|
#include "mpm.h"
|
||||||
|
|
@ -136,8 +137,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 * vNpnConfigs;
|
Vec_Wec_t * vNpnConfigs;
|
||||||
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
|
||||||
Vec_Int_t vCutLists; // cut list
|
Vec_Int_t vCutLists; // cut list
|
||||||
|
|
@ -242,7 +242,7 @@ extern word Mpm_CutTruthFromDsd( Mpm_Man_t * pMan, Mpm_Cut_t *
|
||||||
extern int Mpm_CutCheckDsd6( Mpm_Man_t * p, word t );
|
extern int Mpm_CutCheckDsd6( Mpm_Man_t * p, word t );
|
||||||
extern int Mpm_CutComputeDsd6( Mpm_Man_t * p, Mpm_Cut_t * pCut, Mpm_Cut_t * pCut0, Mpm_Cut_t * pCut1, Mpm_Cut_t * pCutC, int fCompl0, int fCompl1, int fComplC, int Type );
|
extern int Mpm_CutComputeDsd6( Mpm_Man_t * p, Mpm_Cut_t * pCut, Mpm_Cut_t * pCut0, Mpm_Cut_t * pCut1, Mpm_Cut_t * pCutC, int fCompl0, int fCompl1, int fComplC, int Type );
|
||||||
/*=== mpmGates.c ===========================================================*/
|
/*=== mpmGates.c ===========================================================*/
|
||||||
extern Vec_Int_t * Mpm_ManFindDsdMatches( Mpm_Man_t * p, void * pScl, Vec_Int_t ** pvNpnCosts );
|
extern Vec_Wec_t * Mpm_ManFindDsdMatches( Mpm_Man_t * p, void * pScl );
|
||||||
/*=== mpmLib.c ===========================================================*/
|
/*=== mpmLib.c ===========================================================*/
|
||||||
extern Mpm_LibLut_t * Mpm_LibLutSetSimple( int nLutSize );
|
extern Mpm_LibLut_t * Mpm_LibLutSetSimple( int nLutSize );
|
||||||
extern void Mpm_LibLutFree( Mpm_LibLut_t * pLib );
|
extern void Mpm_LibLutFree( Mpm_LibLut_t * pLib );
|
||||||
|
|
|
||||||
|
|
@ -135,8 +135,7 @@ void Mpm_ManStop( Mpm_Man_t * p )
|
||||||
Vec_IntFree( p->pHash->vData );
|
Vec_IntFree( p->pHash->vData );
|
||||||
Hsh_IntManStop( p->pHash );
|
Hsh_IntManStop( p->pHash );
|
||||||
}
|
}
|
||||||
Vec_IntFreeP( &p->vNpnCosts );
|
Vec_WecFreeP( &p->vNpnConfigs );
|
||||||
Vec_IntFreeP( &p->vNpnConfigs );
|
|
||||||
Vec_PtrFree( p->vTemp );
|
Vec_PtrFree( p->vTemp );
|
||||||
Mmr_StepStop( p->pManCuts );
|
Mmr_StepStop( p->pManCuts );
|
||||||
ABC_FREE( p->vFreeUnits.pArray );
|
ABC_FREE( p->vFreeUnits.pArray );
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,7 @@ static inline int Mpm_CutGetArea( Mpm_Man_t * p, Mpm_Cut_t * pCut )
|
||||||
if ( p->pPars->fMap4Aig )
|
if ( p->pPars->fMap4Aig )
|
||||||
return MPM_UNIT_AREA * p->pDsd6[Abc_Lit2Var(pCut->iFunc)].nAnds;
|
return MPM_UNIT_AREA * p->pDsd6[Abc_Lit2Var(pCut->iFunc)].nAnds;
|
||||||
if ( p->pPars->fMap4Gates )
|
if ( p->pPars->fMap4Gates )
|
||||||
return MPM_UNIT_AREA * Vec_IntEntry( p->vNpnCosts, Abc_Lit2Var(pCut->iFunc) );
|
return MPM_UNIT_AREA * 1;
|
||||||
return p->pLibLut->pLutAreas[pCut->nLeaves];
|
return p->pLibLut->pLutAreas[pCut->nLeaves];
|
||||||
}
|
}
|
||||||
static inline word Mpm_CutGetSign( Mpm_Cut_t * pCut )
|
static inline word Mpm_CutGetSign( Mpm_Cut_t * pCut )
|
||||||
|
|
|
||||||
|
|
@ -495,6 +495,9 @@ void Abc_SclUpsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * pPars
|
||||||
|
|
||||||
// perform upsizing
|
// perform upsizing
|
||||||
nAllPos = nAllNodes = nAllTfos = nAllUpsizes = 0;
|
nAllPos = nAllNodes = nAllTfos = nAllUpsizes = 0;
|
||||||
|
if ( p->BestDelay <= SC_LibTimeFromPs(p->pLib, (float)pPars->DelayUser) )
|
||||||
|
printf( "Current delay (%.2f ps) is better than the target delay (%.2f ps).\n", SC_LibTimePs(p->pLib, p->BestDelay), (float)pPars->DelayUser );
|
||||||
|
else
|
||||||
for ( i = 0; i < pPars->nIters; i++ )
|
for ( i = 0; i < pPars->nIters; i++ )
|
||||||
{
|
{
|
||||||
for ( win = pPars->Window; win <= 100; win *= 2 )
|
for ( win = pPars->Window; win <= 100; win *= 2 )
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue