summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2022-10-09 23:51:40 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2022-10-09 23:51:40 -0700
commit813a0f1ff1ae7512cb7947f54cd3f2ab252848c8 (patch)
treef2feba384a1cbfaa2c18c7d00c31335f2a97c73b
parent5fb4912559380dfcb55e76c23d3fa69c0da454f8 (diff)
downloadabc-813a0f1ff1ae7512cb7947f54cd3f2ab252848c8.tar.gz
abc-813a0f1ff1ae7512cb7947f54cd3f2ab252848c8.tar.bz2
abc-813a0f1ff1ae7512cb7947f54cd3f2ab252848c8.zip
Updating features of &if mapper.
-rw-r--r--src/aig/gia/giaIf.c2
-rw-r--r--src/base/abci/abc.c16
-rw-r--r--src/map/if/if.h4
-rw-r--r--src/map/if/ifCut.c2
-rw-r--r--src/map/if/ifDec07.c30
-rw-r--r--src/map/if/ifMap.c2
-rw-r--r--src/misc/util/utilTruth.h26
7 files changed, 76 insertions, 6 deletions
diff --git a/src/aig/gia/giaIf.c b/src/aig/gia/giaIf.c
index ae87277a..8b4e5b12 100644
--- a/src/aig/gia/giaIf.c
+++ b/src/aig/gia/giaIf.c
@@ -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 );
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index cddf0b51..a65b37e2 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -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) )
diff --git a/src/map/if/if.h b/src/map/if/if.h
index 13fa4108..a72da9b9 100644
--- a/src/map/if/if.h
+++ b/src/map/if/if.h
@@ -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 );
diff --git a/src/map/if/ifCut.c b/src/map/if/ifCut.c
index 079781e0..e3d47f1c 100644
--- a/src/map/if/ifCut.c
+++ b/src/map/if/ifCut.c
@@ -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 )
diff --git a/src/map/if/ifDec07.c b/src/map/if/ifDec07.c
index 1f3fea3e..b8851e50 100644
--- a/src/map/if/ifDec07.c
+++ b/src/map/if/ifDec07.c
@@ -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 ///
////////////////////////////////////////////////////////////////////////
diff --git a/src/map/if/ifMap.c b/src/map/if/ifMap.c
index f234d354..b3a4caf6 100644
--- a/src/map/if/ifMap.c
+++ b/src/map/if/ifMap.c
@@ -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 );
diff --git a/src/misc/util/utilTruth.h b/src/misc/util/utilTruth.h
index bc8ac3f0..1a771afa 100644
--- a/src/misc/util/utilTruth.h
+++ b/src/misc/util/utilTruth.h
@@ -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.]