Skip to content

Commit 813a0f1

Browse files
committed
Updating features of &if mapper.
1 parent 5fb4912 commit 813a0f1

7 files changed

Lines changed: 76 additions & 6 deletions

File tree

src/aig/gia/giaIf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1891,7 +1891,7 @@ Gia_Man_t * Gia_ManFromIfLogic( If_Man_t * pIfMan )
18911891
if ( !pIfMan->pPars->fUseTtPerm && !pIfMan->pPars->fDelayOpt && !pIfMan->pPars->fDelayOptLut && !pIfMan->pPars->fDsdBalance &&
18921892
!pIfMan->pPars->pLutStruct && !pIfMan->pPars->fUserRecLib && !pIfMan->pPars->fUserSesLib && !pIfMan->pPars->nGateSize &&
18931893
!pIfMan->pPars->fEnableCheck75 && !pIfMan->pPars->fEnableCheck75u && !pIfMan->pPars->fEnableCheck07 && !pIfMan->pPars->fUseDsdTune &&
1894-
!pIfMan->pPars->fUseCofVars && !pIfMan->pPars->fUseAndVars )
1894+
!pIfMan->pPars->fUseCofVars && !pIfMan->pPars->fUseAndVars && !pIfMan->pPars->fUseCheck1 && !pIfMan->pPars->fUseCheck2 )
18951895
If_CutRotatePins( pIfMan, pCutBest );
18961896
// collect leaves of the best cut
18971897
Vec_IntClear( vLeaves );

