summaryrefslogtreecommitdiffstats
path: root/src/map/mpm/mpmInt.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/mpm/mpmInt.h')
-rw-r--r--src/map/mpm/mpmInt.h49
1 files changed, 31 insertions, 18 deletions
diff --git a/src/map/mpm/mpmInt.h b/src/map/mpm/mpmInt.h
index bb235833..307d5d26 100644
--- a/src/map/mpm/mpmInt.h
+++ b/src/map/mpm/mpmInt.h
@@ -33,6 +33,7 @@
//#include "misc/tim/tim.h"
#include "misc/vec/vec.h"
+#include "misc/vec/vecMem.h"
#include "misc/mem/mem2.h"
#include "mpmMig.h"
#include "mpm.h"
@@ -58,30 +59,23 @@ typedef struct Mpm_Cut_t_ Mpm_Cut_t; // 8 bytes + NLeaves * 4 bytes
struct Mpm_Cut_t_
{
int hNext; // next cut
- unsigned iFunc : 26; // function
+ unsigned iFunc : 25; // function
+ unsigned fCompl : 1;
unsigned fUseless : 1; // internal flag
unsigned nLeaves : 5; // leaves
int pLeaves[0]; // leaves
};
-
-typedef struct Mpm_Inf_t_ Mpm_Inf_t; // 32 bytes
-struct Mpm_Inf_t_
-{
- int hCut; // cut handle
- unsigned nLeaves : 6; // the number of leaves
- unsigned mCost : 26; // area cost of this cut
+typedef struct Mpm_Uni_t_ Mpm_Uni_t; // 48 bytes
+struct Mpm_Uni_t_
+{
int mTime; // arrival time
int mArea; // area (flow)
int mEdge; // edge (flow)
int mAveRefs; // area references
word uSign; // cut signature
-};
-
-typedef struct Mpm_Uni_t_ Mpm_Uni_t; // 48 bytes
-struct Mpm_Uni_t_
-{
- Mpm_Inf_t Inf; // information
- unsigned iFunc : 26; // function
+ int Cost; // user cost
+ unsigned iFunc : 25; // function
+ unsigned fCompl : 1;
unsigned fUseless : 1; // internal flag
unsigned nLeaves : 5; // leaves
int pLeaves[MPM_VAR_MAX]; // leaves
@@ -91,9 +85,11 @@ typedef struct Mpm_Man_t_ Mpm_Man_t;
struct Mpm_Man_t_
{
Mig_Man_t * pMig; // AIG manager
+ Mpm_Par_t * pPars; // mapping parameters
// mapping parameters
int nLutSize; // LUT size
int nNumCuts; // cut count
+ int nTruWords; // words in the truth table
Mpm_LibLut_t * pLibLut; // LUT library
// mapping attributes
int GloRequired; // global arrival time
@@ -110,10 +106,13 @@ struct Mpm_Man_t_
Vec_Ptr_t * vTemp; // storage for cuts
// object presence
unsigned char * pObjPres; // object presence
+ int pObjPresUsed[MPM_VAR_MAX];
+ int nObjPresUsed;
+
Mpm_Cut_t * pCutTemp; // temporary cut
Vec_Str_t vObjShared; // object presence
// cut comparison
- int (* pCutCmp) (Mpm_Inf_t *, Mpm_Inf_t *);// procedure to compare cuts
+ int (* pCutCmp) (Mpm_Uni_t *, Mpm_Uni_t *);// procedure to compare cuts
// fanin cuts/signatures
int nCuts[3]; // fanin cut counts
Mpm_Cut_t * pCuts[3][MPM_CUT_MAX+1]; // fanin cuts
@@ -122,6 +121,10 @@ struct Mpm_Man_t_
// Dsd_Man_t * pManDsd;
void * pManDsd;
int pPerm[MPM_VAR_MAX];
+ Vec_Mem_t * vTtMem; // truth table memory and hash table
+ int funcCst0; // constant 0
+ int funcVar0; // variable 0
+ unsigned uPermMask[3];
// mapping attributes
Vec_Int_t vCutBests; // cut best
Vec_Int_t vCutLists; // cut list
@@ -134,6 +137,7 @@ struct Mpm_Man_t_
Vec_Int_t vEdges; // edge
// statistics
int nCutsMerged;
+ int nSmallSupp;
abctime timeFanin;
abctime timeDerive;
abctime timeMerge;
@@ -151,7 +155,7 @@ struct Mpm_Man_t_
static inline int Mpm_ObjCutBest( Mpm_Man_t * p, Mig_Obj_t * pObj ) { return Vec_IntEntry(&p->vCutBests, Mig_ObjId(pObj)); }
static inline void Mpm_ObjSetCutBest( Mpm_Man_t * p, Mig_Obj_t * pObj, int i ) { Vec_IntWriteEntry(&p->vCutBests, Mig_ObjId(pObj), i); }
-static inline int Mpm_CutWordNum( int nLeaves ) { return (sizeof(Mpm_Cut_t)/sizeof(int) + nLeaves + 1) >> 1; }
+static inline int Mpm_CutWordNum( int nLeaves ) { return ((sizeof(Mpm_Cut_t)/sizeof(int) + nLeaves + 1) >> 1); }
static inline Mpm_Cut_t * Mpm_CutFetch( Mpm_Man_t * p, int h ) { Mpm_Cut_t * pCut = (Mpm_Cut_t *)Mmr_StepEntry( p->pManCuts, h ); assert( Mpm_CutWordNum(pCut->nLeaves) == (h & p->pManCuts->uMask) ); return pCut; }
static inline Mpm_Cut_t * Mpm_ObjCutBestP( Mpm_Man_t * p, Mig_Obj_t * pObj ) { return Mpm_CutFetch( p, Mpm_ObjCutBest(p, pObj) ); }
@@ -159,6 +163,9 @@ static inline int Mpm_ObjCutList( Mpm_Man_t * p, Mig_Obj_t * pObj )
static inline int * Mpm_ObjCutListP( Mpm_Man_t * p, Mig_Obj_t * pObj ) { return Vec_IntEntryP(&p->vCutLists, Mig_ObjId(pObj)); }
static inline void Mpm_ObjSetCutList( Mpm_Man_t * p, Mig_Obj_t * pObj, int i ) { Vec_IntWriteEntry(&p->vCutLists, Mig_ObjId(pObj), i); }
+static inline int Mpm_CutLeafNum( Mpm_Cut_t * pCut ) { return pCut->nLeaves; }
+static inline word * Mpm_CutTruth( Mpm_Man_t * p, int iFunc ) { return Vec_MemReadEntry(p->vTtMem, iFunc); }
+
static inline void Mpm_ManSetMigRefs( Mpm_Man_t * p ) { assert( Vec_IntSize(&p->vMigRefs) == Vec_IntSize(&p->pMig->vRefs) ); memcpy( Vec_IntArray(&p->vMigRefs), Vec_IntArray(&p->pMig->vRefs), sizeof(int) * Mig_ManObjNum(p->pMig) ); }
static inline int Mig_ObjMigRefNum( Mpm_Man_t * p, Mig_Obj_t * pObj ) { return Vec_IntEntry(&p->vMigRefs, Mig_ObjId(pObj)); }
static inline int Mig_ObjMigRefDec( Mpm_Man_t * p, Mig_Obj_t * pObj ) { return Vec_IntAddToEntry(&p->vMigRefs, Mig_ObjId(pObj), -1); }
@@ -183,6 +190,9 @@ static inline void Mpm_ObjSetArea( Mpm_Man_t * p, Mig_Obj_t * pObj, int i
static inline int Mpm_ObjEdge( Mpm_Man_t * p, Mig_Obj_t * pObj ) { return Vec_IntEntry(&p->vEdges, Mig_ObjId(pObj)); }
static inline void Mpm_ObjSetEdge( Mpm_Man_t * p, Mig_Obj_t * pObj, int i ) { Vec_IntWriteEntry(&p->vEdges, Mig_ObjId(pObj), i); }
+static inline void Mpm_VarsClear( int * V2P, int * P2V, int nVars ) { int i; for ( i = 0; i < nVars; i++ ) V2P[i] = P2V[i] = i; }
+static inline void Mpm_VarsSwap( int * V2P, int * P2V, int iVar, int jVar ) { V2P[P2V[iVar]] = jVar; V2P[P2V[jVar]] = iVar; P2V[iVar] ^= P2V[jVar]; P2V[jVar] ^= P2V[iVar]; P2V[iVar] ^= P2V[jVar]; }
+
// iterators over object cuts
#define Mpm_ObjForEachCut( p, pObj, hCut, pCut ) \
for ( hCut = Mpm_ObjCutList(p, pObj); hCut && (pCut = Mpm_CutFetch(p, hCut)); hCut = pCut->hNext )
@@ -203,7 +213,7 @@ static inline void Mpm_ObjSetEdge( Mpm_Man_t * p, Mig_Obj_t * pObj, int i
extern Mig_Man_t * Mig_ManCreate( void * pGia );
extern void * Mpm_ManFromIfLogic( Mpm_Man_t * pMan );
/*=== mpmCore.c ===========================================================*/
-extern Mpm_Man_t * Mpm_ManStart( Mig_Man_t * pMig, Mpm_LibLut_t * pLib, int nNumCuts );
+extern Mpm_Man_t * Mpm_ManStart( Mig_Man_t * pMig, Mpm_Par_t * pPars );
extern void Mpm_ManStop( Mpm_Man_t * p );
extern void Mpm_ManPrintStatsInit( Mpm_Man_t * p );
extern void Mpm_ManPrintStats( Mpm_Man_t * p );
@@ -214,6 +224,9 @@ extern void Mpm_LibLutFree( Mpm_LibLut_t * pLib );
/*=== mpmMap.c ===========================================================*/
extern void Mpm_ManPrepare( Mpm_Man_t * p );
extern void Mpm_ManPerform( Mpm_Man_t * p );
+/*=== mpmTruth.c ===========================================================*/
+extern int Mpm_CutComputeTruth6( Mpm_Man_t * p, Mpm_Cut_t * pCut, Mpm_Cut_t * pCut0, Mpm_Cut_t * pCut1, Mpm_Cut_t * pCutC, int fCompl0, int fCompl1, int fComplC, int Type );
+
ABC_NAMESPACE_HEADER_END