mirror of
https://github.com/YosysHQ/abc.git
synced 2026-08-22 14:06:36 +02:00
New technology mapper.
This commit is contained in:
@@ -116,7 +116,6 @@ struct Mpm_Man_t_
|
|||||||
// object presence
|
// object presence
|
||||||
unsigned char * pObjPres; // object presence
|
unsigned char * pObjPres; // object presence
|
||||||
Vec_Int_t vObjPresUsed; // used objects
|
Vec_Int_t vObjPresUsed; // used objects
|
||||||
Vec_Str_t vObjShared; // object presence
|
|
||||||
// cut comparison
|
// cut comparison
|
||||||
int (* pCutCmp) (Mpm_Uni_t *, Mpm_Uni_t *);// procedure to compare cuts
|
int (* pCutCmp) (Mpm_Uni_t *, Mpm_Uni_t *);// procedure to compare cuts
|
||||||
// fanin cuts/signatures
|
// fanin cuts/signatures
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ Mpm_Man_t * Mpm_ManStart( Mig_Man_t * pMig, Mpm_Par_t * pPars )
|
|||||||
Vec_PtrPush( &p->vFreeUnits, p->pCutUnits + i );
|
Vec_PtrPush( &p->vFreeUnits, p->pCutUnits + i );
|
||||||
p->pObjPres = ABC_FALLOC( unsigned char, Mig_ManObjNum(pMig) );
|
p->pObjPres = ABC_FALLOC( unsigned char, Mig_ManObjNum(pMig) );
|
||||||
Vec_IntGrow( &p->vObjPresUsed, p->nLutSize );
|
Vec_IntGrow( &p->vObjPresUsed, p->nLutSize );
|
||||||
Vec_StrGrow( &p->vObjShared, 32 );
|
|
||||||
p->vTemp = Vec_PtrAlloc( 1000 );
|
p->vTemp = Vec_PtrAlloc( 1000 );
|
||||||
// mapping attributes
|
// mapping attributes
|
||||||
Vec_IntFill( &p->vCutBests, Mig_ManObjNum(pMig), 0 );
|
Vec_IntFill( &p->vCutBests, Mig_ManObjNum(pMig), 0 );
|
||||||
@@ -144,7 +143,6 @@ void Mpm_ManStop( Mpm_Man_t * p )
|
|||||||
Mmr_StepStop( p->pManCuts );
|
Mmr_StepStop( p->pManCuts );
|
||||||
ABC_FREE( p->vObjPresUsed.pArray );
|
ABC_FREE( p->vObjPresUsed.pArray );
|
||||||
ABC_FREE( p->vFreeUnits.pArray );
|
ABC_FREE( p->vFreeUnits.pArray );
|
||||||
ABC_FREE( p->vObjShared.pArray );
|
|
||||||
ABC_FREE( p->pObjPres );
|
ABC_FREE( p->pObjPres );
|
||||||
// mapping attributes
|
// mapping attributes
|
||||||
ABC_FREE( p->vCutBests.pArray );
|
ABC_FREE( p->vCutBests.pArray );
|
||||||
|
|||||||
+57
-7
@@ -115,24 +115,34 @@ 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_ManSetIsSmaller( Mpm_Man_t * p, Mpm_Cut_t * pCut, int nTotal ) // check if pCut is contained in the current one
|
static inline int Mpm_ManFindLeaf( Mpm_Cut_t * pNew, int iObj )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for ( i = 0; i < (int)pNew->nLeaves; i++ )
|
||||||
|
if ( Abc_Lit2Var(pNew->pLeaves[i]) == iObj )
|
||||||
|
return i;
|
||||||
|
return 0xFF;
|
||||||
|
}
|
||||||
|
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
|
||||||
{
|
{
|
||||||
int i, Index;
|
int i, Index;
|
||||||
for ( i = 0; i < (int)pCut->nLeaves; i++ )
|
for ( i = 0; i < (int)pCut->nLeaves; i++ )
|
||||||
{
|
{
|
||||||
Index = (int)p->pObjPres[Abc_Lit2Var(pCut->pLeaves[i])];
|
// Index = (int)p->pObjPres[Abc_Lit2Var(pCut->pLeaves[i])];
|
||||||
|
Index = Mpm_ManFindLeaf( pNew, Abc_Lit2Var(pCut->pLeaves[i]) );
|
||||||
if ( Index == 0xFF )
|
if ( Index == 0xFF )
|
||||||
return 0;
|
return 0;
|
||||||
// assert( Index < nTotal );
|
// assert( Index < nTotal );
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
static inline int Mpm_ManSetIsBigger( Mpm_Man_t * p, Mpm_Cut_t * pCut, int nTotal ) // check if pCut contains the current one
|
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;
|
int i, Index, Counter = 0;
|
||||||
for ( i = 0; i < (int)pCut->nLeaves; i++ )
|
for ( i = 0; i < (int)pCut->nLeaves; i++ )
|
||||||
{
|
{
|
||||||
Index = (int)p->pObjPres[Abc_Lit2Var(pCut->pLeaves[i])];
|
// Index = (int)p->pObjPres[Abc_Lit2Var(pCut->pLeaves[i])];
|
||||||
|
Index = Mpm_ManFindLeaf( pNew, Abc_Lit2Var(pCut->pLeaves[i]) );
|
||||||
if ( Index == 0xFF )
|
if ( Index == 0xFF )
|
||||||
continue;
|
continue;
|
||||||
// assert( Index < nTotal );
|
// assert( Index < nTotal );
|
||||||
@@ -268,7 +278,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, &pUnit->pCut, pUnitNew->pCut.nLeaves) )
|
Mpm_ManSetIsSmaller(p, &pUnitNew->pCut, &pUnit->pCut, pUnitNew->pCut.nLeaves) )
|
||||||
{
|
{
|
||||||
#ifdef MIG_RUNTIME
|
#ifdef MIG_RUNTIME
|
||||||
p->timeCompare += Abc_Clock() - clk;
|
p->timeCompare += Abc_Clock() - clk;
|
||||||
@@ -300,7 +310,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, &pUnit->pCut, pUnitNew->pCut.nLeaves) )
|
Mpm_ManSetIsBigger(p, &pUnitNew->pCut, &pUnit->pCut, pUnitNew->pCut.nLeaves) )
|
||||||
{
|
{
|
||||||
Vec_PtrPush( &p->vFreeUnits, pUnit );
|
Vec_PtrPush( &p->vFreeUnits, pUnit );
|
||||||
continue;
|
continue;
|
||||||
@@ -333,13 +343,16 @@ 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 )
|
||||||
{
|
{
|
||||||
|
int fUsePres = 0;
|
||||||
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, fDisj = 1;
|
int i, c, iObj, fDisj = 1;
|
||||||
|
|
||||||
|
if ( fUsePres )
|
||||||
|
{
|
||||||
// clean present objects
|
// clean present objects
|
||||||
for ( i = 0; i < p->vObjPresUsed.nSize; i++ )
|
for ( i = 0; i < p->vObjPresUsed.nSize; i++ )
|
||||||
p->pObjPres[p->vObjPresUsed.pArray[i]] = (unsigned char)0xFF;
|
p->pObjPres[p->vObjPresUsed.pArray[i]] = (unsigned char)0xFF;
|
||||||
Vec_IntClear(&p->vObjPresUsed);
|
Vec_IntClear(&p->vObjPresUsed);
|
||||||
Vec_StrClear(&p->vObjShared);
|
|
||||||
// check present objects
|
// check present objects
|
||||||
// for ( i = 0; i < Mig_ManObjNum(p->pMig); i++ )
|
// for ( i = 0; i < Mig_ManObjNum(p->pMig); i++ )
|
||||||
// assert( p->pObjPres[i] == (unsigned char)0xFF );
|
// assert( p->pObjPres[i] == (unsigned char)0xFF );
|
||||||
@@ -380,6 +393,43 @@ static inline Mpm_Cut_t * Mpm_ManMergeCuts( Mpm_Man_t * p, Mpm_Cut_t * pCut0, Mp
|
|||||||
}
|
}
|
||||||
// Mpm_ManPrintPerm( p->uPermMask[c] ); printf( "\n" );
|
// Mpm_ManPrintPerm( p->uPermMask[c] ); printf( "\n" );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int iPlace;
|
||||||
|
// base cut
|
||||||
|
pCut->nLeaves = 0;
|
||||||
|
for ( i = 0; i < (int)pCut0->nLeaves; i++ )
|
||||||
|
pCut->pLeaves[pCut->nLeaves++] = pCut0->pLeaves[i];
|
||||||
|
// remaining cuts
|
||||||
|
for ( c = 1; c < 3; c++ )
|
||||||
|
{
|
||||||
|
pTemp = (c == 1) ? pCut1 : pCut2;
|
||||||
|
if ( pTemp == NULL )
|
||||||
|
break;
|
||||||
|
p->uPermMask[c] = 0x3FFFF; // 18 bits
|
||||||
|
p->uComplMask[c] = 0;
|
||||||
|
for ( i = 0; i < (int)pTemp->nLeaves; i++ )
|
||||||
|
{
|
||||||
|
iObj = 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 ( (int)pCut->nLeaves == p->nLutSize )
|
||||||
|
return NULL;
|
||||||
|
pCut->pLeaves[pCut->nLeaves++] = pTemp->pLeaves[i];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fDisj = 0;
|
||||||
|
p->uPermMask[c] ^= (((i & 7) ^ 7) << (3*iPlace));
|
||||||
|
assert( Abc_Lit2Var(pTemp->pLeaves[i]) == Abc_Lit2Var(pCut->pLeaves[iPlace]) );
|
||||||
|
if ( pTemp->pLeaves[i] != pCut->pLeaves[iPlace] )
|
||||||
|
p->uComplMask[c] |= (1 << iPlace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// printf( "%d", fDisj );
|
// printf( "%d", fDisj );
|
||||||
if ( pCut1 == NULL )
|
if ( pCut1 == NULL )
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user