summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/aig/gia/gia.h1
-rw-r--r--src/aig/gia/giaKf.c24
-rw-r--r--src/base/abci/abc.c8
3 files changed, 22 insertions, 11 deletions
diff --git a/src/aig/gia/gia.h b/src/aig/gia/gia.h
index c1531ca2..13bed64b 100644
--- a/src/aig/gia/gia.h
+++ b/src/aig/gia/gia.h
@@ -258,6 +258,7 @@ struct Jf_Par_t_
int fCnfObjIds;
int fAddOrCla;
int fPureAig;
+ int fCutHashing;
int fVerbose;
int fVeryVerbose;
int nLutSizeMax;
diff --git a/src/aig/gia/giaKf.c b/src/aig/gia/giaKf.c
index e44c8bcb..e1f70b71 100644
--- a/src/aig/gia/giaKf.c
+++ b/src/aig/gia/giaKf.c
@@ -144,8 +144,8 @@ static inline void Kf_SetPrepare( Kf_Set_t * p, int * pCuts0, int * pCuts1 )
{
int i;
// prepare hash table
- for ( i = 0; i <= p->TableMask; i++ )
- assert( p->pTable[i] == 0 );
+// for ( i = 0; i <= p->TableMask; i++ )
+// assert( p->pTable[i] == 0 );
// prepare cut storage
for ( i = 0; i <= p->nLutSize; i++ )
p->pList[i] = -1;
@@ -333,7 +333,7 @@ static inline void Kf_HashCleanup( Kf_Set_t * p, int iStart )
{
int i;
for ( i = iStart; i < p->nTEntries; i++ )
- p->pPlace[i] = 0;
+ p->pTable[p->pPlace[i]] = 0;
p->nTEntries = iStart;
}
@@ -398,6 +398,7 @@ static inline void Kf_SetMergePairs( Kf_Set_t * p, Kf_Cut_t * pCut0, Kf_Cut_t *
break;
if ( i < pCut1->nLeaves )
continue;
+ p->CutCount[1]++;
if ( Kf_SetRemoveDuplicates(p, p->nTEntries, pCut0->Sign | pCut1->Sign) )
continue;
// create new cut
@@ -417,6 +418,7 @@ static inline Kf_Cut_t * Kf_SetMerge( Kf_Set_t * p, int * pCuts0, int * pCuts1,
{
int c0, c1;
Kf_SetPrepare( p, pCuts0, pCuts1 );
+ p->CutCount[0] += p->nCuts0 * p->nCuts1;
for ( c0 = c1 = 0; c0 < p->nCuts0 && c1 < p->nCuts1; )
{
if ( p->pCuts0[c0].nLeaves >= p->pCuts1[c1].nLeaves )
@@ -424,8 +426,9 @@ static inline Kf_Cut_t * Kf_SetMerge( Kf_Set_t * p, int * pCuts0, int * pCuts1,
else
Kf_SetMergePairs( p, p->pCuts1 + c1++, p->pCuts0 + c0, p->nCuts0 - c0, fArea );
}
+ p->CutCount[2] += p->nCuts;
Kf_SetFilter( p );
- p->CutCount[3] += Abc_MinInt( p->nCuts, p->nCutNum );
+ p->CutCount[3] += Abc_MinInt( p->nCuts, p->nCutNum-1 );
return Kf_SetSelectBest( p, fArea, 1 );
}
@@ -619,7 +622,7 @@ static inline Kf_Cut_t * Kf_SetMerge2( Kf_Set_t * p, int * pCuts0, int * pCuts1,
}
Kf_SetFilter2( p );
p->CutCount[3] += Abc_MinInt( p->nCuts, p->nCutNum-1 );
- return Kf_SetSelectBest( p, fArea, 0 );
+ return Kf_SetSelectBest( p, fArea, 1 );
}
@@ -766,7 +769,7 @@ void Kf_ManComputeMapping( Kf_Man_t * p )
if ( p->pPars->fVerbose )
{
printf( "Aig: CI = %d CO = %d AND = %d ", Gia_ManCiNum(p->pGia), Gia_ManCoNum(p->pGia), Gia_ManAndNum(p->pGia) );
- printf( "LutSize = %d CutMax = %d Rounds = %d\n", p->pPars->nLutSize, p->pPars->nCutNum, p->pPars->nRounds );
+ printf( "LutSize = %d CutMax = %d Hash = %d\n", p->pPars->nLutSize, p->pPars->nCutNum, p->pPars->fCutHashing );
printf( "Computing cuts...\r" );
fflush( stdout );
}
@@ -781,8 +784,10 @@ void Kf_ManComputeMapping( Kf_Man_t * p )
}
else if ( Gia_ObjIsAnd(pObj) )
{
- pCutBest = Kf_SetMerge2( p->pSett, Kf_ObjCuts0(p, i), Kf_ObjCuts1(p, i), p->pPars->fAreaOnly, p->pPars->fCutMin );
-// pCutBest = Kf_SetMerge( p->pSett, Kf_ObjCuts0(p, i), Kf_ObjCuts1(p, i), p->pPars->fAreaOnly, p->pPars->fCutMin );
+ if ( p->pPars->fCutHashing )
+ pCutBest = Kf_SetMerge( p->pSett, Kf_ObjCuts0(p, i), Kf_ObjCuts1(p, i), p->pPars->fAreaOnly, p->pPars->fCutMin );
+ else
+ pCutBest = Kf_SetMerge2( p->pSett, Kf_ObjCuts0(p, i), Kf_ObjCuts1(p, i), p->pPars->fAreaOnly, p->pPars->fCutMin );
Kf_ManSaveResults( p->pSett->ppCuts, p->pSett->nCuts, pCutBest, p->vTemp );
Vec_IntWriteEntry( &p->vTime, i, pCutBest->Delay + 1 );
Vec_FltWriteEntry( &p->vArea, i, (pCutBest->Area + 1)/Kf_ObjRefs(p, i) );
@@ -926,13 +931,14 @@ void Kf_ManSetDefaultPars( Jf_Par_t * pPars )
pPars->nRounds = 1;
pPars->nVerbLimit = 5;
pPars->DelayTarget = -1;
- pPars->fAreaOnly = 1;
+ pPars->fAreaOnly = 0;
pPars->fOptEdge = 1;
pPars->fCoarsen = 0;
pPars->fCutMin = 0;
pPars->fFuncDsd = 0;
pPars->fGenCnf = 0;
pPars->fPureAig = 0;
+ pPars->fCutHashing = 0;
pPars->fVerbose = 0;
pPars->fVeryVerbose = 0;
pPars->nLutSizeMax = KF_LEAF_MAX;
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index 09a4fcc6..7b45de68 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -30369,7 +30369,7 @@ int Abc_CommandAbc9Kf( Abc_Frame_t * pAbc, int argc, char ** argv )
Gia_Man_t * pNew; int c;
Kf_ManSetDefaultPars( pPars );
Extra_UtilGetoptReset();
- while ( ( c = Extra_UtilGetopt( argc, argv, "KCRDWPaekmdcgvwh" ) ) != EOF )
+ while ( ( c = Extra_UtilGetopt( argc, argv, "KCRDWPaekmdcgtvwh" ) ) != EOF )
{
switch ( c )
{
@@ -30466,6 +30466,9 @@ int Abc_CommandAbc9Kf( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'g':
pPars->fPureAig ^= 1;
break;
+ case 't':
+ pPars->fCutHashing ^= 1;
+ break;
case 'v':
pPars->fVerbose ^= 1;
break;
@@ -30498,7 +30501,7 @@ usage:
sprintf(Buffer, "best possible" );
else
sprintf(Buffer, "%d", pPars->DelayTarget );
- Abc_Print( -2, "usage: &kf [-KCRDWP num] [-akmdcgvwh]\n" );
+ Abc_Print( -2, "usage: &kf [-KCRDWP num] [-akmdcgtvwh]\n" );
Abc_Print( -2, "\t performs technology mapping of the network\n" );
Abc_Print( -2, "\t-K num : LUT size for the mapping (2 <= K <= %d) [default = %d]\n", pPars->nLutSizeMax, pPars->nLutSize );
Abc_Print( -2, "\t-C num : the max number of priority cuts (1 <= C <= %d) [default = %d]\n", pPars->nCutNumMax, pPars->nCutNum );
@@ -30513,6 +30516,7 @@ usage:
Abc_Print( -2, "\t-d : toggles using DSD to represent cut functions [default = %s]\n", pPars->fFuncDsd? "yes": "no" );
Abc_Print( -2, "\t-c : toggles mapping for CNF generation [default = %s]\n", pPars->fGenCnf? "yes": "no" );
Abc_Print( -2, "\t-g : toggles generating AIG without mapping [default = %s]\n", pPars->fPureAig? "yes": "no" );
+ Abc_Print( -2, "\t-t : toggles cut computation using hash table [default = %s]\n", pPars->fCutHashing? "yes": "no" );
Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" );
Abc_Print( -2, "\t-w : toggles very verbose output [default = %s]\n", pPars->fVeryVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : prints the command usage\n");