Commit 1814b674 by Alan Mishchenko

New technology mapper.

parent 7efe9f2a
......@@ -2503,6 +2503,10 @@ SOURCE=.\src\map\mpm\mpmCore.c
# End Source File
# Begin Source File
SOURCE=.\src\map\mpm\mpmDsd.c
# End Source File
# Begin Source File
SOURCE=.\src\map\mpm\mpmInt.h
# End Source File
# Begin Source File
......@@ -2511,6 +2515,10 @@ SOURCE=.\src\map\mpm\mpmLib.c
# End Source File
# Begin Source File
SOURCE=.\src\map\mpm\mpmMan.c
# End Source File
# Begin Source File
SOURCE=.\src\map\mpm\mpmMap.c
# End Source File
# Begin Source File
......
......@@ -60,6 +60,7 @@ struct Mpm_Par_t_
int nNumCuts;
int DelayTarget;
int fUseTruth;
int fUseDsd;
int fCutMin;
int fDeriveLuts;
int fVerbose;
......
......@@ -49,6 +49,7 @@ void Mpm_ManSetParsDefault( Mpm_Par_t * p )
p->pLib = NULL; // LUT library
p->nNumCuts = 8; // cut number
p->fUseTruth = 0; // uses truth tables
p->fUseDsd = 0; // uses DSDs
p->fCutMin = 0; // enables cut minimization
p->DelayTarget = -1; // delay target
p->fDeriveLuts = 0; // use truth tables to derive AIG structure
......
......@@ -63,7 +63,7 @@ struct Mpm_Cut_t_
unsigned fCompl : 1;
unsigned fUseless : 1; // internal flag
unsigned nLeaves : 5; // leaves
int pLeaves[0]; // leaves
int pLeaves[1]; // leaves
};
typedef struct Mpm_Uni_t_ Mpm_Uni_t; // 48 bytes
struct Mpm_Uni_t_
......@@ -74,11 +74,8 @@ struct Mpm_Uni_t_
int mAveRefs; // area references
word uSign; // cut signature
int Cost; // user cost
unsigned iFunc : 25; // function
unsigned fCompl : 1;
unsigned fUseless : 1; // internal flag
unsigned nLeaves : 5; // leaves
int pLeaves[MPM_VAR_MAX]; // leaves
Mpm_Cut_t pCut; // new cut
int Data[MPM_VAR_MAX]; // padding
};
typedef struct Mpm_Man_t_ Mpm_Man_t;
......@@ -102,14 +99,12 @@ struct Mpm_Man_t_
int nCutStore; // number of cuts in storage
Mpm_Uni_t * pCutStore[MPM_CUT_MAX+1]; // storage for cuts
Mpm_Uni_t pCutUnits[MPM_CUT_MAX+1]; // cut info units
Vec_Int_t vFreeUnits; // free cut info units
Vec_Ptr_t vFreeUnits; // free cut info units
Vec_Ptr_t * vTemp; // storage for cuts
// object presence
unsigned char * pObjPres; // object presence
int pObjPresUsed[MPM_VAR_MAX];
int nObjPresUsed;
Mpm_Cut_t * pCutTemp; // temporary cut
Vec_Str_t vObjShared; // object presence
// cut comparison
int (* pCutCmp) (Mpm_Uni_t *, Mpm_Uni_t *);// procedure to compare cuts
......@@ -155,7 +150,7 @@ struct Mpm_Man_t_
static inline int Mpm_ObjCutBest( Mpm_Man_t * p, Mig_Obj_t * pObj ) { return Vec_IntEntry(&p->vCutBests, Mig_ObjId(pObj)); }
static inline void Mpm_ObjSetCutBest( Mpm_Man_t * p, Mig_Obj_t * pObj, int i ) { Vec_IntWriteEntry(&p->vCutBests, Mig_ObjId(pObj), i); }
static inline int Mpm_CutWordNum( int nLeaves ) { return ((sizeof(Mpm_Cut_t)/sizeof(int) + nLeaves + 1) >> 1); }
static inline int Mpm_CutWordNum( int nLeaves ) { return ((sizeof(Mpm_Cut_t) + (nLeaves << 2)) >> 3); }
static inline Mpm_Cut_t * Mpm_CutFetch( Mpm_Man_t * p, int h ) { Mpm_Cut_t * pCut = (Mpm_Cut_t *)Mmr_StepEntry( p->pManCuts, h ); assert( Mpm_CutWordNum(pCut->nLeaves) == (h & p->pManCuts->uMask) ); return pCut; }
static inline Mpm_Cut_t * Mpm_ObjCutBestP( Mpm_Man_t * p, Mig_Obj_t * pObj ) { return Mpm_CutFetch( p, Mpm_ObjCutBest(p, pObj) ); }
......@@ -212,7 +207,7 @@ static inline void Mpm_VarsSwap( int * V2P, int * P2V, int iVar, int jVar
/*=== mpmAbc.c ===========================================================*/
extern Mig_Man_t * Mig_ManCreate( void * pGia );
extern void * Mpm_ManFromIfLogic( Mpm_Man_t * pMan );
/*=== mpmCore.c ===========================================================*/
/*=== mpmMan.c ===========================================================*/
extern Mpm_Man_t * Mpm_ManStart( Mig_Man_t * pMig, Mpm_Par_t * pPars );
extern void Mpm_ManStop( Mpm_Man_t * p );
extern void Mpm_ManPrintStatsInit( Mpm_Man_t * p );
......
/**CFile****************************************************************
FileName [mpm.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Configurable technology mapper.]
Synopsis []
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 1, 2013.]
Revision [$Id: mpm.c,v 1.00 2013/06/01 00:00:00 alanmi Exp $]
***********************************************************************/
#include "mpmInt.h"
ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Mpm_Man_t * Mpm_ManStart( Mig_Man_t * pMig, Mpm_Par_t * pPars )
{
Mpm_Man_t * p;
int i;
assert( sizeof(Mpm_Uni_t) % sizeof(word) == 0 ); // aligned info to word boundary
assert( pPars->nNumCuts <= MPM_CUT_MAX );
Mig_ManSetRefs( pMig, 1 );
// alloc
p = ABC_CALLOC( Mpm_Man_t, 1 );
p->pMig = pMig;
p->pPars = pPars;
p->pLibLut = pPars->pLib;
p->nLutSize = pPars->pLib->LutMax;
p->nTruWords = pPars->fUseTruth ? Abc_Truth6WordNum(p->nLutSize) : 0;
p->nNumCuts = pPars->nNumCuts;
p->timeTotal = Abc_Clock();
// cuts
assert( Mpm_CutWordNum(32) < 32 ); // using 5 bits for word count
p->pManCuts = Mmr_StepStart( 13, Abc_Base2Log(Mpm_CutWordNum(p->nLutSize) + 1) );
Vec_PtrGrow( &p->vFreeUnits, p->nNumCuts + 1 );
for ( i = p->nNumCuts; i >= 0; i-- )
Vec_PtrPush( &p->vFreeUnits, p->pCutUnits + i );
p->pObjPres = ABC_FALLOC( unsigned char, Mig_ManObjNum(pMig) );
Vec_StrGrow( &p->vObjShared, 32 );
p->vTemp = Vec_PtrAlloc( 1000 );
// mapping attributes
Vec_IntFill( &p->vCutBests, Mig_ManObjNum(pMig), 0 );
Vec_IntFill( &p->vCutLists, Mig_ManObjNum(pMig), 0 );
Vec_IntFill( &p->vMigRefs, Mig_ManObjNum(pMig), 0 );
Vec_IntFill( &p->vMapRefs, Mig_ManObjNum(pMig), 0 );
Vec_IntFill( &p->vEstRefs, Mig_ManObjNum(pMig), 0 );
Vec_IntFill( &p->vRequireds, Mig_ManObjNum(pMig), ABC_INFINITY );
Vec_IntFill( &p->vTimes, Mig_ManObjNum(pMig), 0 );
Vec_IntFill( &p->vAreas, Mig_ManObjNum(pMig), 0 );
Vec_IntFill( &p->vEdges, Mig_ManObjNum(pMig), 0 );
// start DSD manager
p->pManDsd = NULL;
pMig->pMan = p;
if ( p->pPars->fUseTruth )
{
word Truth = 0;
p->vTtMem = Vec_MemAlloc( p->nTruWords, 12 ); // 32 KB/page for 6-var functions
Vec_MemHashAlloc( p->vTtMem, 10000 );
p->funcCst0 = Vec_MemHashInsert( p->vTtMem, &Truth );
Truth = ABC_CONST(0xAAAAAAAAAAAAAAAA);
p->funcVar0 = Vec_MemHashInsert( p->vTtMem, &Truth );
}
else
p->funcVar0 = 1;
return p;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Mpm_ManStop( Mpm_Man_t * p )
{
if ( p->vTtMem )
{
Vec_MemHashFree( p->vTtMem );
Vec_MemFree( p->vTtMem );
}
Vec_PtrFree( p->vTemp );
Mmr_StepStop( p->pManCuts );
ABC_FREE( p->vFreeUnits.pArray );
ABC_FREE( p->vObjShared.pArray );
ABC_FREE( p->pObjPres );
// mapping attributes
ABC_FREE( p->vCutBests.pArray );
ABC_FREE( p->vCutLists.pArray );
ABC_FREE( p->vMigRefs.pArray );
ABC_FREE( p->vMapRefs.pArray );
ABC_FREE( p->vEstRefs.pArray );
ABC_FREE( p->vRequireds.pArray );
ABC_FREE( p->vTimes.pArray );
ABC_FREE( p->vAreas.pArray );
ABC_FREE( p->vEdges.pArray );
ABC_FREE( p );
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Mpm_ManPrintStatsInit( Mpm_Man_t * p )
{
printf( "K = %d. C = %d. Cands = %d. Choices = %d. CutMin = %d. Truth = %d.\n",
p->nLutSize, p->nNumCuts,
Mig_ManCiNum(p->pMig) + Mig_ManNodeNum(p->pMig), 0,
p->pPars->fCutMin, p->pPars->fUseTruth );
}
void Mpm_ManPrintStats( Mpm_Man_t * p )
{
printf( "Memory usage: Mig = %.2f MB Map = %.2f MB Cut = %.2f MB Total = %.2f MB. ",
1.0 * Mig_ManObjNum(p->pMig) * sizeof(Mig_Obj_t) / (1 << 20),
1.0 * Mig_ManObjNum(p->pMig) * 48 / (1 << 20),
1.0 * Mmr_StepMemory(p->pManCuts) / (1 << 17),
1.0 * Mig_ManObjNum(p->pMig) * sizeof(Mig_Obj_t) / (1 << 20) +
1.0 * Mig_ManObjNum(p->pMig) * 48 / (1 << 20) +
1.0 * Mmr_StepMemory(p->pManCuts) / (1 << 17) );
#ifdef MIG_RUNTIME
printf( "\n" );
p->timeTotal = Abc_Clock() - p->timeTotal;
p->timeOther = p->timeTotal - (p->timeFanin + p->timeDerive);
Abc_Print( 1, "Runtime breakdown:\n" );
ABC_PRTP( "Precomputing fanin info ", p->timeFanin , p->timeTotal );
ABC_PRTP( "Complete cut computation ", p->timeDerive , p->timeTotal );
ABC_PRTP( "- Merging cuts ", p->timeMerge , p->timeTotal );
ABC_PRTP( "- Evaluting cut parameters ", p->timeEval , p->timeTotal );
ABC_PRTP( "- Checking cut containment ", p->timeCompare, p->timeTotal );
ABC_PRTP( "- Adding cuts to storage ", p->timeStore , p->timeTotal );
ABC_PRTP( "Other ", p->timeOther , p->timeTotal );
ABC_PRTP( "TOTAL ", p->timeTotal , p->timeTotal );
#else
Abc_PrintTime( 1, "Time", Abc_Clock() - p->timeTotal );
#endif
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
ABC_NAMESPACE_IMPL_END
......@@ -100,7 +100,7 @@ int Mpm_CutComputeTruth6( Mpm_Man_t * p, Mpm_Cut_t * pCut, Mpm_Cut_t * pCut0, Mp
word * pTruthC = NULL;
word t0 = (fCompl0 ^ pCut0->fCompl ^ Abc_LitIsCompl(pCut0->iFunc)) ? ~*pTruth0 : *pTruth0;
word t1 = (fCompl1 ^ pCut1->fCompl ^ Abc_LitIsCompl(pCut1->iFunc)) ? ~*pTruth1 : *pTruth1;
word tC, t;
word tC = 0, t = 0;
t0 = Mpm_TruthStretch6( t0, pCut, pCut0, p->nLutSize );
t1 = Mpm_TruthStretch6( t1, pCut, pCut1, p->nLutSize );
if ( pCutC )
......
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