summaryrefslogtreecommitdiffstats
path: root/src/map/if
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2015-06-21 13:31:02 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2015-06-21 13:31:02 -0700
commitd0d7763ef8954ff2bd74a00545c986584a7666a2 (patch)
treef6676cb7003d66cef2296c9e42ed2d81da9553f0 /src/map/if
parentffcb4afbb50ccabad96ef3f102f32417b974c5de (diff)
downloadabc-d0d7763ef8954ff2bd74a00545c986584a7666a2.tar.gz
abc-d0d7763ef8954ff2bd74a00545c986584a7666a2.tar.bz2
abc-d0d7763ef8954ff2bd74a00545c986584a7666a2.zip
Supporting AND-gate cuts in 'if' and '&if'
Diffstat (limited to 'src/map/if')
-rw-r--r--src/map/if/if.h11
-rw-r--r--src/map/if/ifMap.c5
-rw-r--r--src/map/if/ifTime.c17
3 files changed, 27 insertions, 6 deletions
diff --git a/src/map/if/if.h b/src/map/if/if.h
index 067ce0ad..8616783b 100644
--- a/src/map/if/if.h
+++ b/src/map/if/if.h
@@ -55,7 +55,7 @@ ABC_NAMESPACE_HEADER_START
// a very large number
#define IF_INFINITY 100000000
// the largest possible user cut cost
-#define IF_COST_MAX 8191 // ((1<<13)-1)
+#define IF_COST_MAX 4095 // ((1<<12)-1)
#define IF_BIG_CHAR ((char)120)
@@ -110,6 +110,8 @@ struct If_Par_t_
float Epsilon; // value used in comparison floating point numbers
int nRelaxRatio; // delay relaxation ratio
int nStructType; // type of the structure
+ int nAndDelay; // delay of AND-gate in LUT library units
+ int nAndArea; // area of AND-gate in LUT library units
int fPreprocess; // preprossing
int fArea; // area-oriented mapping
int fFancy; // a fancy feature
@@ -281,10 +283,11 @@ struct If_Cut_t_
int iCutFunc; // TT ID of the cut
int uMaskFunc; // polarity bitmask
unsigned uSign; // cut signature
- unsigned Cost : 13; // the user's cost of the cut (related to IF_COST_MAX)
+ unsigned Cost : 12; // the user's cost of the cut (related to IF_COST_MAX)
unsigned fCompl : 1; // the complemented attribute
unsigned fUser : 1; // using the user's area and delay
- unsigned fUseless: 1; // using the user's area and delay
+ unsigned fUseless: 1; // cannot be used in the mapping
+ unsigned fAndCut : 1; // matched with AND gate
unsigned nLimit : 8; // the maximum number of leaves
unsigned nLeaves : 8; // the number of leaves
int pLeaves[0];
@@ -425,7 +428,7 @@ static inline int If_CutDsdLit( If_Man_t * p, If_Cut_t * pCut ) { r
static inline int If_CutDsdIsCompl( If_Man_t * p, If_Cut_t * pCut ) { return Abc_LitIsCompl( If_CutDsdLit(p, pCut) ); }
static inline char * If_CutDsdPerm( If_Man_t * p, If_Cut_t * pCut ) { return Vec_StrEntryP( p->vTtPerms[pCut->nLeaves], Abc_Lit2Var(pCut->iCutFunc) * Abc_MaxInt(6, pCut->nLeaves) ); }
-static inline float If_CutLutArea( If_Man_t * p, If_Cut_t * pCut ) { return pCut->fUser? (float)pCut->Cost : (p->pPars->pLutLib? p->pPars->pLutLib->pLutAreas[pCut->nLeaves] : (float)1.0); }
+static inline float If_CutLutArea( If_Man_t * p, If_Cut_t * pCut ) { return pCut->fAndCut ? p->pPars->nAndArea : (pCut->fUser? (float)pCut->Cost : (p->pPars->pLutLib? p->pPars->pLutLib->pLutAreas[pCut->nLeaves] : (float)1.0)); }
static inline float If_CutLutDelay( If_LibLut_t * p, int Size, int iPin ) { return p ? (p->fVarPinDelays ? p->pLutDelays[Size][iPin] : p->pLutDelays[Size][0]) : 1.0; }
diff --git a/src/map/if/ifMap.c b/src/map/if/ifMap.c
index 89e94804..4f0372a6 100644
--- a/src/map/if/ifMap.c
+++ b/src/map/if/ifMap.c
@@ -100,6 +100,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->fUseDsdTune || p->pPars->fUseCofVars || p->pPars->fUseAndVars || p->pPars->pLutStruct != NULL;
+ 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 );
@@ -189,6 +190,10 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
// check if this cut is contained in any of the available cuts
if ( !p->pPars->fSkipCutFilter && If_CutFilter( pCutSet, pCut, fSave0 ) )
continue;
+ // check if the cut is a special AND-gate cut
+ pCut->fAndCut = fUseAndCut && pCut->nLeaves == 2 && pCut->pLeaves[0] == pObj->pFanin0->Id && pCut->pLeaves[1] == pObj->pFanin1->Id;
+ assert( pCut->nLeaves != 2 || pCut->pLeaves[0] < pCut->pLeaves[1] );
+ assert( pCut->nLeaves != 2 || pObj->pFanin0->Id < pObj->pFanin1->Id );
// compute the truth table
pCut->iCutFunc = -1;
pCut->fCompl = 0;
diff --git a/src/map/if/ifTime.c b/src/map/if/ifTime.c
index 4211b385..c2ba40e8 100644
--- a/src/map/if/ifTime.c
+++ b/src/map/if/ifTime.c
@@ -98,7 +98,15 @@ float If_CutDelay( If_Man_t * p, If_Obj_t * pObj, If_Cut_t * pCut )
float * pLutDelays;
int i, Shift, Pin2PinDelay;//, iLeaf;
Delay = -IF_FLOAT_LARGE;
- if ( p->pPars->pLutLib )
+ if ( pCut->fAndCut )
+ {
+ If_CutForEachLeaf( p, pCut, pLeaf, i )
+ {
+ DelayCur = If_ObjCutBest(pLeaf)->Delay + p->pPars->nAndDelay;
+ Delay = IF_MAX( Delay, DelayCur );
+ }
+ }
+ else if ( p->pPars->pLutLib )
{
assert( !p->pPars->fLiftLeaves );
pLutDelays = p->pPars->pLutLib->pLutDelays[pCut->nLeaves];
@@ -177,7 +185,12 @@ void If_CutPropagateRequired( If_Man_t * p, If_Obj_t * pObj, If_Cut_t * pCut, fl
int i, Pin2PinDelay;//, iLeaf;
assert( !p->pPars->fLiftLeaves );
// compute the pins
- if ( p->pPars->pLutLib )
+ if ( pCut->fAndCut )
+ {
+ If_CutForEachLeaf( p, pCut, pLeaf, i )
+ pLeaf->Required = IF_MIN( pLeaf->Required, ObjRequired - p->pPars->nAndDelay );
+ }
+ else if ( p->pPars->pLutLib )
{
pLutDelays = p->pPars->pLutLib->pLutDelays[pCut->nLeaves];
if ( p->pPars->pLutLib->fVarPinDelays )