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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START
Dch_Man_t
Dch_ManCreate (Aig_Man_t *pAig, Dch_Pars_t *pPars)
 DECLARATIONS ///. More...
 
void Dch_ManPrintStats (Dch_Man_t *p)
 
void Dch_ManStop (Dch_Man_t *p)
 
void Dch_ManSatSolverRecycle (Dch_Man_t *p)
 

Function Documentation

ABC_NAMESPACE_IMPL_START Dch_Man_t* Dch_ManCreate ( Aig_Man_t pAig,
Dch_Pars_t pPars 
)

DECLARATIONS ///.

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

FileName [dchMan.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Choice computation for tech-mapping.]

Synopsis [Calls to the SAT solver.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 29, 2008.]

Revision [

Id:
dchMan.c,v 1.00 2008/07/29 00:00:00 alanmi Exp

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

Synopsis [Creates the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file dchMan.c.

46 {
47  Dch_Man_t * p;
48  // create interpolation manager
49  p = ABC_ALLOC( Dch_Man_t, 1 );
50  memset( p, 0, sizeof(Dch_Man_t) );
51  p->pPars = pPars;
52  p->pAigTotal = pAig; //Dch_DeriveTotalAig( vAigs );
54  // SAT solving
55  p->nSatVars = 1;
57  p->vUsedNodes = Vec_PtrAlloc( 1000 );
58  p->vFanins = Vec_PtrAlloc( 100 );
59  p->vSimRoots = Vec_PtrAlloc( 1000 );
60  p->vSimClasses = Vec_PtrAlloc( 1000 );
61  // equivalences proved
63  return p;
64 }
char * memset()
int nSatVars
Definition: dchInt.h:64
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Vec_Ptr_t * vSimRoots
Definition: dchInt.h:70
void Aig_ManFanoutStart(Aig_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition: aigFanout.c:56
int * pSatVars
Definition: dchInt.h:65
Vec_Ptr_t * vSimClasses
Definition: dchInt.h:71
Definition: aig.h:69
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
Vec_Ptr_t * vUsedNodes
Definition: dchInt.h:66
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Vec_Ptr_t * vFanins
Definition: dchInt.h:69
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
Aig_Man_t * pAigTotal
Definition: dchInt.h:57
Dch_Pars_t * pPars
Definition: dchInt.h:54
Aig_Obj_t ** pReprsProved
Definition: dchInt.h:61
void Dch_ManPrintStats ( Dch_Man_t p)

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

Synopsis [Prints stats of the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 77 of file dchMan.c.

78 {
79  int nNodeNum = Aig_ManNodeNum(p->pAigTotal) / 3;
80  Abc_Print( 1, "Parameters: Sim words = %d. Conf limit = %d. SAT var max = %d.\n",
81  p->pPars->nWords, p->pPars->nBTLimit, p->pPars->nSatVarMax );
82  Abc_Print( 1, "AIG nodes : Total = %6d. Dangling = %6d. Main = %6d. (%6.2f %%)\n",
84  Aig_ManNodeNum(p->pAigTotal)-nNodeNum,
85  nNodeNum,
86  100.0 * nNodeNum/Aig_ManNodeNum(p->pAigTotal) );
87  Abc_Print( 1, "SAT solver: Vars = %d. Max cone = %d. Recycles = %d.\n",
88  p->nSatVars, p->nConeMax, p->nRecycles );
89  Abc_Print( 1, "SAT calls : All = %6d. Unsat = %6d. Sat = %6d. Fail = %6d.\n",
91  p->nSatCallsSat, p->nSatFailsReal );
92  Abc_Print( 1, "Choices : Lits = %6d. Reprs = %5d. Equivs = %5d. Choices = %5d.\n",
93  p->nLits, p->nReprs, p->nEquivs, p->nChoices );
94  Abc_Print( 1, "Choicing runtime statistics:\n" );
96  Abc_PrintTimeP( 1, "Sim init ", p->timeSimInit, p->timeTotal );
97  Abc_PrintTimeP( 1, "Sim SAT ", p->timeSimSat, p->timeTotal );
98  Abc_PrintTimeP( 1, "SAT solving", p->timeSat, p->timeTotal );
99  Abc_PrintTimeP( 1, " sat ", p->timeSatSat, p->timeTotal );
100  Abc_PrintTimeP( 1, " unsat ", p->timeSatUnsat, p->timeTotal );
101  Abc_PrintTimeP( 1, " undecided", p->timeSatUndec, p->timeTotal );
102  Abc_PrintTimeP( 1, "Choice ", p->timeChoice, p->timeTotal );
103  Abc_PrintTimeP( 1, "Other ", p->timeOther, p->timeTotal );
104  Abc_PrintTimeP( 1, "TOTAL ", p->timeTotal, p->timeTotal );
105  if ( p->pPars->timeSynth )
106  {
107  Abc_PrintTime( 1, "Synthesis ", p->pPars->timeSynth );
108  }
109 }
abctime timeOther
Definition: dchInt.h:94
int nReprs
Definition: dchInt.h:83
int nSatVars
Definition: dchInt.h:64
abctime timeSimSat
Definition: dchInt.h:88
int nSatCallsSat
Definition: dchInt.h:80
abctime timeSatUnsat
Definition: dchInt.h:91
static void Abc_PrintTimeP(int level, const char *pStr, abctime time, abctime Time)
Definition: abc_global.h:372
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
int nLits
Definition: dchInt.h:82
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
abctime timeChoice
Definition: dchInt.h:93
int nConeMax
Definition: dchInt.h:74
abctime timeSat
Definition: dchInt.h:89
int nEquivs
Definition: dchInt.h:84
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
abctime timeSatSat
Definition: dchInt.h:90
abctime timeTotal
Definition: dchInt.h:95
abctime timeSatUndec
Definition: dchInt.h:92
int nSatCalls
Definition: dchInt.h:76
abctime timeSimInit
Definition: dchInt.h:87
Aig_Man_t * pAigTotal
Definition: dchInt.h:57
Dch_Pars_t * pPars
Definition: dchInt.h:54
int nChoices
Definition: dchInt.h:85
int nSatFailsReal
Definition: dchInt.h:78
int nRecycles
Definition: dchInt.h:67
void Dch_ManSatSolverRecycle ( Dch_Man_t p)

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

Synopsis [Recycles the SAT solver.]

Description []

SideEffects []

SeeAlso []

Definition at line 153 of file dchMan.c.

154 {
155  int Lit;
156  if ( p->pSat )
157  {
158  Aig_Obj_t * pObj;
159  int i;
160  Vec_PtrForEachEntry( Aig_Obj_t *, p->vUsedNodes, pObj, i )
161  Dch_ObjSetSatNum( p, pObj, 0 );
162  Vec_PtrClear( p->vUsedNodes );
163 // memset( p->pSatVars, 0, sizeof(int) * Aig_ManObjNumMax(p->pAigTotal) );
164  sat_solver_delete( p->pSat );
165  }
166  p->pSat = sat_solver_new();
167  sat_solver_setnvars( p->pSat, 1000 );
168  // var 0 is not used
169  // var 1 is reserved for const1 node - add the clause
170  p->nSatVars = 1;
171 // p->nSatVars = 0;
172  Lit = toLit( p->nSatVars );
173  if ( p->pPars->fPolarFlip )
174  Lit = lit_neg( Lit );
175  sat_solver_addclause( p->pSat, &Lit, &Lit + 1 );
176  Dch_ObjSetSatNum( p, Aig_ManConst1(p->pAigFraig), p->nSatVars++ );
177 
178  p->nRecycles++;
179  p->nCallsSince = 0;
180 }
int sat_solver_addclause(sat_solver *s, lit *begin, lit *end)
Definition: satSolver.c:1492
void sat_solver_delete(sat_solver *s)
Definition: satSolver.c:1141
static lit lit_neg(lit l)
Definition: satVec.h:144
static lit toLit(int v)
Definition: satVec.h:142
void sat_solver_setnvars(sat_solver *s, int n)
Definition: satSolver.c:1072
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
Vec_Ptr_t * vUsedNodes
Definition: dchInt.h:66
sat_solver * pSat
Definition: dchInt.h:63
sat_solver * sat_solver_new(void)
Definition: satSolver.c:1001
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
static void Dch_ObjSetSatNum(Dch_Man_t *p, Aig_Obj_t *pObj, int Num)
Definition: dchInt.h:103
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Dch_ManStop ( Dch_Man_t p)

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

Synopsis [Frees the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 122 of file dchMan.c.

123 {
125  if ( p->pPars->fVerbose )
126  Dch_ManPrintStats( p );
127  if ( p->pAigFraig )
128  Aig_ManStop( p->pAigFraig );
129  if ( p->ppClasses )
131  if ( p->pSat )
132  sat_solver_delete( p->pSat );
133  Vec_PtrFree( p->vUsedNodes );
134  Vec_PtrFree( p->vFanins );
135  Vec_PtrFree( p->vSimRoots );
136  Vec_PtrFree( p->vSimClasses );
137  ABC_FREE( p->pReprsProved );
138  ABC_FREE( p->pSatVars );
139  ABC_FREE( p );
140 }
void Dch_ManPrintStats(Dch_Man_t *p)
Definition: dchMan.c:77
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
Aig_Man_t * pAigFraig
Definition: dchInt.h:58
void sat_solver_delete(sat_solver *s)
Definition: satSolver.c:1141
void Dch_ClassesStop(Dch_Cla_t *p)
Definition: dchClass.c:185
Vec_Ptr_t * vSimRoots
Definition: dchInt.h:70
void Aig_ManFanoutStop(Aig_Man_t *p)
Definition: aigFanout.c:89
int * pSatVars
Definition: dchInt.h:65
Vec_Ptr_t * vSimClasses
Definition: dchInt.h:71
Dch_Cla_t * ppClasses
Definition: dchInt.h:60
Vec_Ptr_t * vUsedNodes
Definition: dchInt.h:66
sat_solver * pSat
Definition: dchInt.h:63
#define ABC_FREE(obj)
Definition: abc_global.h:232
Vec_Ptr_t * vFanins
Definition: dchInt.h:69
Aig_Man_t * pAigTotal
Definition: dchInt.h:57
Dch_Pars_t * pPars
Definition: dchInt.h:54
Aig_Obj_t ** pReprsProved
Definition: dchInt.h:61
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223