abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
mpmMan.c File Reference
#include "mpmInt.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START
Mpm_Man_t
Mpm_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)
 

Function Documentation

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
ABC_NAMESPACE_IMPL_START 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