Updating features of &if mapper.

This commit is contained in:
Alan Mishchenko 2022-10-09 23:51:40 -07:00
parent 5fb4912559
commit 813a0f1ff1
7 changed files with 76 additions and 6 deletions

View File

@ -1891,7 +1891,7 @@ Gia_Man_t * Gia_ManFromIfLogic( If_Man_t * pIfMan )
if ( !pIfMan->pPars->fUseTtPerm && !pIfMan->pPars->fDelayOpt && !pIfMan->pPars->fDelayOptLut && !pIfMan->pPars->fDsdBalance &&
!pIfMan->pPars->pLutStruct && !pIfMan->pPars->fUserRecLib && !pIfMan->pPars->fUserSesLib && !pIfMan->pPars->nGateSize &&
!pIfMan->pPars->fEnableCheck75 && !pIfMan->pPars->fEnableCheck75u && !pIfMan->pPars->fEnableCheck07 && !pIfMan->pPars->fUseDsdTune &&
!pIfMan->pPars->fUseCofVars && !pIfMan->pPars->fUseAndVars )
!pIfMan->pPars->fUseCofVars && !pIfMan->pPars->fUseAndVars && !pIfMan->pPars->fUseCheck1 && !pIfMan->pPars->fUseCheck2 )
If_CutRotatePins( pIfMan, pCutBest );
// collect leaves of the best cut
Vec_IntClear( vLeaves );

View File

