abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
mpmInt.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "misc/mem/mem2.h"
#include "misc/vec/vec.h"
#include "misc/vec/vecMem.h"
#include "misc/vec/vecHsh.h"
#include "misc/vec/vecWec.h"
#include "misc/util/utilTruth.h"
#include "mpmMig.h"
#include "mpm.h"

Go to the source code of this file.

Data Structures

struct  Mpm_Cut_t_
 
struct  Mpm_Uni_t_
 
struct  Mpm_Dsd_t_
 
struct  Mpm_Man_t_
 

Macros

#define MPM_CUT_MAX   32
 INCLUDES ///. More...
 
#define MPM_UNIT_TIME   1
 
#define MPM_UNIT_AREA   20
 
#define MPM_UNIT_EDGE   50
 
#define MPM_UNIT_REFS   100
 
#define Mpm_ObjForEachCut(p, pObj, hCut, pCut)   for ( hCut = Mpm_ObjCutList(p, pObj); hCut && (pCut = Mpm_CutFetch(p, hCut)); hCut = pCut->hNext )
 
#define Mpm_ObjForEachCutSafe(p, pObj, hCut, pCut, hNext)   for ( hCut = Mpm_ObjCutList(p, pObj); hCut && (pCut = Mpm_CutFetch(p, hCut)) && ((hNext = pCut->hNext), 1); hCut = hNext )
 
#define Mpm_CutForEachLeafId(pCut, iLeafId, i)   for ( i = 0; i < (int)pCut->nLeaves && ((iLeafId = Abc_Lit2Var(pCut->pLeaves[i])), 1); i++ )
 
#define Mpm_CutForEachLeafLit(pCut, iLeafLit, i)   for ( i = 0; i < (int)pCut->nLeaves && ((iLeafLit = pCut->pLeaves[i]), 1); i++ )
 
#define Mpm_CutForEachLeaf(p, pCut, pLeaf, i)   for ( i = 0; i < (int)pCut->nLeaves && (pLeaf = Mig_ManObj(p, Abc_Lit2Var(pCut->pLeaves[i]))); i++ )
 

Typedefs

typedef struct Mpm_Cut_t_ Mpm_Cut_t
 BASIC TYPES ///. More...
 
typedef struct Mpm_Uni_t_ Mpm_Uni_t
 
typedef struct Mpm_Dsd_t_ Mpm_Dsd_t
 
typedef struct Mpm_Man_t_ Mpm_Man_t
 

Functions

static int Mpm_ObjCutBest (Mpm_Man_t *p, Mig_Obj_t *pObj)
 MACRO DEFINITIONS ///. More...
 
static void Mpm_ObjSetCutBest (Mpm_Man_t *p, Mig_Obj_t *pObj, int i)
 
static int Mpm_CutWordNum (int nLeaves)
 
static Mpm_Cut_tMpm_CutFetch (Mpm_Man_t *p, int h)
 
static Mpm_Cut_tMpm_ObjCutBestP (Mpm_Man_t *p, Mig_Obj_t *pObj)
 
static int Mpm_ObjCutList (Mpm_Man_t *p, Mig_Obj_t *pObj)
 
static int * Mpm_ObjCutListP (Mpm_Man_t *p, Mig_Obj_t *pObj)
 
static void Mpm_ObjSetCutList (Mpm_Man_t *p, Mig_Obj_t *pObj, int i)
 
static int Mpm_CutLeafNum (Mpm_Cut_t *pCut)
 
static wordMpm_CutTruth (Mpm_Man_t *p, int iFunc)
 
static int Mig_ObjMigRefNum (Mpm_Man_t *p, Mig_Obj_t *pObj)
 
static int Mig_ObjMigRefDec (Mpm_Man_t *p, Mig_Obj_t *pObj)
 
static void Mpm_ManCleanMapRefs (Mpm_Man_t *p)
 
static int Mpm_ObjMapRef (Mpm_Man_t *p, Mig_Obj_t *pObj)
 
static void Mpm_ObjSetMapRef (Mpm_Man_t *p, Mig_Obj_t *pObj, int i)
 
static int Mpm_ObjEstRef (Mpm_Man_t *p, Mig_Obj_t *pObj)
 
static void Mpm_ObjSetEstRef (Mpm_Man_t *p, Mig_Obj_t *pObj, int i)
 
static void Mpm_ManCleanRequired (Mpm_Man_t *p)
 
static int Mpm_ObjRequired (Mpm_Man_t *p, Mig_Obj_t *pObj)
 
static void Mpm_ObjSetRequired (Mpm_Man_t *p, Mig_Obj_t *pObj, int i)
 
static int Mpm_ObjTime (Mpm_Man_t *p, Mig_Obj_t *pObj)
 
static void Mpm_ObjSetTime (Mpm_Man_t *p, Mig_Obj_t *pObj, int i)
 
static int Mpm_ObjArea (Mpm_Man_t *p, Mig_Obj_t *pObj)
 
static void Mpm_ObjSetArea (Mpm_Man_t *p, Mig_Obj_t *pObj, int i)
 
static int Mpm_ObjEdge (Mpm_Man_t *p, Mig_Obj_t *pObj)
 
static void Mpm_ObjSetEdge (Mpm_Man_t *p, Mig_Obj_t *pObj, int i)
 
static void Mpm_VarsClear (int *V2P, int *P2V, int nVars)
 
static void Mpm_VarsSwap (int *V2P, int *P2V, int iVar, int jVar)
 
Mig_Man_tMig_ManCreate (void *pGia)
 FUNCTION DECLARATIONS ///. More...
 
void * Mpm_ManFromIfLogic (Mpm_Man_t *pMan)
 
Mpm_Man_tMpm_ManStart (Mig_Man_t *pMig, Mpm_Par_t *pPars)
 DECLARATIONS ///. More...
 
void Mpm_ManStop (Mpm_Man_t *p)
 
void Mpm_ManPrintStatsInit (Mpm_Man_t *p)
 
void Mpm_ManPrintStats (Mpm_Man_t *p)
 
void Mpm_ManPrintDsdStats (Mpm_Man_t *p)
 
void Mpm_ManPrintPerm (unsigned s)
 
void Mpm_ManPrecomputePerms (Mpm_Man_t *p)
 
word Mpm_CutTruthFromDsd (Mpm_Man_t *pMan, Mpm_Cut_t *pCut, int iDsdLit)
 
int Mpm_CutCheckDsd6 (Mpm_Man_t *p, word t)
 
int Mpm_CutComputeDsd6 (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)
 
Vec_Wec_tMpm_ManFindDsdMatches (Mpm_Man_t *p, void *pScl)
 DECLARATIONS ///. More...
 
Mpm_LibLut_tMpm_LibLutSetSimple (int nLutSize)
 DECLARATIONS ///. More...
 
void Mpm_LibLutFree (Mpm_LibLut_t *pLib)
 
void Mpm_CutPrint (Mpm_Cut_t *pCut)
 
void Mpm_ManPrepare (Mpm_Man_t *p)
 
void Mpm_ManPerform (Mpm_Man_t *p)
 
int Mpm_CutComputeTruth (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)
 
void Kit_DsdPrintFromTruth (unsigned *pTruth, int nVars)
 

Macro Definition Documentation

#define MPM_CUT_MAX   32

INCLUDES ///.

CFile****************************************************************

FileName [mpmInt.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Configurable technology mapper.]

Synopsis [Interal declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 1, 2013.]

Revision [

Id:
mpmInt.h,v 1.00 2013/06/01 00:00:00 alanmi Exp

]PARAMETERS ///

Definition at line 50 of file mpmInt.h.

#define Mpm_CutForEachLeaf (   p,
  pCut,
  pLeaf,
 
)    for ( i = 0; i < (int)pCut->nLeaves && (pLeaf = Mig_ManObj(p, Abc_Lit2Var(pCut->pLeaves[i]))); i++ )

Definition at line 222 of file mpmInt.h.

#define Mpm_CutForEachLeafId (   pCut,
  iLeafId,
 
)    for ( i = 0; i < (int)pCut->nLeaves && ((iLeafId = Abc_Lit2Var(pCut->pLeaves[i])), 1); i++ )

Definition at line 218 of file mpmInt.h.

#define Mpm_CutForEachLeafLit (   pCut,
  iLeafLit,
 
)    for ( i = 0; i < (int)pCut->nLeaves && ((iLeafLit = pCut->pLeaves[i]), 1); i++ )

Definition at line 220 of file mpmInt.h.

#define Mpm_ObjForEachCut (   p,
  pObj,
  hCut,
  pCut 
)    for ( hCut = Mpm_ObjCutList(p, pObj); hCut && (pCut = Mpm_CutFetch(p, hCut)); hCut = pCut->hNext )

Definition at line 212 of file mpmInt.h.

#define Mpm_ObjForEachCutSafe (   p,
  pObj,
  hCut,
  pCut,
  hNext 
)    for ( hCut = Mpm_ObjCutList(p, pObj); hCut && (pCut = Mpm_CutFetch(p, hCut)) && ((hNext = pCut->hNext), 1); hCut = hNext )

Definition at line 214 of file mpmInt.h.

#define MPM_UNIT_AREA   20

Definition at line 53 of file mpmInt.h.

#define MPM_UNIT_EDGE   50

Definition at line 54 of file mpmInt.h.

#define MPM_UNIT_REFS   100

Definition at line 55 of file mpmInt.h.

#define MPM_UNIT_TIME   1

Definition at line 52 of file mpmInt.h.

Typedef Documentation

typedef struct Mpm_Cut_t_ Mpm_Cut_t

BASIC TYPES ///.

Definition at line 61 of file mpmInt.h.

typedef struct Mpm_Dsd_t_ Mpm_Dsd_t

Definition at line 84 of file mpmInt.h.

typedef struct Mpm_Man_t_ Mpm_Man_t

Definition at line 94 of file mpmInt.h.

typedef struct Mpm_Uni_t_ Mpm_Uni_t

Definition at line 71 of file mpmInt.h.

Function Documentation

void Kit_DsdPrintFromTruth ( unsigned *  pTruth,
int  nVars 
)

Function*************************************************************

Synopsis [Print the DSD formula.]

Description []

SideEffects []

SeeAlso []

Definition at line 490 of file kitDsd.c.

