summaryrefslogtreecommitdiffstats
path: root/src/map/if
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2014-04-04 16:38:46 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2014-04-04 16:38:46 -0700
commit6ab0d68d5653b5411c298116c9502a23a50cdbf0 (patch)
tree3f3f84327a1e81688bc06300315d128b54976949 /src/map/if
parentf6ae0e41f338a109ad2c973ace13b728f4947e14 (diff)
downloadabc-6ab0d68d5653b5411c298116c9502a23a50cdbf0.tar.gz
abc-6ab0d68d5653b5411c298116c9502a23a50cdbf0.tar.bz2
abc-6ab0d68d5653b5411c298116c9502a23a50cdbf0.zip
Tuning LUT mapping to work while saving the best network.
Diffstat (limited to 'src/map/if')
-rw-r--r--src/map/if/if.h2
-rw-r--r--src/map/if/ifCut.c4
-rw-r--r--src/map/if/ifMap.c6
-rw-r--r--src/map/if/ifTime.c11
4 files changed, 14 insertions, 9 deletions
diff --git a/src/map/if/if.h b/src/map/if/if.h
index 273119c0..7437c472 100644
--- a/src/map/if/if.h
+++ b/src/map/if/if.h
@@ -490,7 +490,7 @@ extern int If_ManPerformMapping( If_Man_t * p );
extern int If_ManPerformMappingComb( If_Man_t * p );
/*=== ifCut.c ============================================================*/
extern int If_CutVerifyCuts( If_Set_t * pCutSet, int fOrdered );
-extern int If_CutFilter( If_Set_t * pCutSet, If_Cut_t * pCut );
+extern int If_CutFilter( If_Set_t * pCutSet, If_Cut_t * pCut, int fSaveCut0 );
extern void If_CutSort( If_Man_t * p, If_Set_t * pCutSet, If_Cut_t * pCut );
extern void If_CutOrder( If_Cut_t * pCut );
extern int If_CutMergeOrdered( If_Man_t * p, If_Cut_t * pCut0, If_Cut_t * pCut1, If_Cut_t * pCut );
diff --git a/src/map/if/ifCut.c b/src/map/if/ifCut.c
index 6715f706..7fb4d028 100644
--- a/src/map/if/ifCut.c
+++ b/src/map/if/ifCut.c
@@ -143,7 +143,7 @@ static inline int If_CutCheckDominance( If_Cut_t * pDom, If_Cut_t * pCut )
SeeAlso []
***********************************************************************/
-int If_CutFilter( If_Set_t * pCutSet, If_Cut_t * pCut )
+int If_CutFilter( If_Set_t * pCutSet, If_Cut_t * pCut, int fSaveCut0 )
{
If_Cut_t * pTemp;
int i, k;
@@ -154,7 +154,7 @@ int If_CutFilter( If_Set_t * pCutSet, If_Cut_t * pCut )
if ( pTemp->nLeaves > pCut->nLeaves )
{
// do not fiter the first cut
- if ( i == 0 && pCutSet->nCuts > 1 && pCutSet->ppCuts[1]->fUseless )
+ if ( i == 0 && ((pCutSet->nCuts > 1 && pCutSet->ppCuts[1]->fUseless) || (fSaveCut0 && pCutSet->nCuts == 1)) )
continue;
// skip the non-contained cuts
if ( (pTemp->uSign & pCut->uSign) != pCut->uSign )
diff --git a/src/map/if/ifMap.c b/src/map/if/ifMap.c
index e85e8d5f..cd13ed34 100644
--- a/src/map/if/ifMap.c
+++ b/src/map/if/ifMap.c
@@ -184,7 +184,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
p->nCutsMerged++;
p->nCutsTotal++;
// check if this cut is contained in any of the available cuts
- if ( !p->pPars->fSkipCutFilter && If_CutFilter( pCutSet, pCut ) )
+ if ( !p->pPars->fSkipCutFilter && If_CutFilter( pCutSet, pCut, p->pPars->fUserRecLib || p->pPars->fDelayOpt ) )
continue;
// compute the truth table
pCut->iCutFunc = -1;
@@ -202,7 +202,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
fChange = If_CutComputeTruth( p, pCut, pCut0, pCut1, pObj->fCompl0, pObj->fCompl1 );
if ( p->pPars->fVerbose )
p->timeCache[4] += Abc_Clock() - clk;
- if ( !p->pPars->fSkipCutFilter && fChange && If_CutFilter( pCutSet, pCut ) )
+ if ( !p->pPars->fSkipCutFilter && fChange && If_CutFilter( pCutSet, pCut, p->pPars->fUserRecLib || p->pPars->fDelayOpt ) )
continue;
if ( p->pPars->fUseDsd )
{
@@ -385,7 +385,7 @@ void If_ObjPerformMappingChoice( If_Man_t * p, If_Obj_t * pObj, int Mode, int fP
// copy the cut into storage
If_CutCopy( p, pCut, pCutTemp );
// check if this cut is contained in any of the available cuts
- if ( If_CutFilter( pCutSet, pCut ) )
+ if ( If_CutFilter( pCutSet, pCut, p->pPars->fUserRecLib || p->pPars->fDelayOpt ) )
continue;
// check if the cut satisfies the required times
assert( pCut->Delay == If_CutDelay( p, pTemp, pCut ) );
diff --git a/src/map/if/ifTime.c b/src/map/if/ifTime.c
index f07b502e..7ad685b3 100644
--- a/src/map/if/ifTime.c
+++ b/src/map/if/ifTime.c
@@ -378,12 +378,17 @@ int If_CutDelaySopCost( If_Man_t * p, If_Cut_t * pCut )
}
// get the cost
If_AndClear( &Leaf );
- if ( Vec_WrdSize(vAnds) )
+ if ( Vec_WrdSize(vAnds) > 0 )
Leaf = If_WrdToAnd( Vec_WrdEntryLast(vAnds) );
- if ( pCut->nLeaves > 2 && Vec_WrdSize(vAnds) > (int)pCut->nLeaves )
- pCut->Cost = Vec_WrdSize(vAnds) - pCut->nLeaves;
else
+ Leaf.Delay = 0;
+ if ( Vec_WrdSize(vAnds) > (int)pCut->nLeaves )
+ pCut->Cost = Vec_WrdSize(vAnds) - pCut->nLeaves;
+ else if ( pCut->nLeaves == 1 )
pCut->Cost = 1;
+ else if ( pCut->nLeaves == 0 )
+ pCut->Cost = 0;
+ else assert( 0 );
// get the permutation
for ( i = 0; i < (int)pCut->nLeaves; i++ )
{