Commit 9e723d40 by Alan Mishchenko

New technology mapper.

parent 7630f2bd
...@@ -180,23 +180,23 @@ void Mpm_ManPrintStats( Mpm_Man_t * p ) ...@@ -180,23 +180,23 @@ void Mpm_ManPrintStats( Mpm_Man_t * p )
1.0 * Mig_ManObjNum(p->pMig) * sizeof(Mig_Obj_t) / (1 << 20) + 1.0 * Mig_ManObjNum(p->pMig) * sizeof(Mig_Obj_t) / (1 << 20) +
1.0 * Mig_ManObjNum(p->pMig) * 48 / (1 << 20) + 1.0 * Mig_ManObjNum(p->pMig) * 48 / (1 << 20) +
1.0 * Mmr_StepMemory(p->pManCuts) / (1 << 17) ); 1.0 * Mmr_StepMemory(p->pManCuts) / (1 << 17) );
if ( p->timeDerive )
#ifdef MIG_RUNTIME {
printf( "\n" ); printf( "\n" );
p->timeTotal = Abc_Clock() - p->timeTotal; p->timeTotal = Abc_Clock() - p->timeTotal;
p->timeOther = p->timeTotal - p->timeDerive; p->timeOther = p->timeTotal - p->timeDerive;
Abc_Print( 1, "Runtime breakdown:\n" ); Abc_Print( 1, "Runtime breakdown:\n" );
ABC_PRTP( "Complete cut computation ", p->timeDerive , p->timeTotal ); ABC_PRTP( "Complete cut computation ", p->timeDerive , p->timeTotal );
ABC_PRTP( "- Merging cuts ", p->timeMerge , p->timeTotal ); ABC_PRTP( "- Merging cuts ", p->timeMerge , p->timeTotal );
ABC_PRTP( "- Evaluting cut parameters ", p->timeEval , p->timeTotal ); ABC_PRTP( "- Evaluting cut parameters ", p->timeEval , p->timeTotal );
ABC_PRTP( "- Checking cut containment ", p->timeCompare, p->timeTotal ); ABC_PRTP( "- Checking cut containment ", p->timeCompare, p->timeTotal );
ABC_PRTP( "- Adding cuts to storage ", p->timeStore , p->timeTotal ); ABC_PRTP( "- Adding cuts to storage ", p->timeStore , p->timeTotal );
ABC_PRTP( "Other ", p->timeOther , p->timeTotal ); ABC_PRTP( "Other ", p->timeOther , p->timeTotal );
ABC_PRTP( "TOTAL ", p->timeTotal , p->timeTotal ); ABC_PRTP( "TOTAL ", p->timeTotal , p->timeTotal );
#else }
Abc_PrintTime( 1, "Time", Abc_Clock() - p->timeTotal ); else
#endif Abc_PrintTime( 1, "Time", Abc_Clock() - p->timeTotal );
} }
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
......
...@@ -26,6 +26,8 @@ ABC_NAMESPACE_IMPL_START ...@@ -26,6 +26,8 @@ ABC_NAMESPACE_IMPL_START
/// DECLARATIONS /// /// DECLARATIONS ///
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
#define MIG_RUNTIME
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS /// /// FUNCTION DEFINITIONS ///
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
...@@ -115,41 +117,22 @@ static inline void Mpm_CutPrintAll( Mpm_Man_t * p ) ...@@ -115,41 +117,22 @@ static inline void Mpm_CutPrintAll( Mpm_Man_t * p )
Mpm_CutPrint( &p->pCutStore[i]->pCut ); Mpm_CutPrint( &p->pCutStore[i]->pCut );
} }
} }
static inline int Mpm_ManFindLeaf( Mpm_Cut_t * pNew, int iObj ) static inline int Mpm_CutFindLeaf( Mpm_Cut_t * pNew, int iObj )
{ {
int i; int i;
for ( i = 0; i < (int)pNew->nLeaves; i++ ) for ( i = 0; i < (int)pNew->nLeaves; i++ )
if ( Abc_Lit2Var(pNew->pLeaves[i]) == iObj ) if ( Abc_Lit2Var(pNew->pLeaves[i]) == iObj )
return i; return i;
return 0xFF; return i;
} }
static inline int Mpm_ManSetIsSmaller( Mpm_Man_t * p, Mpm_Cut_t * pNew, Mpm_Cut_t * pCut, int nTotal ) // check if pCut is contained in the current one static inline int Mpm_CutIsContained( Mpm_Man_t * p, Mpm_Cut_t * pBase, Mpm_Cut_t * pCut ) // check if pCut is contained pBase
{ {
int i, Index; int i;
for ( i = 0; i < (int)pCut->nLeaves; i++ ) for ( i = 0; i < (int)pCut->nLeaves; i++ )
{ if ( Mpm_CutFindLeaf( pBase, Abc_Lit2Var(pCut->pLeaves[i]) ) == (int)pBase->nLeaves )
// Index = (int)p->pObjPres[Abc_Lit2Var(pCut->pLeaves[i])];
Index = Mpm_ManFindLeaf( pNew, Abc_Lit2Var(pCut->pLeaves[i]) );
if ( Index == 0xFF )
return 0; return 0;
// assert( Index < nTotal );
}
return 1; return 1;
} }
static inline int Mpm_ManSetIsBigger( Mpm_Man_t * p, Mpm_Cut_t * pNew, Mpm_Cut_t * pCut, int nTotal ) // check if pCut contains the current one
{
int i, Index, Counter = 0;
for ( i = 0; i < (int)pCut->nLeaves; i++ )
{
// Index = (int)p->pObjPres[Abc_Lit2Var(pCut->pLeaves[i])];
Index = Mpm_ManFindLeaf( pNew, Abc_Lit2Var(pCut->pLeaves[i]) );
if ( Index == 0xFF )
continue;
// assert( Index < nTotal );
Counter++;
}
return (int)(Counter == nTotal);
}
/**Function************************************************************* /**Function*************************************************************
...@@ -222,6 +205,9 @@ static inline Mpm_Uni_t * Mpm_CutSetupInfo( Mpm_Man_t * p, Mpm_Cut_t * pCut, int ...@@ -222,6 +205,9 @@ static inline Mpm_Uni_t * Mpm_CutSetupInfo( Mpm_Man_t * p, Mpm_Cut_t * pCut, int
pUnit->uSign |= ((word)1 << (iLeaf & 0x3F)); pUnit->uSign |= ((word)1 << (iLeaf & 0x3F));
} }
pUnit->mAveRefs = pUnit->mAveRefs * MPM_UNIT_EDGE / Abc_MaxInt(pCut->nLeaves, 1); pUnit->mAveRefs = pUnit->mAveRefs * MPM_UNIT_EDGE / Abc_MaxInt(pCut->nLeaves, 1);
assert( pUnit->mTime <= 0x3FFFFFFF );
assert( pUnit->mArea <= 0x3FFFFFFF );
assert( pUnit->mEdge <= 0x3FFFFFFF );
return pUnit; return pUnit;
} }
...@@ -278,7 +264,7 @@ clk = Abc_Clock(); ...@@ -278,7 +264,7 @@ clk = Abc_Clock();
pUnit = p->pCutStore[k]; pUnit = p->pCutStore[k];
if ( pUnitNew->pCut.nLeaves >= pUnit->pCut.nLeaves && if ( pUnitNew->pCut.nLeaves >= pUnit->pCut.nLeaves &&
(pUnitNew->uSign & pUnit->uSign) == pUnit->uSign && (pUnitNew->uSign & pUnit->uSign) == pUnit->uSign &&
Mpm_ManSetIsSmaller(p, &pUnitNew->pCut, &pUnit->pCut, pUnitNew->pCut.nLeaves) ) Mpm_CutIsContained(p, &pUnitNew->pCut, &pUnit->pCut) )
{ {
#ifdef MIG_RUNTIME #ifdef MIG_RUNTIME
p->timeCompare += Abc_Clock() - clk; p->timeCompare += Abc_Clock() - clk;
...@@ -310,7 +296,7 @@ p->timeCompare += Abc_Clock() - clk; ...@@ -310,7 +296,7 @@ p->timeCompare += Abc_Clock() - clk;
pUnit = p->pCutStore[k]; pUnit = p->pCutStore[k];
if ( pUnitNew->pCut.nLeaves <= pUnit->pCut.nLeaves && if ( pUnitNew->pCut.nLeaves <= pUnit->pCut.nLeaves &&
(pUnitNew->uSign & pUnit->uSign) == pUnitNew->uSign && (pUnitNew->uSign & pUnit->uSign) == pUnitNew->uSign &&
Mpm_ManSetIsBigger(p, &pUnitNew->pCut, &pUnit->pCut, pUnitNew->pCut.nLeaves) ) Mpm_CutIsContained(p, &pUnit->pCut, &pUnitNew->pCut) )
{ {
Vec_PtrPush( &p->vFreeUnits, pUnit ); Vec_PtrPush( &p->vFreeUnits, pUnit );
continue; continue;
...@@ -344,7 +330,7 @@ p->timeCompare += Abc_Clock() - clk; ...@@ -344,7 +330,7 @@ p->timeCompare += Abc_Clock() - clk;
static inline Mpm_Cut_t * Mpm_ManMergeCuts( Mpm_Man_t * p, Mpm_Cut_t * pCut0, Mpm_Cut_t * pCut1, Mpm_Cut_t * pCut2 ) static inline Mpm_Cut_t * Mpm_ManMergeCuts( Mpm_Man_t * p, Mpm_Cut_t * pCut0, Mpm_Cut_t * pCut1, Mpm_Cut_t * pCut2 )
{ {
Mpm_Cut_t * pTemp, * pCut = &((Mpm_Uni_t *)Vec_PtrEntryLast(&p->vFreeUnits))->pCut; Mpm_Cut_t * pTemp, * pCut = &((Mpm_Uni_t *)Vec_PtrEntryLast(&p->vFreeUnits))->pCut;
int i, c, iObj, iPlace; int i, c, iPlace;
// base cut // base cut
memcpy( pCut->pLeaves, pCut0->pLeaves, sizeof(int) * pCut0->nLeaves ); memcpy( pCut->pLeaves, pCut0->pLeaves, sizeof(int) * pCut0->nLeaves );
pCut->nLeaves = pCut0->nLeaves; pCut->nLeaves = pCut0->nLeaves;
...@@ -360,10 +346,7 @@ static inline Mpm_Cut_t * Mpm_ManMergeCuts( Mpm_Man_t * p, Mpm_Cut_t * pCut0, Mp ...@@ -360,10 +346,7 @@ static inline Mpm_Cut_t * Mpm_ManMergeCuts( Mpm_Man_t * p, Mpm_Cut_t * pCut0, Mp
p->uComplMask[c] = 0; p->uComplMask[c] = 0;
for ( i = 0; i < (int)pTemp->nLeaves; i++ ) for ( i = 0; i < (int)pTemp->nLeaves; i++ )
{ {
iObj = Abc_Lit2Var(pTemp->pLeaves[i]); iPlace = Mpm_CutFindLeaf( pCut, Abc_Lit2Var(pTemp->pLeaves[i]) );
for ( iPlace = 0; iPlace < (int)pCut->nLeaves; iPlace++ )
if ( iObj == Abc_Lit2Var(pCut->pLeaves[iPlace]) )
break;
if ( iPlace == (int)pCut->nLeaves ) if ( iPlace == (int)pCut->nLeaves )
{ {
if ( (int)pCut->nLeaves == p->nLutSize ) if ( (int)pCut->nLeaves == p->nLutSize )
...@@ -385,10 +368,7 @@ static inline Mpm_Cut_t * Mpm_ManMergeCuts( Mpm_Man_t * p, Mpm_Cut_t * pCut0, Mp ...@@ -385,10 +368,7 @@ static inline Mpm_Cut_t * Mpm_ManMergeCuts( Mpm_Man_t * p, Mpm_Cut_t * pCut0, Mp
break; break;
for ( i = 0; i < (int)pTemp->nLeaves; i++ ) for ( i = 0; i < (int)pTemp->nLeaves; i++ )
{ {
iObj = Abc_Lit2Var(pTemp->pLeaves[i]); iPlace = Mpm_CutFindLeaf( pCut, Abc_Lit2Var(pTemp->pLeaves[i]) );
for ( iPlace = 0; iPlace < (int)pCut->nLeaves; iPlace++ )
if ( iObj == Abc_Lit2Var(pCut->pLeaves[iPlace]) )
break;
if ( iPlace == (int)pCut->nLeaves ) if ( iPlace == (int)pCut->nLeaves )
{ {
if ( (int)pCut->nLeaves == p->nLutSize ) if ( (int)pCut->nLeaves == p->nLutSize )
......
...@@ -34,7 +34,6 @@ ABC_NAMESPACE_HEADER_START ...@@ -34,7 +34,6 @@ ABC_NAMESPACE_HEADER_START
/// PARAMETERS /// /// PARAMETERS ///
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
//#define MIG_RUNTIME
#define MIG_NONE 0x7FFFFFFF #define MIG_NONE 0x7FFFFFFF
//#define MIG_MASK 0x0000FFFF //#define MIG_MASK 0x0000FFFF
//#define MIG_BASE 16 //#define MIG_BASE 16
......
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