491 {
492  Kit_DsdNtk_t * pTemp, * pTemp2;
493 // pTemp = Kit_DsdDecomposeMux( pTruth, nVars, 5 );
494  pTemp = Kit_DsdDecomposeMux( pTruth, nVars, 8 );
495 // Kit_DsdPrintExpanded( pTemp );
496  pTemp2 = Kit_DsdExpand( pTemp );
497  Kit_DsdPrint( stdout, pTemp2 );
498  Kit_DsdVerify( pTemp2, pTruth, nVars );
499  Kit_DsdNtkFree( pTemp2 );
500  Kit_DsdNtkFree( pTemp );
501 }
Kit_DsdNtk_t * Kit_DsdExpand(Kit_DsdNtk_t *p)
Definition: kitDsd.c:1451
void Kit_DsdVerify(Kit_DsdNtk_t *pNtk, unsigned *pTruth, int nVars)
Definition: kitDsd.c:2492
void Kit_DsdPrint(FILE *pFile, Kit_DsdNtk_t *pNtk)
Definition: kitDsd.c:374
void Kit_DsdNtkFree(Kit_DsdNtk_t *pNtk)
Definition: kitDsd.c:163
Kit_DsdNtk_t * Kit_DsdDecomposeMux(unsigned *pTruth, int nVars, int nDecMux)
Definition: kitDsd.c:2350
Mig_Man_t* Mig_ManCreate ( void *  pGia)

FUNCTION DECLARATIONS ///.

Definition at line 83 of file mpmAbc.c.