src/base/abci/abc.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39554,7 +39554,8 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv )
3955439554
pPars->fUse34Spec ^= 1;
3955539555
break;
3955639556
case 'b':
39557-
pPars->fUseBat ^= 1;
39557+
//pPars->fUseBat ^= 1;
39558+
pPars->fUseCheck1 ^= 1;
3955839559
break;
3955939560
case 'g':
3956039561
pPars->fDelayOpt ^= 1;
@@ -39575,7 +39576,8 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv )
3957539576
pPars->fEnableCheck75u ^= 1;
3957639577
break;
3957739578
case 'i':
39578-
pPars->fUseCofVars ^= 1;
39579+
//pPars->fUseCofVars ^= 1;
39580+
pPars->fUseCheck2 ^= 1;
3957939581
break;
3958039582
// case 'j':
3958139583
// pPars->fEnableCheck07 ^= 1;
@@ -39688,6 +39690,16 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv )
3968839690
pPars->pFuncCell = If_CutPerformCheck07;
3968939691
pPars->fCutMin = 1;
3969039692
}
39693+
if ( pPars->fUseCheck1 || pPars->fUseCheck2 )
39694+
{
39695+
if ( pPars->nLutSize > 6 )
39696+
{
39697+
Abc_Print( -1, "This feature only works for no more than 6-LUTs.\n" );
39698+
return 1;
39699+
}
39700+
pPars->pFuncCell = pPars->fUseCheck2 ? If_MatchCheck2 : If_MatchCheck1;
39701+
pPars->fCutMin = 1;
39702+
}
3969139703
if ( pPars->fUseCofVars )
3969239704
{
3969339705
if ( !(pPars->nLutSize & 1) )

src/map/if/if.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ struct If_Par_t_
140140
int fUseCofVars; // use cofactoring variables
141141
int fUseAndVars; // use bi-decomposition
142142
int fUseTtPerm; // compute truth tables of the cut functions
143+
int fUseCheck1; // compute truth tables of the cut functions
144+
int fUseCheck2; // compute truth tables of the cut functions
143145
int fDeriveLuts; // enables deriving LUT structures
144146
int fDoAverage; // optimize average rather than maximum level
145147
int fHashMapping; // perform AIG hashing after mapping
@@ -553,6 +555,8 @@ extern int If_CluCheckExt( void * p, word * pTruth, int nVars, int n
553555
char * pLut0, char * pLut1, word * pFunc0, word * pFunc1 );
554556
extern int If_CluCheckExt3( void * p, word * pTruth, int nVars, int nLutLeaf, int nLutLeaf2, int nLutRoot,
555557
char * pLut0, char * pLut1, char * pLut2, word * pFunc0, word * pFunc1, word * pFunc2 );
558+
extern int If_MatchCheck1( If_Man_t * p, unsigned * pTruth, int nVars, int nLeaves, char * pStr );
559+
extern int If_MatchCheck2( If_Man_t * p, unsigned * pTruth, int nVars, int nLeaves, char * pStr );
556560
/*=== ifDelay.c =============================================================*/
557561
extern int If_CutDelaySop( If_Man_t * p, If_Cut_t * pCut );
558562
extern int If_CutSopBalanceEvalInt( Vec_Int_t * vCover, int * pTimes, int * pFaninLits, Vec_Int_t * vAig, int * piRes, int nSuppAll, int * pArea );

src/map/if/ifCut.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ void If_CutSort( If_Man_t * p, If_Set_t * pCutSet, If_Cut_t * pCut )
767767
(p->pPars->fUseDsd || p->pPars->pFuncCell2 || p->pPars->fUseBat ||
768768
p->pPars->pLutStruct || p->pPars->fUserRecLib || p->pPars->fUserSesLib ||
769769
p->pPars->fEnableCheck07 || p->pPars->fUseCofVars || p->pPars->fUseAndVars || p->pPars->fUse34Spec ||
770-
p->pPars->fUseDsdTune || p->pPars->fEnableCheck75 || p->pPars->fEnableCheck75u) )
770+
p->pPars->fUseDsdTune || p->pPars->fEnableCheck75 || p->pPars->fEnableCheck75u || p->pPars->fUseCheck1 || p->pPars->fUseCheck2) )
771771
{
772772
If_Cut_t * pFirst = pCutSet->ppCuts[0];
773773
if ( pFirst->fUseless || If_ManSortCompare(p, pFirst, pCut) == 1 )

src/map/if/ifDec07.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,6 +1116,36 @@ int If_CutPerformCheck07( If_Man_t * p, unsigned * pTruth, int nVars, int nLeave
11161116
return 0;
11171117
}
11181118

1119+
/**Function*************************************************************
1120+
1121+
Synopsis []
1122+
1123+
Description []
1124+
1125+
SideEffects []
1126+
1127+
SeeAlso []
1128+
1129+
***********************************************************************/
1130+
int If_MatchCheck1( If_Man_t * p, unsigned * pTruth, int nVars, int nLeaves, char * pStr )
1131+
{
1132+
if ( nLeaves < nVars )
1133+
return 1;
1134+
assert( nLeaves == nVars );
1135+
if ( Abc_Tt6Check1( ((word *)pTruth)[0], nLeaves ) )
1136+
return 1;
1137+
return 0;
1138+
}
1139+
int If_MatchCheck2( If_Man_t * p, unsigned * pTruth, int nVars, int nLeaves, char * pStr )
1140+
{
1141+
if ( nLeaves < nVars )
1142+
return 1;
1143+
assert( nLeaves == nVars );
1144+
if ( Abc_Tt6Check2( ((word *)pTruth)[0], nLeaves ) )
1145+
return 1;
1146+
return 0;
1147+
}
1148+
11191149
////////////////////////////////////////////////////////////////////////
11201150
/// END OF FILE ///
11211151
////////////////////////////////////////////////////////////////////////

src/map/if/ifMap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
167167
int fFunc0R, fFunc1R;
168168
int i, k, v, iCutDsd, fChange;
169169
int fSave0 = p->pPars->fDelayOpt || p->pPars->fDelayOptLut || p->pPars->fDsdBalance || p->pPars->fUserRecLib || p->pPars->fUserSesLib ||
170-
p->pPars->fUseDsdTune || p->pPars->fUseCofVars || p->pPars->fUseAndVars || p->pPars->fUse34Spec || p->pPars->pLutStruct || p->pPars->pFuncCell2;
170+
p->pPars->fUseDsdTune || p->pPars->fUseCofVars || p->pPars->fUseAndVars || p->pPars->fUse34Spec || p->pPars->pLutStruct || p->pPars->pFuncCell2 || p->pPars->fUseCheck1 || p->pPars->fUseCheck2;
171171
int fUseAndCut = (p->pPars->nAndDelay > 0) || (p->pPars->nAndArea > 0);
172172
assert( !If_ObjIsAnd(pObj->pFanin0) || pObj->pFanin0->pCutSet->nCuts > 0 );
173173
assert( !If_ObjIsAnd(pObj->pFanin1) || pObj->pFanin1->pCutSet->nCuts > 0 );

src/misc/util/utilTruth.h

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1589,7 +1589,31 @@ static inline int Abc_Tt6SupportAndSize( word t, int nVars, int * pSuppSize )
15891589
Supp |= (1 << v), (*pSuppSize)++;
15901590
return Supp;
15911591
}
1592-
1592+
static inline int Abc_Tt6Check1( word t, int nVars )
1593+
{
1594+
int n, v, u;
1595+
for ( n = 0; n < 2; n++ )
1596+
for ( v = 0; v < nVars; v++ )
1597+
{
1598+
word Cof = n ? Abc_Tt6Cofactor1(t, v) : Abc_Tt6Cofactor0(t, v);
1599+
for ( u = 0; u < nVars; u++ )
1600+
if ( v != u && !Abc_Tt6HasVar(Cof, u) )
1601+
return 1;
1602+
}
1603+
return 0;
1604+
}
1605+
static inline int Abc_Tt6Check2( word t, int nVars )
1606+
{
1607+
int n, v;
1608+
for ( n = 0; n < 2; n++ )
1609+
for ( v = 0; v < nVars; v++ )
1610+
{
1611+
word Cof = n ? Abc_Tt6Cofactor1(t, v) : Abc_Tt6Cofactor0(t, v);
1612+
if ( Cof == 0 || ~Cof == 0 )
1613+
return 1;
1614+
}
1615+
return 0;
1616+
}
15931617
/**Function*************************************************************
15941618
15951619
Synopsis [Checks if there is a var whose both cofs have supp <= nSuppLim.]

0 commit comments

Comments
 (0)