@ -39554,7 +39554,8 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars->fUse34Spec ^= 1;
break;
case 'b':
pPars->fUseBat ^= 1;
//pPars->fUseBat ^= 1;
pPars->fUseCheck1 ^= 1;
break;
case 'g':
pPars->fDelayOpt ^= 1;
@ -39575,7 +39576,8 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars->fEnableCheck75u ^= 1;
break;
case 'i':
pPars->fUseCofVars ^= 1;
//pPars->fUseCofVars ^= 1;
pPars->fUseCheck2 ^= 1;
break;
// case 'j':
// pPars->fEnableCheck07 ^= 1;
@ -39688,6 +39690,16 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars->pFuncCell = If_CutPerformCheck07;
pPars->fCutMin = 1;
}
if ( pPars->fUseCheck1 || pPars->fUseCheck2 )
{
if ( pPars->nLutSize > 6 )
{
Abc_Print( -1, "This feature only works for no more than 6-LUTs.\n" );
return 1;
}
pPars->pFuncCell = pPars->fUseCheck2 ? If_MatchCheck2 : If_MatchCheck1;
pPars->fCutMin = 1;
}
if ( pPars->fUseCofVars )
{
if ( !(pPars->nLutSize & 1) )

View File

@ -140,6 +140,8 @@ struct If_Par_t_
int fUseCofVars; // use cofactoring variables
int fUseAndVars; // use bi-decomposition
int fUseTtPerm; // compute truth tables of the cut functions
int fUseCheck1; // compute truth tables of the cut functions
int fUseCheck2; // compute truth tables of the cut functions
int fDeriveLuts; // enables deriving LUT structures
int fDoAverage; // optimize average rather than maximum level
int fHashMapping; // perform AIG hashing after mapping
@ -553,6 +555,8 @@ extern int If_CluCheckExt( void * p, word * pTruth, int nVars, int n
char * pLut0, char * pLut1, word * pFunc0, word * pFunc1 );
extern int If_CluCheckExt3( void * p, word * pTruth, int nVars, int nLutLeaf, int nLutLeaf2, int nLutRoot,
char * pLut0, char * pLut1, char * pLut2, word * pFunc0, word * pFunc1, word * pFunc2 );
extern int If_MatchCheck1( If_Man_t * p, unsigned * pTruth, int nVars, int nLeaves, char * pStr );
extern int If_MatchCheck2( If_Man_t * p, unsigned * pTruth, int nVars, int nLeaves, char * pStr );
/*=== ifDelay.c =============================================================*/
extern int If_CutDelaySop( If_Man_t * p, If_Cut_t * pCut );
extern int If_CutSopBalanceEvalInt( Vec_Int_t * vCover, int * pTimes, int * pFaninLits, Vec_Int_t * vAig, int * piRes, int nSuppAll, int * pArea );

View File

@ -767,7 +767,7 @@ void If_CutSort( If_Man_t * p, If_Set_t * pCutSet, If_Cut_t * pCut )
(p->pPars->fUseDsd || p->pPars->pFuncCell2 || p->pPars->fUseBat ||
p->pPars->pLutStruct || p->pPars->fUserRecLib || p->pPars->fUserSesLib ||
p->pPars->fEnableCheck07 || p->pPars->fUseCofVars || p->pPars->fUseAndVars || p->pPars->fUse34Spec ||
p->pPars->fUseDsdTune || p->pPars->fEnableCheck75 || p->pPars->fEnableCheck75u) )
p->pPars->fUseDsdTune || p->pPars->fEnableCheck75 || p->pPars->fEnableCheck75u || p->pPars->fUseCheck1 || p->pPars->fUseCheck2) )
{
If_Cut_t * pFirst = pCutSet->ppCuts[0];
if ( pFirst->fUseless || If_ManSortCompare(p, pFirst, pCut) == 1 )

View File

@ -1116,6 +1116,36 @@ int If_CutPerformCheck07( If_Man_t * p, unsigned * pTruth, int nVars, int nLeave
return 0;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int If_MatchCheck1( If_Man_t * p, unsigned * pTruth, int nVars, int nLeaves, char * pStr )
{
if ( nLeaves < nVars )
return 1;
assert( nLeaves == nVars );
if ( Abc_Tt6Check1( ((word *)pTruth)[0], nLeaves ) )
return 1;
return 0;
}
int If_MatchCheck2( If_Man_t * p, unsigned * pTruth, int nVars, int nLeaves, char * pStr )
{
if ( nLeaves < nVars )
return 1;
assert( nLeaves == nVars );
if ( Abc_Tt6Check2( ((word *)pTruth)[0], nLeaves ) )
return 1;
return 0;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////

View File

@ -167,7 +167,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
int fFunc0R, fFunc1R;
int i, k, v, iCutDsd, fChange;
int fSave0 = p->pPars->fDelayOpt || p->pPars->fDelayOptLut || p->pPars->fDsdBalance || p->pPars->fUserRecLib || p->pPars->fUserSesLib ||
p->pPars->fUseDsdTune || p->pPars->fUseCofVars || p->pPars->fUseAndVars || p->pPars->fUse34Spec || p->pPars->pLutStruct || p->pPars->pFuncCell2;
p->pPars->fUseDsdTune || p->pPars->fUseCofVars || p->pPars->fUseAndVars || p->pPars->fUse34Spec || p->pPars->pLutStruct || p->pPars->pFuncCell2 || p->pPars->fUseCheck1 || p->pPars->fUseCheck2;
int fUseAndCut = (p->pPars->nAndDelay > 0) || (p->pPars->nAndArea > 0);
assert( !If_ObjIsAnd(pObj->pFanin0) || pObj->pFanin0->pCutSet->nCuts > 0 );
assert( !If_ObjIsAnd(pObj->pFanin1) || pObj->pFanin1->pCutSet->nCuts > 0 );

View File

@ -1589,7 +1589,31 @@ static inline int Abc_Tt6SupportAndSize( word t, int nVars, int * pSuppSize )
Supp |= (1 << v), (*pSuppSize)++;
return Supp;
}
static inline int Abc_Tt6Check1( word t, int nVars )
{
int n, v, u;
for ( n = 0; n < 2; n++ )
for ( v = 0; v < nVars; v++ )
{
word Cof = n ? Abc_Tt6Cofactor1(t, v) : Abc_Tt6Cofactor0(t, v);
for ( u = 0; u < nVars; u++ )
if ( v != u && !Abc_Tt6HasVar(Cof, u) )
return 1;
}
return 0;
}
static inline int Abc_Tt6Check2( word t, int nVars )
{
int n, v;
for ( n = 0; n < 2; n++ )
for ( v = 0; v < nVars; v++ )
{
word Cof = n ? Abc_Tt6Cofactor1(t, v) : Abc_Tt6Cofactor0(t, v);
if ( Cof == 0 || ~Cof == 0 )
return 1;
}
return 0;
}
/**Function*************************************************************
Synopsis [Checks if there is a var whose both cofs have supp <= nSuppLim.]