84 {
85  Gia_Man_t * p = (Gia_Man_t *)pGia;
86  Mig_Man_t * pNew;
87  Gia_Obj_t * pObj;
88  int i;
89  pNew = Mig_ManStart();
90  pNew->pName = Abc_UtilStrsav( p->pName );
91  Gia_ManConst0(p)->Value = 0;
92  Gia_ManForEachObj1( p, pObj, i )
93  {
94  if ( Gia_ObjIsMuxId(p, i) )
95  pObj->Value = Mig_ManAppendMux( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj), Gia_ObjFanin2Copy(p, pObj) );
96  else if ( Gia_ObjIsXor(pObj) )
97  pObj->Value = Mig_ManAppendXor( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
98  else if ( Gia_ObjIsAnd(pObj) )
99  pObj->Value = Mig_ManAppendAnd( pNew, Mig_ObjFanin0Copy(pObj), Mig_ObjFanin1Copy(pObj) );
100  else if ( Gia_ObjIsCi(pObj) )
101  pObj->Value = Mig_ManAppendCi( pNew );
102  else if ( Gia_ObjIsCo(pObj) )
103  pObj->Value = Mig_ManAppendCo( pNew, Mig_ObjFanin0Copy(pObj) );
104  else assert( 0 );
105  }
106  Mig_ManSetRegNum( pNew, Gia_ManRegNum(p) );
107  if ( Gia_ManHasChoices(p) )
108  Mig_ManCreateChoices( pNew, p );
109  return pNew;
110 }
static int Gia_ObjFanin2Copy(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:483
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Mig_ManAppendXor(Mig_Man_t *p, int iLit0, int iLit1)
Definition: mpmMig.h:270
static int Mig_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: mpmAbc.c:82
static int Mig_ManAppendCo(Mig_Man_t *p, int iLit0)
Definition: mpmMig.h:245
Definition: gia.h:75
static int Gia_ManHasChoices(Gia_Man_t *p)
Definition: gia.h:397
static int Gia_ObjIsMuxId(Gia_Man_t *p, int iObj)
Definition: gia.h:424
char * pName
Definition: gia.h:97
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
static void Mig_ManSetRegNum(Mig_Man_t *p, int v)
Definition: mpmMig.h:113
static int Gia_ObjIsXor(Gia_Obj_t *pObj)
Definition: gia.h:423
ABC_NAMESPACE_IMPL_START void Mig_ManCreateChoices(Mig_Man_t *pMig, Gia_Man_t *p)
DECLARATIONS ///.
Definition: mpmAbc.c:46
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
char * pName
Definition: mpmMig.h:63
static int Mig_ManAppendMux(Mig_Man_t *p, int iLit0, int iLit1, int iCtrl)
Definition: mpmMig.h:279
Definition: gia.h:95
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
static int Mig_ManAppendAnd(Mig_Man_t *p, int iLit0, int iLit1)
Definition: mpmMig.h:262
ABC_NAMESPACE_IMPL_START Mig_Man_t * Mig_ManStart()
DECLARATIONS ///.
Definition: mpmMig.c:45
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
#define Gia_ManForEachObj1(p, pObj, i)
Definition: gia.h:986
static int Mig_ManAppendCi(Mig_Man_t *p)
Definition: mpmMig.h:238
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Mig_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: mpmAbc.c:81
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
static int Mig_ObjMigRefDec ( Mpm_Man_t p,
Mig_Obj_t pObj 
)
inlinestatic

Definition at line 186 of file mpmInt.h.

186 { return Vec_IntAddToEntry(&p->vMigRefs, Mig_ObjId(pObj), -1); }
static int Mig_ObjId(Mig_Obj_t *p)
Definition: mpmMig.h:146
static void Vec_IntAddToEntry(Vec_Int_t *p, int i, int Addition)
Definition: bblif.c:302
Vec_Int_t vMigRefs
Definition: mpmInt.h:144
static int Mig_ObjMigRefNum ( Mpm_Man_t p,
Mig_Obj_t pObj 
)
inlinestatic

Definition at line 185 of file mpmInt.h.

185 { return Vec_IntEntry(&p->vMigRefs, Mig_ObjId(pObj)); }
static int Mig_ObjId(Mig_Obj_t *p)
Definition: mpmMig.h:146
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t vMigRefs
Definition: mpmInt.h:144
int Mpm_CutCheckDsd6 ( Mpm_Man_t p,
word  t 
)

Function*************************************************************

Synopsis [Checks hash table for DSD class.]

Description []

SideEffects []

SeeAlso []

Definition at line 905 of file mpmDsd.c.

906 {
907  int fCompl, Entry, Config;
908  if ( (fCompl = (t & 1)) )
909  t = ~t;
910  Entry = *Hsh_IntManLookup( p->pHash, (unsigned *)&t );
911  if ( Entry == -1 )
912  return -1;
913  Config = Vec_IntEntry( p->vConfgRes, Entry );
914  if ( fCompl )
915  Config ^= (1 << 16);
916  return Config;
917 }
static int * Hsh_IntManLookup(Hsh_IntMan_t *p, unsigned *pData)
Definition: vecHsh.h:147
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Hsh_IntMan_t * pHash
Definition: mpmInt.h:133
Vec_Int_t * vConfgRes
Definition: mpmInt.h:134
int Mpm_CutComputeDsd6 ( 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 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 930 of file mpmDsd.c.

931 {
932  int fVerbose = 0;
933  int i, Config, iClass, fCompl;
934  int pLeavesNew[6] = { -1, -1, -1, -1, -1, -1 };
935  word t = 0;
936  if ( pCutC == NULL )
937  {
938  word t0, t1;
939  int iClass0 = Abc_Lit2Var(pCut0->iFunc);
940  int iClass1 = Abc_Lit2Var(pCut1->iFunc);
941  word Truth0 = p->pDsd6[iClass0].uTruth;
942  int Perm1 = Vec_IntEntry( p->vMap2Perm, p->uPermMask[1] );
943  word Truth1p = Vec_WrdEntry( p->vPerm6, iClass1 * 720 + Perm1 );
944  if ( p->uComplMask[1] )
945  {
946  for ( i = 0; i < 6; i++ )
947  if ( (p->uComplMask[1] >> i) & 1 )
948  Truth1p = Abc_Tt6Flip( Truth1p, i );
949  }
950  t0 = (fCompl0 ^ pCut0->fCompl ^ Abc_LitIsCompl(pCut0->iFunc)) ? ~Truth0 : Truth0;
951  t1 = (fCompl1 ^ pCut1->fCompl ^ Abc_LitIsCompl(pCut1->iFunc)) ? ~Truth1p : Truth1p;
952  if ( Type == 1 )
953  t = t0 & t1;
954  else if ( Type == 2 )
955  t = t0 ^ t1;
956  else assert( 0 );
957 
958 if ( fVerbose )
959 {
960 Mpm_ManPrintPerm( p->uPermMask[1] ); printf( "\n" );
961 Kit_DsdPrintFromTruth( (unsigned *)&Truth0, 6 ); printf( "\n" );
962 Kit_DsdPrintFromTruth( (unsigned *)&Truth1p, 6 ); printf( "\n" );
963 Kit_DsdPrintFromTruth( (unsigned *)&t, 6 ); printf( "\n" );
964 }
965  }
966  else
967  {
968  word t0, t1, tC;
969  int iClass0 = Abc_Lit2Var(pCut0->iFunc);
970  int iClass1 = Abc_Lit2Var(pCut1->iFunc);
971  int iClassC = Abc_Lit2Var(pCutC->iFunc);
972  word Truth0 = p->pDsd6[iClass0].uTruth;
973  int Perm1 = Vec_IntEntry( p->vMap2Perm, p->uPermMask[1] );
974  int PermC = Vec_IntEntry( p->vMap2Perm, p->uPermMask[2] );
975  word Truth1p = Vec_WrdEntry( p->vPerm6, iClass1 * 720 + Perm1 );
976  word TruthCp = Vec_WrdEntry( p->vPerm6, iClassC * 720 + PermC );
977  if ( p->uComplMask[1] )
978  {
979  for ( i = 0; i < 6; i++ )
980  if ( (p->uComplMask[1] >> i) & 1 )
981  Truth1p = Abc_Tt6Flip( Truth1p, i );
982  }
983  if ( p->uComplMask[2] )
984  {
985  for ( i = 0; i < 6; i++ )
986  if ( (p->uComplMask[2] >> i) & 1 )
987  TruthCp = Abc_Tt6Flip( TruthCp, i );
988  }
989  t0 = (fCompl0 ^ pCut0->fCompl ^ Abc_LitIsCompl(pCut0->iFunc)) ? ~Truth0 : Truth0;
990  t1 = (fCompl1 ^ pCut1->fCompl ^ Abc_LitIsCompl(pCut1->iFunc)) ? ~Truth1p : Truth1p;
991  tC = (fComplC ^ pCutC->fCompl ^ Abc_LitIsCompl(pCutC->iFunc)) ? ~TruthCp : TruthCp;
992  t = (tC & t1) | (~tC & t0);
993  }
994 
995  // find configuration
996  Config = Mpm_CutCheckDsd6( p, t );
997  if ( Config == -1 )
998  {
999  p->nNonDsd++;
1000  return 0;
1001  }
1002 
1003  // get the class
1004  iClass = Config >> 17;
1005  fCompl = (Config >> 16) & 1;
1006  Config &= 0xFFFF;
1007 
1008  // check if the gate exists
1009  if ( p->pPars->fMap4Gates )
1010  {
1011  if ( Vec_IntSize(Vec_WecEntry(p->vNpnConfigs, iClass)) == 0 )
1012  {
1013  p->nNoMatch++;
1014  return 0;
1015  }
1016  }
1017 
1018  // set the function
1019  pCut->iFunc = Abc_Var2Lit( iClass, fCompl );
1020 
1021 if ( fVerbose )
1022 {
1023 Mpm_CutPrint( pCut0 );
1024 Mpm_CutPrint( pCut1 );
1025 Mpm_CutPrint( pCut );
1026 }
1027 
1028  // update cut
1029  assert( (Config >> 6) < 720 );
1030  for ( i = 0; i < (int)pCut->nLeaves; i++ )
1031  pLeavesNew[(int)(p->Perm6[Config >> 6][i])] = Abc_LitNotCond( pCut->pLeaves[i], (Config >> i) & 1 );
1032  pCut->nLeaves = p->pDsd6[iClass].nVars;
1033  for ( i = 0; i < (int)pCut->nLeaves; i++ )
1034  assert( pLeavesNew[i] != -1 );
1035  for ( i = 0; i < (int)pCut->nLeaves; i++ )
1036  pCut->pLeaves[i] = pLeavesNew[i];
1037  p->nCountDsd[iClass]++;
1038  p->nSmallSupp += (int)(pCut->nLeaves < 2);
1039 
1040 if ( fVerbose )
1041 {
1042 printf( "Computed " );
1043 Mpm_CutPrint( pCut );
1044 printf( "\n" );
1045 }
1046  return 1;
1047 }
void Mpm_CutPrint(Mpm_Cut_t *pCut)
Definition: mpmMap.c:103
Mpm_Par_t * pPars
Definition: mpmInt.h:98
int Mpm_CutCheckDsd6(Mpm_Man_t *p, word t)
Definition: mpmDsd.c:905
void Mpm_ManPrintPerm(unsigned s)
Definition: mpmDsd.c:736
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
int nNonDsd
Definition: mpmInt.h:152
unsigned fCompl
Definition: mpmInt.h:66
int nVars
Definition: mpmInt.h:87
void Kit_DsdPrintFromTruth(unsigned *pTruth, int nVars)
Definition: kitDsd.c:490
int nSmallSupp
Definition: mpmInt.h:157
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
Vec_Wrd_t * vPerm6
Definition: mpmInt.h:135
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
Vec_Wec_t * vNpnConfigs
Definition: mpmInt.h:140
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
int nCountDsd[600]
Definition: mpmInt.h:151
int fMap4Gates
Definition: mpm.h:71
static word Abc_Tt6Flip(word Truth, int iVar)
Definition: utilTruth.h:1126
unsigned uComplMask[3]
Definition: mpmInt.h:139
unsigned uPermMask[3]
Definition: mpmInt.h:138
static Vec_Int_t * Vec_WecEntry(Vec_Wec_t *p, int i)
Definition: vecWec.h:142
char Perm6[720][6]
Definition: mpmInt.h:136
Vec_Int_t * vMap2Perm
Definition: mpmInt.h:137
word uTruth
Definition: mpmInt.h:90
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static word Vec_WrdEntry(Vec_Wrd_t *p, int i)
Definition: vecWrd.h:384
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
int pLeaves[1]
Definition: mpmInt.h:69
#define assert(ex)
Definition: util_old.h:213
unsigned nLeaves
Definition: mpmInt.h:68
unsigned iFunc
Definition: mpmInt.h:65
Mpm_Dsd_t * pDsd6
Definition: mpmInt.h:132
int nNoMatch
Definition: mpmInt.h:153
int Mpm_CutComputeTruth ( 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 
)

Definition at line 215 of file mpmTruth.c.

216 {
217  int RetValue;
218  if ( p->nLutSize <= 6 )
219  RetValue = Mpm_CutComputeTruth6( p, pCut, pCut0, pCut1, pCutC, fCompl0, fCompl1, fComplC, Type );
220  else
221  RetValue = Mpm_CutComputeTruth7( p, pCut, pCut0, pCut1, pCutC, fCompl0, fCompl1, fComplC, Type );
222 #ifdef MPM_TRY_NEW
223  {
224  extern unsigned Abc_TtCanonicize( word * pTruth, int nVars, char * pCanonPerm );
225  char pCanonPerm[16];
226  memcpy( p->Truth0, p->Truth, sizeof(word) * p->nTruWords );
227  Abc_TtCanonicize( p->Truth0, pCut->nLimit, pCanonPerm );
228  }
229 #endif
230  return RetValue;
231 }
static int Mpm_CutComputeTruth7(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)
Definition: mpmTruth.c:181
char * memcpy()
word Truth0[(1<< ((MPM_VAR_MAX)-6))]
Definition: mpmInt.h:127
static 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)
Definition: mpmTruth.c:145
int nTruWords
Definition: mpmInt.h:102
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
word Truth[(1<< ((MPM_VAR_MAX)-6))]
Definition: mpmInt.h:130
unsigned Abc_TtCanonicize(word *pTruth, int nVars, char *pCanonPerm)
FUNCTION DECLARATIONS ///.
Definition: dauCanon.c:895
int nLutSize
Definition: mpmInt.h:100
static Mpm_Cut_t* Mpm_CutFetch ( Mpm_Man_t p,
int  h 
)
inlinestatic

Definition at line 175 of file mpmInt.h.

175 { Mpm_Cut_t * pCut = (Mpm_Cut_t *)Mmr_StepEntry( p->pManCuts, h ); assert( Mpm_CutWordNum(pCut->nLeaves) == (h & p->pManCuts->uMask) ); return pCut; }
static word * Mmr_StepEntry(Mmr_Step_t *p, int h)
Definition: mem2.h:236
Mmr_Step_t * pManCuts
Definition: mpmInt.h:110
#define assert(ex)
Definition: util_old.h:213
unsigned nLeaves
Definition: mpmInt.h:68
int uMask
Definition: mem2.h:61
static int Mpm_CutWordNum(int nLeaves)
Definition: mpmInt.h:174
static int Mpm_CutLeafNum ( Mpm_Cut_t pCut)
inlinestatic

Definition at line 182 of file mpmInt.h.

182 { return pCut->nLeaves; }
unsigned nLeaves
Definition: mpmInt.h:68
void Mpm_CutPrint ( Mpm_Cut_t pCut)

Definition at line 103 of file mpmMap.c.

104 {
105  int i;
106  printf( "%d : { ", pCut->nLeaves );
107  for ( i = 0; i < (int)pCut->nLeaves; i++ )
108  printf( "%d ", pCut->pLeaves[i] );
109  printf( "}\n" );
110 }
int pLeaves[1]
Definition: mpmInt.h:69
unsigned nLeaves
Definition: mpmInt.h:68
static word* Mpm_CutTruth ( Mpm_Man_t p,
int  iFunc 
)
inlinestatic

Definition at line 183 of file mpmInt.h.

183 { return Vec_MemReadEntry(p->vTtMem, iFunc); }
Vec_Mem_t * vTtMem
Definition: mpmInt.h:124
static word * Vec_MemReadEntry(Vec_Mem_t *p, int i)
Definition: vecMem.h:191
word Mpm_CutTruthFromDsd ( Mpm_Man_t pMan,
Mpm_Cut_t pCut,
int  iClass 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 883 of file mpmDsd.c.

884 {
885  int i;
886  word uTruth = pMan->pDsd6[iClass].uTruth;
887  assert( pMan->pDsd6[iClass].nVars == (int)pCut->nLeaves );
888  for ( i = 0; i < (int)pCut->nLeaves; i++ )
889  if ( Abc_LitIsCompl(pCut->pLeaves[i]) )
890  uTruth = Abc_Tt6Flip( uTruth, i );
891  return uTruth;
892 }
int nVars
Definition: mpmInt.h:87
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static word Abc_Tt6Flip(word Truth, int iVar)
Definition: utilTruth.h:1126
word uTruth
Definition: mpmInt.h:90
int pLeaves[1]
Definition: mpmInt.h:69
#define assert(ex)
Definition: util_old.h:213
unsigned nLeaves
Definition: mpmInt.h:68
Mpm_Dsd_t * pDsd6
Definition: mpmInt.h:132
static int Mpm_CutWordNum ( int  nLeaves)
inlinestatic

Definition at line 174 of file mpmInt.h.

174 { return ((sizeof(Mpm_Cut_t) + (nLeaves << 2)) >> 3); }
void Mpm_LibLutFree ( Mpm_LibLut_t pLib)

Definition at line 60 of file mpmLib.c.

61 {
62  if ( pLib == NULL )
63  return;
64  ABC_FREE( pLib->pName );
65  ABC_FREE( pLib );
66 }
char * pName
Definition: mpm.h:49
#define ABC_FREE(obj)
Definition: abc_global.h:232
Mpm_LibLut_t* Mpm_LibLutSetSimple ( int  nLutSize)

DECLARATIONS ///.

CFile****************************************************************

FileName [mpmLib.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Configurable technology mapper.]

Synopsis [DSD manipulation for 6-input functions.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 1, 2013.]

Revision [

Id:
mpmLib.c,v 1.00 2013/06/01 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file mpmLib.c.

46 {
47  Mpm_LibLut_t * pLib;
48  int i, k;
49  assert( nLutSize <= MPM_VAR_MAX );
50  pLib = ABC_CALLOC( Mpm_LibLut_t, 1 );
51  pLib->LutMax = nLutSize;
52  for ( i = 1; i <= pLib->LutMax; i++ )
53  {
54  pLib->pLutAreas[i] = MPM_UNIT_AREA;
55  for ( k = 0; k < i; k++ )
56  pLib->pLutDelays[i][k] = MPM_UNIT_TIME;
57  }
58  return pLib;
59 }
#define MPM_UNIT_TIME
Definition: mpmInt.h:52
int pLutDelays[MPM_VAR_MAX+1][MPM_VAR_MAX+1]
Definition: mpm.h:53
#define MPM_UNIT_AREA
Definition: mpmInt.h:53
#define MPM_VAR_MAX
INCLUDES ///.
Definition: mpm.h:40
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
int LutMax
Definition: mpm.h:50
int pLutAreas[MPM_VAR_MAX+1]
Definition: mpm.h:52
static void Mpm_ManCleanMapRefs ( Mpm_Man_t p)
inlinestatic

Definition at line 188 of file mpmInt.h.

188 { Vec_IntFill( &p->vMapRefs, Mig_ManObjNum(p->pMig), 0 ); }
static int Mig_ManObjNum(Mig_Man_t *p)
Definition: mpmMig.h:109
Vec_Int_t vMapRefs
Definition: mpmInt.h:145
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
Mig_Man_t * pMig
Definition: mpmInt.h:97
static void Mpm_ManCleanRequired ( Mpm_Man_t p)
inlinestatic

Definition at line 195 of file mpmInt.h.

static int Mig_ManObjNum(Mig_Man_t *p)
Definition: mpmMig.h:109
Vec_Int_t vRequireds
Definition: mpmInt.h:147
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
Mig_Man_t * pMig
Definition: mpmInt.h:97
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
Vec_Wec_t* Mpm_ManFindDsdMatches ( Mpm_Man_t p,
void *  pScl 
)

DECLARATIONS ///.

CFile****************************************************************

FileName [mpmGates.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Configurable technology mapper.]

Synopsis [Standard-cell mapping.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 1, 2013.]

Revision [

Id:
mpmGates.c,v 1.00 2013/06/01 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Finds matches fore each DSD class.]

Description []

SideEffects []

SeeAlso []

Definition at line 49 of file mpmGates.c.

50 {
51  int fVerbose = p->pPars->fVeryVerbose;
52  SC_Lib * pLib = (SC_Lib *)pScl;
53  Vec_Wec_t * vClasses;
54  Vec_Int_t * vClass;
55  SC_Cell * pRepr;
56  int i, Config, iClass;
57  word Truth;
58  vClasses = Vec_WecStart( 600 );
59  SC_LibForEachCellClass( pLib, pRepr, i )
60  {
61  if ( pRepr->n_inputs > 6 || pRepr->n_outputs > 1 )
62  {
63  if ( fVerbose )
64  printf( "Skipping cell %s with %d inputs and %d outputs\n", pRepr->pName, pRepr->n_inputs, pRepr->n_outputs );
65  continue;
66  }
67  Truth = *Vec_WrdArray( SC_CellPin(pRepr, pRepr->n_inputs)->vFunc );
68  Config = Mpm_CutCheckDsd6( p, Truth );
69  if ( Config == -1 )
70  {
71  if ( fVerbose )
72  printf( "Skipping cell %s with non-DSD function\n", pRepr->pName );
73  continue;
74  }
75  iClass = Config >> 17;
76  Config = (pRepr->Id << 17) | (Config & 0x1FFFF);
77  // write gate and NPN config for this DSD class
78  vClass = Vec_WecEntry( vClasses, iClass );
79  Vec_IntPush( vClass, Config );
80  if ( !fVerbose )
81  continue;
82 
83  printf( "Gate %5d %-30s : ", pRepr->Id, pRepr->pName );
84  printf( "Class %3d ", iClass );
85  printf( "Area %10.3f ", pRepr->area );
86  Extra_PrintBinary( stdout, (unsigned *)&Config, 17 );
87  printf( " " );
88  Kit_DsdPrintFromTruth( (unsigned *)&Truth, pRepr->n_inputs ); printf( "\n" );
89  }
90  return vClasses;
91 }
Mpm_Par_t * pPars
Definition: mpmInt.h:98
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
Definition: vecWec.h:42
int Mpm_CutCheckDsd6(Mpm_Man_t *p, word t)
Definition: mpmDsd.c:905
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Wec_t * Vec_WecStart(int nSize)
Definition: vecWec.h:98
#define SC_LibForEachCellClass(p, pCell, i)
Definition: sclLib.h:249
void Kit_DsdPrintFromTruth(unsigned *pTruth, int nVars)
Definition: kitDsd.c:490
Vec_Wrd_t * vFunc
Definition: sclLib.h:177
float area
Definition: sclLib.h:188
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
int Id
Definition: sclLib.h:184
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
char * pName
Definition: sclLib.h:183
static SC_Pin * SC_CellPin(SC_Cell *p, int i)
Definition: sclLib.h:241
static Vec_Int_t * Vec_WecEntry(Vec_Wec_t *p, int i)
Definition: vecWec.h:142
int n_outputs
Definition: sclLib.h:193
static ABC_NAMESPACE_IMPL_START word Truth[8]
DECLARATIONS ///.
Definition: giaShrink6.c:32
void Extra_PrintBinary(FILE *pFile, unsigned Sign[], int nBits)
static word * Vec_WrdArray(Vec_Wrd_t *p)
Definition: vecWrd.h:316
int n_inputs
Definition: sclLib.h:192
int fVeryVerbose
Definition: mpm.h:73
void* Mpm_ManFromIfLogic ( Mpm_Man_t pMan)

Definition at line 213 of file mpmAbc.c.

214 {
215  Gia_Man_t * pNew;
216  Mpm_Cut_t * pCutBest;
217  Mig_Obj_t * pObj, * pFanin;
218  Vec_Int_t * vMapping, * vMapping2, * vPacking = NULL;
219  Vec_Int_t * vLeaves, * vLeaves2, * vCover;
220  word uTruth, * pTruth = &uTruth;
221  int i, k, Entry, iLitNew;
222 // assert( !pMan->pPars->fDeriveLuts || pMan->pPars->fTruth );
223  // start mapping and packing
224  vMapping = Vec_IntStart( Mig_ManObjNum(pMan->pMig) );
225  vMapping2 = Vec_IntStart( 1 );
226  if ( 0 ) // pMan->pPars->fDeriveLuts && pMan->pPars->pLutStruct )
227  {
228  vPacking = Vec_IntAlloc( 1000 );
229  Vec_IntPush( vPacking, 0 );
230  }
231  // create new manager
232  pNew = Gia_ManStart( Mig_ManObjNum(pMan->pMig) );
233  // iterate through nodes used in the mapping
234  vCover = Vec_IntAlloc( 1 << 16 );
235  vLeaves = Vec_IntAlloc( 16 );
236  vLeaves2 = Vec_IntAlloc( 16 );
237  Mig_ManCleanCopy( pMan->pMig );
238  Mig_ManForEachObj( pMan->pMig, pObj )
239  {
240  if ( !Mpm_ObjMapRef(pMan, pObj) && !Mig_ObjIsTerm(pObj) )
241  continue;
242  if ( Mig_ObjIsNode(pObj) )
243  {
244  // collect leaves of the best cut
245  Vec_IntClear( vLeaves );
246  pCutBest = Mpm_ObjCutBestP( pMan, pObj );
247  Mpm_CutForEachLeaf( pMan->pMig, pCutBest, pFanin, k )
248  Vec_IntPush( vLeaves, Mig_ObjCopy(pFanin) );
249  if ( pMan->pPars->fDeriveLuts && (pMan->pPars->fUseTruth || pMan->pPars->fUseDsd) )
250  {
251  extern int Gia_ManFromIfLogicNode( void * p, Gia_Man_t * pNew, int iObj, Vec_Int_t * vLeaves, Vec_Int_t * vLeavesTemp,
252  word * pRes, char * pStr, Vec_Int_t * vCover, Vec_Int_t * vMapping, Vec_Int_t * vMapping2, Vec_Int_t * vPacking, int fCheck75, int fCheck44e );
253  if ( pMan->pPars->fUseTruth )
254  pTruth = Mpm_CutTruth(pMan, Abc_Lit2Var(pCutBest->iFunc));
255  else
256  uTruth = Mpm_CutTruthFromDsd( pMan, pCutBest, Abc_Lit2Var(pCutBest->iFunc) );
257 // Kit_DsdPrintFromTruth( pTruth, Vec_IntSize(vLeaves) ); printf( "\n" );
258  // perform decomposition of the cut
259  iLitNew = Gia_ManFromIfLogicNode( NULL, pNew, Mig_ObjId(pObj), vLeaves, vLeaves2, pTruth, NULL, vCover, vMapping, vMapping2, vPacking, 0, 0 );
260  iLitNew = Abc_LitNotCond( iLitNew, pCutBest->fCompl ^ Abc_LitIsCompl(pCutBest->iFunc) );
261  }
262  else
263  {
264  // perform one of the two types of mapping: with and without structures
265  iLitNew = Mpm_ManNodeIfToGia( pNew, pMan, pObj, vLeaves, 0 );
266  // write mapping
267  Vec_IntSetEntry( vMapping, Abc_Lit2Var(iLitNew), Vec_IntSize(vMapping2) );
268  Vec_IntPush( vMapping2, Vec_IntSize(vLeaves) );
269  Vec_IntForEachEntry( vLeaves, Entry, k )
270  assert( Abc_Lit2Var(Entry) < Abc_Lit2Var(iLitNew) );
271  Vec_IntForEachEntry( vLeaves, Entry, k )
272  Vec_IntPush( vMapping2, Abc_Lit2Var(Entry) );
273  Vec_IntPush( vMapping2, Abc_Lit2Var(iLitNew) );
274  }
275  }
276  else if ( Mig_ObjIsCi(pObj) )
277  iLitNew = Gia_ManAppendCi(pNew);
278  else if ( Mig_ObjIsCo(pObj) )
279  iLitNew = Gia_ManAppendCo( pNew, Abc_LitNotCond(Mig_ObjCopy(Mig_ObjFanin0(pObj)), Mig_ObjFaninC0(pObj)) );
280  else if ( Mig_ObjIsConst0(pObj) )
281  {
282  iLitNew = 0;
283  // create const LUT
284  Vec_IntWriteEntry( vMapping, 0, Vec_IntSize(vMapping2) );
285  Vec_IntPush( vMapping2, 0 );
286  Vec_IntPush( vMapping2, 0 );
287  }
288  else assert( 0 );
289  Mig_ObjSetCopy( pObj, iLitNew );
290  }
291  Vec_IntFree( vCover );
292  Vec_IntFree( vLeaves );
293  Vec_IntFree( vLeaves2 );
294 // printf( "Mapping array size: IfMan = %d. Gia = %d. Increase = %.2f\n",
295 // Mig_ManObjNum(pMan), Gia_ManObjNum(pNew), 1.0 * Gia_ManObjNum(pNew) / Mig_ManObjNum(pMan) );
296  // finish mapping
297  if ( Vec_IntSize(vMapping) > Gia_ManObjNum(pNew) )
298  Vec_IntShrink( vMapping, Gia_ManObjNum(pNew) );
299  else
300  Vec_IntFillExtra( vMapping, Gia_ManObjNum(pNew), 0 );
301  assert( Vec_IntSize(vMapping) == Gia_ManObjNum(pNew) );
302  Vec_IntForEachEntry( vMapping, Entry, i )
303  if ( Entry > 0 )
304  Vec_IntAddToEntry( vMapping, i, Gia_ManObjNum(pNew) );
305  Vec_IntAppend( vMapping, vMapping2 );
306  Vec_IntFree( vMapping2 );
307  // attach mapping and packing
308  assert( pNew->vMapping == NULL );
309  assert( pNew->vPacking == NULL );
310  pNew->vMapping = vMapping;
311  pNew->vPacking = vPacking;
312  // verify that COs have mapping
313  {
314  Gia_Obj_t * pObj;
315  Gia_ManForEachCo( pNew, pObj, i )
316  assert( !Gia_ObjIsAnd(Gia_ObjFanin0(pObj)) || Gia_ObjIsLut(pNew, Gia_ObjFaninId0p(pNew, pObj)) );
317  }
318  return pNew;
319 }
static int Mig_ObjCopy(Mig_Obj_t *p)
Definition: mpmMig.h:194
static int Mig_ManObjNum(Mig_Man_t *p)
Definition: mpmMig.h:109
Mpm_Par_t * pPars
Definition: mpmInt.h:98
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntFillExtra(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:376
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Mig_ObjIsTerm(Mig_Obj_t *p)
Definition: mpmMig.h:133
static int Mig_ObjFaninC0(Mig_Obj_t *p)
Definition: mpmMig.h:180
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
static int Mig_ObjIsNode(Mig_Obj_t *p)
Definition: mpmMig.h:137
#define Mig_ManForEachObj(p, pObj)
MACRO DEFINITIONS ///.
Definition: mpmMig.h:304
unsigned fCompl
Definition: mpmInt.h:66
static void Vec_IntSetEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:418
static int Mig_ObjIsCi(Mig_Obj_t *p)
Definition: mpmMig.h:134
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
static int Mig_ObjId(Mig_Obj_t *p)
Definition: mpmMig.h:146
Definition: gia.h:75
static int Mig_ObjIsConst0(Mig_Obj_t *p)
Definition: mpmMig.h:132
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntAddToEntry(Vec_Int_t *p, int i, int Addition)
Definition: bblif.c:302
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
if(last==0)
Definition: sparse_int.h:34
static Mig_Obj_t * Mig_ObjFanin0(Mig_Obj_t *p)
Definition: mpmMig.h:176
#define Mpm_CutForEachLeaf(p, pCut, pLeaf, i)
Definition: mpmInt.h:222
else
Definition: sparse_int.h:55
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static void Vec_IntAppend(Vec_Int_t *vVec1, Vec_Int_t *vVec2)
static void Mig_ManCleanCopy(Mig_Man_t *p)
Definition: mpmMig.h:193
static word * Mpm_CutTruth(Mpm_Man_t *p, int iFunc)
Definition: mpmInt.h:183
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Mig_Man_t * pMig
Definition: mpmInt.h:97
static int Mpm_ObjMapRef(Mpm_Man_t *p, Mig_Obj_t *pObj)
Definition: mpmInt.h:189
static void Mig_ObjSetCopy(Mig_Obj_t *p, int i)
Definition: mpmMig.h:195
static void Vec_IntShrink(Vec_Int_t *p, int nSizeNew)
Definition: bblif.c:435
Definition: gia.h:95
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
int Mpm_ManNodeIfToGia(Gia_Man_t *pNew, Mpm_Man_t *pMan, Mig_Obj_t *pObj, Vec_Int_t *vLeaves, int fHash)
Definition: mpmAbc.c:187
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
static int Gia_ObjFaninId0p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:463
static Mpm_Cut_t * Mpm_ObjCutBestP(Mpm_Man_t *p, Mig_Obj_t *pObj)
Definition: mpmInt.h:176
#define assert(ex)
Definition: util_old.h:213
static int Gia_ObjIsLut(Gia_Man_t *p, int Id)
Definition: gia.h:952
int Gia_ManFromIfLogicNode(void *pIfMan, Gia_Man_t *pNew, int iObj, Vec_Int_t *vLeaves, Vec_Int_t *vLeavesTemp, word *pRes, char *pStr, Vec_Int_t *vCover, Vec_Int_t *vMapping, Vec_Int_t *vMapping2, Vec_Int_t *vPacking, int fCheck75, int fCheck44e)
Definition: giaIf.c:1037
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
word Mpm_CutTruthFromDsd(Mpm_Man_t *pMan, Mpm_Cut_t *pCut, int iClass)
Definition: mpmDsd.c:883
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
static int Mig_ObjIsCo(Mig_Obj_t *p)
Definition: mpmMig.h:135
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
int fUseTruth
Definition: mpm.h:64
unsigned iFunc
Definition: mpmInt.h:65
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Mpm_ManPerform ( Mpm_Man_t p)

Definition at line 833 of file mpmMap.c.

834 {
835  if ( p->pPars->fMap4Cnf )
836  {
838  Mpm_ManPerformRound( p );
839  }
840  else
841  {
843  Mpm_ManPerformRound( p );
844  if ( p->pPars->fOneRound )
845  return;
846 
848  Mpm_ManPerformRound( p );
849 
851  Mpm_ManPerformRound( p );
852 
853  p->fMainRun = 1;
854 
857  Mpm_ManPerformRound( p );
858 
861  Mpm_ManPerformRound( p );
862  }
863 }
Mpm_Par_t * pPars
Definition: mpmInt.h:98
int Mpm_CutCompareDelay2(Mpm_Uni_t *pOld, Mpm_Uni_t *pNew)
Definition: mpmMap.c:756
int fOneRound
Definition: mpm.h:67
int Mpm_CutCompareArea(Mpm_Uni_t *pOld, Mpm_Uni_t *pNew)
Definition: mpmMap.c:764
int fMainRun
Definition: mpmInt.h:105
int(* pCutCmp)(Mpm_Uni_t *, Mpm_Uni_t *)
Definition: mpmInt.h:118
void Mpm_ManPerformRound(Mpm_Man_t *p)
Definition: mpmMap.c:807
int fMap4Cnf
Definition: mpm.h:69
int Mpm_CutCompareArea2(Mpm_Uni_t *pOld, Mpm_Uni_t *pNew)
Definition: mpmMap.c:773
int Mpm_CutCompareDelay(Mpm_Uni_t *pOld, Mpm_Uni_t *pNew)
Definition: mpmMap.c:748
static void Mpm_ManComputeEstRefs(Mpm_Man_t *p)
Definition: mpmMap.c:726
void Mpm_ManPrecomputePerms ( Mpm_Man_t p)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 755 of file mpmDsd.c.

756 {
757  int nVars = 6;
758  // 0(1:1) 1(2:1) 2(4:2) 3(10:6) 4(33:23) 5(131:98) 6(595:464)
759  int nClasses[7] = { 1, 2, 4, 10, 33, 131, 595 };
760  int nPerms = Extra_Factorial( nVars );
761 // int nSwaps = (1 << nVars);
762  int * pComp, * pPerm;
763  int i, k, x, One, OneCopy, Num;
764  Vec_Int_t * vVars;
765  abctime clk = Abc_Clock();
766  assert( p->pDsd6 == NULL );
767  p->pDsd6 = s_DsdClass6;
768  // precompute schedules
769  pComp = Extra_GreyCodeSchedule( nVars );
770  pPerm = Extra_PermSchedule( nVars );
771  // map numbers into perms
772  p->vMap2Perm = Vec_IntStartFull( (1<<(3*nVars)) );
773  // store permutations
774  One = 0;
775  for ( x = 0; x < nVars; x++ )
776  {
777  p->Perm6[0][x] = (char)x;
778  One |= (x << (3*x));
779  }
780 // Vec_IntWriteEntry( p->vMap2Perm, One, 0 );
781  OneCopy = One;
782  for ( k = 0; k < nPerms; k++ )
783  {
784  if ( k > 0 )
785  for ( x = 0; x < nVars; x++ )
786  p->Perm6[k][x] = p->Perm6[k-1][x];
787  ABC_SWAP( char, p->Perm6[k][pPerm[k]], p->Perm6[k][pPerm[k]+1] );
788 
789  Num = ( (One >> (3*(pPerm[k] ))) ^ (One >> (3*(pPerm[k]+1))) ) & 7;
790  One ^= (Num << (3*(pPerm[k] )));
791  One ^= (Num << (3*(pPerm[k]+1)));
792 
793  Vec_IntWriteEntry( p->vMap2Perm, One, k );
794 
795 // Mpm_ManPrintPerm( One );
796 // for ( x = 0; x < nVars; x++ )
797 // printf( "%d ", p->Perm6[k][x] );
798 // printf( "\n" );
799  }
800  assert( OneCopy == One );
801  // fill in the gaps
802  vVars = Vec_IntAlloc( 6 );
803  Vec_IntForEachEntry( p->vMap2Perm, Num, i )
804  {
805  // mark used variables
806  int Count = 0;
807  One = i;
808  Vec_IntFill( vVars, 6, 0 );
809  for ( k = 0; k < nVars; k++ )
810  {
811  int iVar = ((One >> (3*k)) & 7);
812  if ( iVar >= nVars && iVar < 7 )
813  break;
814  if ( iVar != 7 )
815  {
816  if ( Vec_IntEntry( vVars, iVar ) == 1 )
817  break;
818  Vec_IntWriteEntry( vVars, iVar, 1 );
819  Count++;
820  }
821  }
822  // skip ones with dups and complete
823  if ( k < nVars || Count == nVars )
824  continue;
825  // find unused variables
826  for ( x = k = 0; k < 6; k++ )
827  if ( Vec_IntEntry(vVars, k) == 0 )
828  Vec_IntWriteEntry( vVars, x++, k );
829  Vec_IntShrink( vVars, x );
830  // fill in used variables
831  x = 0;
832  for ( k = 0; k < nVars; k++ )
833  {
834  int iVar = ((One >> (3*k)) & 7);
835  if ( iVar == 7 )
836  One ^= ((Vec_IntEntry(vVars, x++) ^ 7) << (3*k));
837  }
838  assert( x == Vec_IntSize(vVars) );
839  // save this one
840  assert( Vec_IntEntry( p->vMap2Perm, One ) != -1 );
842 /*
843  // mapping
844  Mpm_ManPrintPerm( i );
845  printf( "-> " );
846  Mpm_ManPrintPerm( One );
847  printf( "\n" );
848 */
849  }
850  Vec_IntFree( vVars );
851 
852  // store permuted truth tables
853  assert( p->vPerm6 == NULL );
854  p->vPerm6 = Vec_WrdAlloc( nPerms * 595 );
855  for ( i = 0; i < nClasses[nVars]; i++ )
856  {
857  word uTruth = s_DsdClass6[i].uTruth;
858  for ( k = 0; k < nPerms; k++ )
859  {
860  uTruth = Abc_Tt6SwapAdjacent( uTruth, pPerm[k] );
861  Vec_WrdPush( p->vPerm6, uTruth );
862  }
863  assert( uTruth == s_DsdClass6[i].uTruth );
864  }
865  ABC_FREE( pPerm );
866  ABC_FREE( pComp );
867  // build hash table
869  Abc_PrintTime( 1, "Setting up DSD information", Abc_Clock() - clk );
870 }
int * Extra_GreyCodeSchedule(int n)
int * Extra_PermSchedule(int n)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static void Vec_WrdPush(Vec_Wrd_t *p, word Entry)
Definition: vecWrd.h:618
Hsh_IntMan_t * Mpm_ManBuildHashTable(Vec_Int_t **pvConfgRes)
Definition: mpmDsd.c:699
static abctime Abc_Clock()
Definition: abc_global.h:279
static Vec_Int_t * Vec_IntStartFull(int nSize)
Definition: vecInt.h:119
Vec_Wrd_t * vPerm6
Definition: mpmInt.h:135
#define ABC_SWAP(Type, a, b)
Definition: abc_global.h:218
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static word Abc_Tt6SwapAdjacent(word Truth, int iVar)
Definition: utilTruth.h:1186
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
Hsh_IntMan_t * pHash
Definition: mpmInt.h:133
static int pPerm[13719]
Definition: rwrTemp.c:32
static Vec_Wrd_t * Vec_WrdAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecWrd.h:80
char Perm6[720][6]
Definition: mpmInt.h:136
Vec_Int_t * vMap2Perm
Definition: mpmInt.h:137
word uTruth
Definition: mpmInt.h:90
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Vec_IntShrink(Vec_Int_t *p, int nSizeNew)
Definition: bblif.c:435
#define ABC_FREE(obj)
Definition: abc_global.h:232
int Extra_Factorial(int n)
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
ABC_INT64_T abctime
Definition: abc_global.h:278
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Vec_Int_t * vConfgRes
Definition: mpmInt.h:134
Mpm_Dsd_t * pDsd6
Definition: mpmInt.h:132
static ABC_NAMESPACE_IMPL_START Mpm_Dsd_t s_DsdClass6[595]
DECLARATIONS ///.
Definition: mpmDsd.c:30
void Mpm_ManPrepare ( Mpm_Man_t p)

Function*************************************************************

Synopsis [Technology mapping experiment.]

Description []

SideEffects []

SeeAlso []

Definition at line 794 of file mpmMap.c.

795 {
796  Mig_Obj_t * pObj;
797  int i, hCut;
798  Mig_ManForEachCi( p->pMig, pObj, i )
799  {
800  hCut = Mpm_CutCreateUnit( p, Mig_ObjId(pObj) );
801  Mpm_ObjSetCutBest( p, pObj, hCut );
802  Mpm_ObjSetCutList( p, pObj, hCut );
803  }
804  Mig_ManForEachCand( p->pMig, pObj )
805  Mpm_ObjSetEstRef( p, pObj, MPM_UNIT_REFS * Mig_ObjRefNum(pObj) );
806 }
#define MPM_UNIT_REFS
Definition: mpmInt.h:55
static void Mpm_ObjSetEstRef(Mpm_Man_t *p, Mig_Obj_t *pObj, int i)
Definition: mpmInt.h:193
static int Mig_ObjRefNum(Mig_Obj_t *p)
Definition: mpmMig.h:191
static void Mpm_ObjSetCutBest(Mpm_Man_t *p, Mig_Obj_t *pObj, int i)
Definition: mpmInt.h:172
static int Mig_ObjId(Mig_Obj_t *p)
Definition: mpmMig.h:146
#define Mig_ManForEachCand(p, pObj)
Definition: mpmMig.h:324
static int Mpm_CutCreateUnit(Mpm_Man_t *p, int Id)
Definition: mpmMap.c:63
Mig_Man_t * pMig
Definition: mpmInt.h:97
#define Mig_ManForEachCi(p, pObj, i)
Definition: mpmMig.h:327
static void Mpm_ObjSetCutList(Mpm_Man_t *p, Mig_Obj_t *pObj, int i)
Definition: mpmInt.h:180
void Mpm_ManPrintDsdStats ( Mpm_Man_t p)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 665 of file mpmDsd.c.

666 {
667  int i, Absent = 0;
668  for ( i = 0; i < 595; i++ )
669  {
670  if ( p->nCountDsd[i] == 0 )
671  {
672  Absent++;
673  continue;
674  }
675  if ( p->pPars->fVeryVerbose )
676  {
677  printf( "%5d : ", i );
678  printf( "%-20s ", p->pDsd6[i].pStr );
679  printf( "%8d ", p->nCountDsd[i] );
680  printf( "\n" );
681  }
682  }
683  printf( "Unused classes = %d (%.2f %%). ", Absent, 100.0 * Absent / 595 );
684  printf( "Non-DSD cuts = %d (%.2f %%). ", p->nNonDsd, 100.0 * p->nNonDsd / p->nCutsMergedAll );
685  printf( "No-match cuts = %d (%.2f %%).\n", p->nNoMatch, 100.0 * p->nNoMatch / p->nCutsMergedAll );
686 }
Mpm_Par_t * pPars
Definition: mpmInt.h:98
int nNonDsd
Definition: mpmInt.h:152
int nCutsMergedAll
Definition: mpmInt.h:156
char * pStr
Definition: mpmInt.h:91
int nCountDsd[600]
Definition: mpmInt.h:151
int fVeryVerbose
Definition: mpm.h:73
Mpm_Dsd_t * pDsd6
Definition: mpmInt.h:132
int nNoMatch
Definition: mpmInt.h:153
void Mpm_ManPrintPerm ( unsigned  s)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 736 of file mpmDsd.c.

737 {
738  int i;
739  for ( i = 0; i < 6; i++ )
740  printf( "%d ", (s >> (3*i)) & 7 );
741  printf( " " );
742 }
void Mpm_ManPrintStats ( Mpm_Man_t p)

Definition at line 173 of file mpmMan.c.

174 {
175  printf( "Memory usage: Mig = %.2f MB Map = %.2f MB Cut = %.2f MB Total = %.2f MB. ",
176  1.0 * Mig_ManObjNum(p->pMig) * sizeof(Mig_Obj_t) / (1 << 20),
177  1.0 * Mig_ManObjNum(p->pMig) * 48 / (1 << 20),
178  1.0 * Mmr_StepMemory(p->pManCuts) / (1 << 17),
179  1.0 * Mig_ManObjNum(p->pMig) * sizeof(Mig_Obj_t) / (1 << 20) +
180  1.0 * Mig_ManObjNum(p->pMig) * 48 / (1 << 20) +
181  1.0 * Mmr_StepMemory(p->pManCuts) / (1 << 17) );
182  if ( p->timeDerive )
183  {
184  printf( "\n" );
185  p->timeTotal = Abc_Clock() - p->timeTotal;
186  p->timeOther = p->timeTotal - p->timeDerive;
187 
188  Abc_Print( 1, "Runtime breakdown:\n" );
189  ABC_PRTP( "Complete cut computation ", p->timeDerive , p->timeTotal );
190  ABC_PRTP( "- Merging cuts ", p->timeMerge , p->timeTotal );
191  ABC_PRTP( "- Evaluting cut parameters ", p->timeEval , p->timeTotal );
192  ABC_PRTP( "- Checking cut containment ", p->timeCompare, p->timeTotal );
193  ABC_PRTP( "- Adding cuts to storage ", p->timeStore , p->timeTotal );
194  ABC_PRTP( "Other ", p->timeOther , p->timeTotal );
195  ABC_PRTP( "TOTAL ", p->timeTotal , p->timeTotal );
196  }
197  else
198  Abc_PrintTime( 1, "Time", Abc_Clock() - p->timeTotal );
199 }
static int Mig_ManObjNum(Mig_Man_t *p)
Definition: mpmMig.h:109
static int Mmr_StepMemory(Mmr_Step_t *p)
Definition: mem2.h:254
static abctime Abc_Clock()
Definition: abc_global.h:279
abctime timeDerive
Definition: mpmInt.h:158
#define ABC_PRTP(a, t, T)
Definition: abc_global.h:223
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
abctime timeCompare
Definition: mpmInt.h:161
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
abctime timeStore
Definition: mpmInt.h:162
abctime timeTotal
Definition: mpmInt.h:164
abctime timeMerge
Definition: mpmInt.h:159
Mig_Man_t * pMig
Definition: mpmInt.h:97
abctime timeEval
Definition: mpmInt.h:160
Mmr_Step_t * pManCuts
Definition: mpmInt.h:110
abctime timeOther
Definition: mpmInt.h:163
void Mpm_ManPrintStatsInit ( Mpm_Man_t p)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 166 of file mpmMan.c.

167 {
168  printf( "K = %d. C = %d. Cand = %d. XOR = %d. MUX = %d. Choice = %d. CutMin = %d. Truth = %d. DSD = %d.\n",
169  p->nLutSize, p->nNumCuts, Mig_ManCandNum(p->pMig),
171  p->pPars->fCutMin, p->pPars->fUseTruth, p->pPars->fUseDsd );
172 }
Mpm_Par_t * pPars
Definition: mpmInt.h:98
int fCutMin
Definition: mpm.h:66
static int Mig_ManCandNum(Mig_Man_t *p)
Definition: mpmMig.h:111
int nChoices
Definition: mpmMig.h:66
int Mig_ManXorNum(Mig_Man_t *p)
Definition: mpmMig.c:102
int nNumCuts
Definition: mpmInt.h:101
Mig_Man_t * pMig
Definition: mpmInt.h:97
int Mig_ManMuxNum(Mig_Man_t *p)
Definition: mpmMig.c:106
int nLutSize
Definition: mpmInt.h:100
int fUseTruth
Definition: mpm.h:64
int fUseDsd
Definition: mpm.h:65
Mpm_Man_t* Mpm_ManStart ( Mig_Man_t pMig,
Mpm_Par_t pPars 
)

DECLARATIONS ///.

CFile****************************************************************

FileName [mpm.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Configurable technology mapper.]

Synopsis []

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 1, 2013.]

Revision [

Id:
mpm.c,v 1.00 2013/06/01 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file mpmMan.c.

46 {
47  Mpm_Man_t * p;
48  int i;
49  assert( sizeof(Mpm_Uni_t) % sizeof(word) == 0 ); // aligned info to word boundary
50  assert( pPars->nNumCuts <= MPM_CUT_MAX );
51  assert( !pPars->fUseTruth || pPars->pLib->LutMax <= 16 );
52  assert( !pPars->fUseDsd || pPars->pLib->LutMax <= 6 );
53  Mig_ManSetRefs( pMig );
54  // alloc
55  p = ABC_CALLOC( Mpm_Man_t, 1 );
56  p->pMig = pMig;
57  p->pPars = pPars;
58  p->pLibLut = pPars->pLib;
59  p->nLutSize = pPars->pLib->LutMax;
60  p->nTruWords = pPars->fUseTruth ? Abc_Truth6WordNum(p->nLutSize) : 0;
61  p->nNumCuts = pPars->nNumCuts;
62  // cuts
63  assert( Mpm_CutWordNum(32) < 32 ); // using 5 bits for word count
65  Vec_PtrGrow( &p->vFreeUnits, p->nNumCuts + 1 );
66  for ( i = p->nNumCuts; i >= 0; i-- )
67  Vec_PtrPush( &p->vFreeUnits, p->pCutUnits + i );
68  p->vTemp = Vec_PtrAlloc( 1000 );
69  // mapping attributes
70  Vec_IntFill( &p->vCutBests, Mig_ManObjNum(pMig), 0 );
71  Vec_IntFill( &p->vCutLists, Mig_ManObjNum(pMig), 0 );
72  Vec_IntFill( &p->vMigRefs, Mig_ManObjNum(pMig), 0 );
73  Vec_IntFill( &p->vMapRefs, Mig_ManObjNum(pMig), 0 );
74  Vec_IntFill( &p->vEstRefs, Mig_ManObjNum(pMig), 0 );
76  Vec_IntFill( &p->vTimes, Mig_ManObjNum(pMig), 0 );
77  Vec_IntFill( &p->vAreas, Mig_ManObjNum(pMig), 0 );
78  Vec_IntFill( &p->vEdges, Mig_ManObjNum(pMig), 0 );
79  // start DSD manager
80  assert( !p->pPars->fUseTruth || !p->pPars->fUseDsd );
81  if ( p->pPars->fUseTruth )
82  {
83  p->vTtMem = Vec_MemAlloc( p->nTruWords, 12 ); // 32 KB/page for 6-var functions
84  Vec_MemHashAlloc( p->vTtMem, 10000 );
85  p->funcCst0 = Vec_MemHashInsert( p->vTtMem, p->Truth );
86  Abc_TtUnit( p->Truth, p->nTruWords );
87  p->funcVar0 = Vec_MemHashInsert( p->vTtMem, p->Truth );
88  }
89  else if ( p->pPars->fUseDsd )
90  {
92  p->funcVar0 = 1;
93  }
94  // finish
95  p->timeTotal = Abc_Clock();
96  pMig->pMan = p;
97  return p;
98 }
static int Mig_ManObjNum(Mig_Man_t *p)
Definition: mpmMig.h:109
Mpm_Par_t * pPars
Definition: mpmInt.h:98
int funcCst0
Definition: mpmInt.h:125
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Vec_Ptr_t * vTemp
Definition: mpmInt.h:116
Vec_Int_t vRequireds
Definition: mpmInt.h:147
static void Vec_PtrGrow(Vec_Ptr_t *p, int nCapMin)
Definition: vecPtr.h:430
static void Vec_MemHashAlloc(Vec_Mem_t *p, int nTableSize)
Definition: vecMem.h:305
static int Abc_Truth6WordNum(int nVars)
Definition: abc_global.h:257
Vec_Int_t vMapRefs
Definition: mpmInt.h:145
static void Abc_TtUnit(word *pOut, int nWords)
Definition: utilTruth.h:209
static Mmr_Step_t * Mmr_StepStart(int nPageBase, int nWordBase)
Definition: mem2.h:218
int nNumCuts
Definition: mpm.h:61
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
Vec_Mem_t * vTtMem
Definition: mpmInt.h:124
static abctime Abc_Clock()
Definition: abc_global.h:279
void Mig_ManSetRefs(Mig_Man_t *p)
Definition: mpmMig.c:123
void * pMan
Definition: mpmMig.h:80
Mpm_LibLut_t * pLibLut
Definition: mpmInt.h:103
static Vec_Mem_t * Vec_MemAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: utilMem.c:70
Vec_Int_t vCutBests
Definition: mpmInt.h:142
int nTruWords
Definition: mpmInt.h:102
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
Vec_Int_t vTimes
Definition: mpmInt.h:148
Vec_Int_t vAreas
Definition: mpmInt.h:149
word Truth[(1<< ((MPM_VAR_MAX)-6))]
Definition: mpmInt.h:130
Vec_Int_t vCutLists
Definition: mpmInt.h:143
int nNumCuts
Definition: mpmInt.h:101
abctime timeTotal
Definition: mpmInt.h:164
Vec_Int_t vEdges
Definition: mpmInt.h:150
#define MPM_CUT_MAX
INCLUDES ///.
Definition: mpmInt.h:50
Mig_Man_t * pMig
Definition: mpmInt.h:97
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
void Mpm_ManPrecomputePerms(Mpm_Man_t *p)
Definition: mpmDsd.c:755
static int Abc_Base2Log(unsigned n)
Definition: abc_global.h:251
int funcVar0
Definition: mpmInt.h:126
Mpm_LibLut_t * pLib
Definition: mpm.h:59
Mmr_Step_t * pManCuts
Definition: mpmInt.h:110
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
Vec_Int_t vEstRefs
Definition: mpmInt.h:146
Vec_Int_t vMigRefs
Definition: mpmInt.h:144
static int Vec_MemHashInsert(Vec_Mem_t *p, word *pEntry)
Definition: vecMem.h:351
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
#define assert(ex)
Definition: util_old.h:213
Vec_Ptr_t vFreeUnits
Definition: mpmInt.h:115
int LutMax
Definition: mpm.h:50
Mpm_Uni_t pCutUnits[MPM_CUT_MAX+1]
Definition: mpmInt.h:114
int nLutSize
Definition: mpmInt.h:100
int fUseTruth
Definition: mpm.h:64
static int Mpm_CutWordNum(int nLeaves)
Definition: mpmInt.h:174
int fUseDsd
Definition: mpm.h:65
void Mpm_ManStop ( Mpm_Man_t p)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 111 of file mpmMan.c.

112 {
113  if ( p->pPars->fUseTruth && p->pPars->fVeryVerbose )
114  {
115  char * pFileName = "truths.txt";
116  FILE * pFile = fopen( pFileName, "wb" );
117  Vec_MemDump( pFile, p->vTtMem );
118  fclose( pFile );
119  printf( "Dumped %d %d-var truth tables into file \"%s\" (%.2f MB).\n",
120  Vec_MemEntryNum(p->vTtMem), p->nLutSize, pFileName,
121  (16.0 * p->nTruWords + 1.0) * Vec_MemEntryNum(p->vTtMem) / (1 << 20) );
122  }
123  if ( p->pPars->fUseDsd && p->pPars->fVerbose )
125  if ( p->vTtMem )
126  {
127  Vec_MemHashFree( p->vTtMem );
128  Vec_MemFree( p->vTtMem );
129  }
130  if ( p->pHash )
131  {
132  Vec_WrdFree( p->vPerm6 );
133  Vec_IntFree( p->vMap2Perm );
134  Vec_IntFree( p->vConfgRes );
135  Vec_IntFree( p->pHash->vData );
136  Hsh_IntManStop( p->pHash );
137  }
138  Vec_WecFreeP( &p->vNpnConfigs );
139  Vec_PtrFree( p->vTemp );
140  Mmr_StepStop( p->pManCuts );
141  ABC_FREE( p->vFreeUnits.pArray );
142  // mapping attributes
143  ABC_FREE( p->vCutBests.pArray );
144  ABC_FREE( p->vCutLists.pArray );
145  ABC_FREE( p->vMigRefs.pArray );
146  ABC_FREE( p->vMapRefs.pArray );
147  ABC_FREE( p->vEstRefs.pArray );
148  ABC_FREE( p->vRequireds.pArray );
149  ABC_FREE( p->vTimes.pArray );
150  ABC_FREE( p->vAreas.pArray );
151  ABC_FREE( p->vEdges.pArray );
152  ABC_FREE( p );
153 }
Mpm_Par_t * pPars
Definition: mpmInt.h:98
Vec_Ptr_t * vTemp
Definition: mpmInt.h:116
Vec_Int_t vRequireds
Definition: mpmInt.h:147
Vec_Int_t vMapRefs
Definition: mpmInt.h:145
static int Vec_MemEntryNum(Vec_Mem_t *p)
Definition: vecMem.h:151
Vec_Mem_t * vTtMem
Definition: mpmInt.h:124
int fVerbose
Definition: mpm.h:72
Vec_Wrd_t * vPerm6
Definition: mpmInt.h:135
Vec_Int_t * vData
Definition: vecHsh.h:60
Vec_Int_t vCutBests
Definition: mpmInt.h:142
Vec_Wec_t * vNpnConfigs
Definition: mpmInt.h:140
int nTruWords
Definition: mpmInt.h:102
static void Vec_WrdFree(Vec_Wrd_t *p)
Definition: vecWrd.h:260
Hsh_IntMan_t * pHash
Definition: mpmInt.h:133
Vec_Int_t vTimes
Definition: mpmInt.h:148
Vec_Int_t vAreas
Definition: mpmInt.h:149
void Mpm_ManPrintDsdStats(Mpm_Man_t *p)
Definition: mpmDsd.c:665
static void Hsh_IntManStop(Hsh_IntMan_t *p)
Definition: vecHsh.h:119
static void Vec_MemFree(Vec_Mem_t *p)
Definition: utilMem.c:93
Vec_Int_t vCutLists
Definition: mpmInt.h:143
Vec_Int_t * vMap2Perm
Definition: mpmInt.h:137
Vec_Int_t vEdges
Definition: mpmInt.h:150
static void Vec_MemDump(FILE *pFile, Vec_Mem_t *pVec)
Definition: vecMem.h:279
#define ABC_FREE(obj)
Definition: abc_global.h:232
Mmr_Step_t * pManCuts
Definition: mpmInt.h:110
Vec_Int_t vEstRefs
Definition: mpmInt.h:146
Vec_Int_t vMigRefs
Definition: mpmInt.h:144
static void Vec_WecFreeP(Vec_Wec_t **p)
Definition: vecWec.h:350
static void Vec_MemHashFree(Vec_Mem_t *p)
Definition: vecMem.h:311
static void Mmr_StepStop(Mmr_Step_t *p)
Definition: mem2.h:229
Vec_Ptr_t vFreeUnits
Definition: mpmInt.h:115
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
int nLutSize
Definition: mpmInt.h:100
int fUseTruth
Definition: mpm.h:64
int fVeryVerbose
Definition: mpm.h:73
Vec_Int_t * vConfgRes
Definition: mpmInt.h:134
int fUseDsd
Definition: mpm.h:65
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
static int Mpm_ObjArea ( Mpm_Man_t p,
Mig_Obj_t pObj 
)
inlinestatic

Definition at line 202 of file mpmInt.h.

202 { return Vec_IntEntry(&p->vAreas, Mig_ObjId(pObj)); }
static int Mig_ObjId(Mig_Obj_t *p)
Definition: mpmMig.h:146
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t vAreas
Definition: mpmInt.h:149
static int Mpm_ObjCutBest ( Mpm_Man_t p,
Mig_Obj_t pObj 
)
inlinestatic

MACRO DEFINITIONS ///.

Definition at line 171 of file mpmInt.h.

171 { return Vec_IntEntry(&p->vCutBests, Mig_ObjId(pObj)); }
static int Mig_ObjId(Mig_Obj_t *p)
Definition: mpmMig.h:146
Vec_Int_t vCutBests
Definition: mpmInt.h:142
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static Mpm_Cut_t* Mpm_ObjCutBestP ( Mpm_Man_t p,
Mig_Obj_t pObj 
)
inlinestatic

Definition at line 176 of file mpmInt.h.

176 { return Mpm_CutFetch( p, Mpm_ObjCutBest(p, pObj) ); }
static int Mpm_ObjCutBest(Mpm_Man_t *p, Mig_Obj_t *pObj)
MACRO DEFINITIONS ///.
Definition: mpmInt.h:171
static Mpm_Cut_t * Mpm_CutFetch(Mpm_Man_t *p, int h)
Definition: mpmInt.h:175
static int Mpm_ObjCutList ( Mpm_Man_t p,
Mig_Obj_t pObj 
)
inlinestatic

Definition at line 178 of file mpmInt.h.

178 { return Vec_IntEntry(&p->vCutLists, Mig_ObjId(pObj)); }
static int Mig_ObjId(Mig_Obj_t *p)
Definition: mpmMig.h:146
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t vCutLists
Definition: mpmInt.h:143
static int* Mpm_ObjCutListP ( Mpm_Man_t p,
Mig_Obj_t pObj 
)
inlinestatic

Definition at line 179 of file mpmInt.h.

179 { return Vec_IntEntryP(&p->vCutLists, Mig_ObjId(pObj)); }
static int Mig_ObjId(Mig_Obj_t *p)
Definition: mpmMig.h:146
Vec_Int_t vCutLists
Definition: mpmInt.h:143
static int * Vec_IntEntryP(Vec_Int_t *p, int i)
Definition: vecInt.h:417
static int Mpm_ObjEdge ( Mpm_Man_t p,
Mig_Obj_t pObj 
)
inlinestatic

Definition at line 205 of file mpmInt.h.

205 { return Vec_IntEntry(&p->vEdges, Mig_ObjId(pObj)); }
static int Mig_ObjId(Mig_Obj_t *p)
Definition: mpmMig.h:146
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t vEdges
Definition: mpmInt.h:150
static int Mpm_ObjEstRef ( Mpm_Man_t p,
Mig_Obj_t pObj 
)
inlinestatic

Definition at line 192 of file mpmInt.h.

192 { return Vec_IntEntry(&p->vEstRefs, Mig_ObjId(pObj)); }
static int Mig_ObjId(Mig_Obj_t *p)
Definition: mpmMig.h:146
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t vEstRefs
Definition: mpmInt.h:146
static int Mpm_ObjMapRef ( Mpm_Man_t p,
Mig_Obj_t pObj 
)
inlinestatic

Definition at line 189 of file mpmInt.h.

189 { return Vec_IntEntry(&p->vMapRefs, Mig_ObjId(pObj)); }
Vec_Int_t vMapRefs
Definition: mpmInt.h:145
static int Mig_ObjId(Mig_Obj_t *p)
Definition: mpmMig.h:146
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Mpm_ObjRequired ( Mpm_Man_t p,
Mig_Obj_t pObj 
)
inlinestatic

Definition at line 196 of file mpmInt.h.

196 { return Vec_IntEntry(&p->vRequireds, Mig_ObjId(pObj)); }
Vec_Int_t vRequireds
Definition: mpmInt.h:147
static int Mig_ObjId(Mig_Obj_t *p)
Definition: mpmMig.h:146
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Mpm_ObjSetArea ( Mpm_Man_t p,
Mig_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 203 of file mpmInt.h.

203 { Vec_IntWriteEntry(&p->vAreas, Mig_ObjId(pObj), i); }
static int Mig_ObjId(Mig_Obj_t *p)
Definition: mpmMig.h:146
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
Vec_Int_t vAreas
Definition: mpmInt.h:149
static void Mpm_ObjSetCutBest ( Mpm_Man_t p,
Mig_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 172 of file mpmInt.h.

172 { Vec_IntWriteEntry(&p->vCutBests, Mig_ObjId(pObj), i); }
static int Mig_ObjId(Mig_Obj_t *p)
Definition: mpmMig.h:146
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
Vec_Int_t vCutBests
Definition: mpmInt.h:142
static void Mpm_ObjSetCutList ( Mpm_Man_t p,
Mig_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 180 of file mpmInt.h.

180 { Vec_IntWriteEntry(&p->vCutLists, Mig_ObjId(pObj), i); }
static int Mig_ObjId(Mig_Obj_t *p)
Definition: mpmMig.h:146
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
Vec_Int_t vCutLists
Definition: mpmInt.h:143
static void Mpm_ObjSetEdge ( Mpm_Man_t p,
Mig_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 206 of file mpmInt.h.

206 { Vec_IntWriteEntry(&p->vEdges, Mig_ObjId(pObj), i); }
static int Mig_ObjId(Mig_Obj_t *p)
Definition: mpmMig.h:146
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
Vec_Int_t vEdges
Definition: mpmInt.h:150
static void Mpm_ObjSetEstRef ( Mpm_Man_t p,
Mig_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 193 of file mpmInt.h.

193 { Vec_IntWriteEntry(&p->vEstRefs, Mig_ObjId(pObj), i); }
static int Mig_ObjId(Mig_Obj_t *p)
Definition: mpmMig.h:146
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
Vec_Int_t vEstRefs
Definition: mpmInt.h:146
static void Mpm_ObjSetMapRef ( Mpm_Man_t p,
Mig_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 190 of file mpmInt.h.

190 { Vec_IntWriteEntry(&p->vMapRefs, Mig_ObjId(pObj), i); }
Vec_Int_t vMapRefs
Definition: mpmInt.h:145
static int Mig_ObjId(Mig_Obj_t *p)
Definition: mpmMig.h:146
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static void Mpm_ObjSetRequired ( Mpm_Man_t p,
Mig_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 197 of file mpmInt.h.

197 { Vec_IntWriteEntry(&p->vRequireds, Mig_ObjId(pObj), i); }
Vec_Int_t vRequireds
Definition: mpmInt.h:147
static int Mig_ObjId(Mig_Obj_t *p)
Definition: mpmMig.h:146
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static void Mpm_ObjSetTime ( Mpm_Man_t p,
Mig_Obj_t pObj,
int  i 
)
inlinestatic

Definition at line 200 of file mpmInt.h.

200 { Vec_IntWriteEntry(&p->vTimes, Mig_ObjId(pObj), i); }
static int Mig_ObjId(Mig_Obj_t *p)
Definition: mpmMig.h:146
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
Vec_Int_t vTimes
Definition: mpmInt.h:148
static int Mpm_ObjTime ( Mpm_Man_t p,
Mig_Obj_t pObj 
)
inlinestatic

Definition at line 199 of file mpmInt.h.

199 { return Vec_IntEntry(&p->vTimes, Mig_ObjId(pObj)); }
static int Mig_ObjId(Mig_Obj_t *p)
Definition: mpmMig.h:146
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t vTimes
Definition: mpmInt.h:148
static void Mpm_VarsClear ( int *  V2P,
int *  P2V,
int  nVars 
)
inlinestatic

Definition at line 208 of file mpmInt.h.

208 { int i; for ( i = 0; i < nVars; i++ ) V2P[i] = P2V[i] = i; }
static void Mpm_VarsSwap ( int *  V2P,
int *  P2V,
int  iVar,
int  jVar 
)
inlinestatic

Definition at line 209 of file mpmInt.h.

209 { V2P[P2V[iVar]] = jVar; V2P[P2V[jVar]] = iVar; P2V[iVar] ^= P2V[jVar]; P2V[jVar] ^= P2V[iVar]; P2V[iVar] ^= P2V[jVar]; }