abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
llbInt.h File Reference
#include <stdio.h>
#include "aig/aig/aig.h"
#include "aig/saig/saig.h"
#include "proof/ssw/ssw.h"
#include "misc/extra/extraBdd.h"
#include "llb.h"

Go to the source code of this file.

Data Structures

struct  Llb_Man_t_
 
struct  Llb_Mtr_t_
 
struct  Llb_Grp_t_
 

Typedefs

typedef
typedefABC_NAMESPACE_HEADER_START
struct Llb_Man_t_ 
Llb_Man_t
 INCLUDES ///. More...
 
typedef struct Llb_Mtr_t_ Llb_Mtr_t
 
typedef struct Llb_Grp_t_ Llb_Grp_t
 

Functions

static int Llb_ObjBddVar (Vec_Int_t *vOrder, Aig_Obj_t *pObj)
 MACRO DEFINITIONS ///. More...
 
Vec_Int_tLlb_ManDeriveConstraints (Aig_Man_t *p)
 FUNCTION DECLARATIONS ///. More...
 
void Llb_ManPrintEntries (Aig_Man_t *p, Vec_Int_t *vCands)
 
int Llb_ManModelCheckAig (Aig_Man_t *pAigGlo, Gia_ParLlb_t *pPars, Vec_Int_t *vHints, DdManager **pddGlo)
 
void Llb_ManCluster (Llb_Mtr_t *p)
 
void Llb_ManDumpReached (DdManager *ddG, DdNode *bReached, char *pModel, char *pFileName)
 
Vec_Ptr_tLlb_ManFlow (Aig_Man_t *p, Vec_Ptr_t *vSources, int *pnFlow)
 
int Llb_ManReachabilityWithHints (Llb_Man_t *p)
 
int Llb_ManModelCheckAigWithHints (Aig_Man_t *pAigGlo, Gia_ParLlb_t *pPars)
 
void Llb_ManPrepareVarMap (Llb_Man_t *p)
 DECLARATIONS ///. More...
 
Llb_Man_tLlb_ManStart (Aig_Man_t *pAigGlo, Aig_Man_t *pAig, Gia_ParLlb_t *pPars)
 
void Llb_ManStop (Llb_Man_t *p)
 
void Llb_MtrVerifyMatrix (Llb_Mtr_t *p)
 
Llb_Mtr_tLlb_MtrCreate (Llb_Man_t *p)
 
void Llb_MtrFree (Llb_Mtr_t *p)
 
void Llb_MtrPrint (Llb_Mtr_t *p, int fOrder)
 
void Llb_MtrPrintMatrixStats (Llb_Mtr_t *p)
 
Llb_Grp_tLlb_ManGroupAlloc (Llb_Man_t *pMan)
 DECLARATIONS ///. More...
 
void Llb_ManGroupStop (Llb_Grp_t *p)
 
void Llb_ManPrepareGroups (Llb_Man_t *pMan)
 
Llb_Grp_tLlb_ManGroupsCombine (Llb_Grp_t *p1, Llb_Grp_t *p2)
 
Llb_Grp_tLlb_ManGroupCreateFromCuts (Llb_Man_t *pMan, Vec_Int_t *vCut1, Vec_Int_t *vCut2)
 
void Llb_ManPrepareVarLimits (Llb_Man_t *p)
 
int Llb_ManTracePaths (Aig_Man_t *p, Aig_Obj_t *pPivot)
 
Vec_Int_tLlb_ManMarkPivotNodes (Aig_Man_t *p, int fUseInternal)
 
int Llb_ManReachability (Llb_Man_t *p, Vec_Int_t *vHints, DdManager **pddGlo)
 
void Llb_MtrSchedule (Llb_Mtr_t *p)
 
DdNodeLlb_BddComputeBad (Aig_Man_t *pInit, DdManager *dd, abctime TimeOut)
 DECLARATIONS ///. More...
 
DdNodeLlb_BddQuantifyPis (Aig_Man_t *pInit, DdManager *dd, DdNode *bFunc)
 
DdNodeLlb_CoreComputeCube (DdManager *dd, Vec_Int_t *vVars, int fUseVarIndex, char *pValues)
 FUNCTION DEFINITIONS ///. More...
 
int Llb_CoreExperiment (Aig_Man_t *pInit, Aig_Man_t *pAig, Gia_ParLlb_t *pPars, Vec_Ptr_t *vResult, abctime TimeTarget)
 
Vec_Int_tLlb_DriverCountRefs (Aig_Man_t *p)
 DECLARATIONS ///. More...
 
Vec_Int_tLlb_DriverCollectNs (Aig_Man_t *pAig, Vec_Int_t *vDriRefs)
 
Vec_Int_tLlb_DriverCollectCs (Aig_Man_t *pAig)
 
DdNodeLlb_DriverPhaseCube (Aig_Man_t *pAig, Vec_Int_t *vDriRefs, DdManager *dd)
 
DdManagerLlb_DriverLastPartition (Aig_Man_t *p, Vec_Int_t *vVarsNs, abctime TimeTarget)
 
Vec_Ptr_tLlb_ImgSupports (Aig_Man_t *p, Vec_Ptr_t *vDdMans, Vec_Int_t *vStart, Vec_Int_t *vStop, int fAddPis, int fVerbose)
 FUNCTION DEFINITIONS ///. More...
 
void Llb_ImgSchedule (Vec_Ptr_t *vSupps, Vec_Ptr_t **pvQuant0, Vec_Ptr_t **pvQuant1, int fVerbose)
 
DdManagerLlb_ImgPartition (Aig_Man_t *p, Vec_Ptr_t *vLower, Vec_Ptr_t *vUpper, abctime TimeTarget)
 
void Llb_ImgQuantifyFirst (Aig_Man_t *pAig, Vec_Ptr_t *vDdMans, Vec_Ptr_t *vQuant0, int fVerbose)
 
void Llb_ImgQuantifyReset (Vec_Ptr_t *vDdMans)
 
DdNodeLlb_ImgComputeImage (Aig_Man_t *pAig, Vec_Ptr_t *vDdMans, DdManager *dd, DdNode *bInit, Vec_Ptr_t *vQuant0, Vec_Ptr_t *vQuant1, Vec_Int_t *vDriRefs, abctime TimeTarget, int fBackward, int fReorder, int fVerbose)
 
DdManagerLlb_NonlinImageStart (Aig_Man_t *pAig, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vRoots, int *pVars2Q, int *pOrder, int fFirst, abctime TimeTarget)
 
DdNodeLlb_NonlinImageCompute (DdNode *bCurrent, int fReorder, int fDrop, int fVerbose, int *pOrder)
 
void Llb_NonlinImageQuit ()
 
DdNodeLlb_NonlinImage (Aig_Man_t *pAig, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vRoots, int *pVars2Q, DdManager *dd, DdNode *bCurrent, int fReorder, int fVerbose, int *pOrder)
 
DdNodeLlb_NonlinComputeInitState (Aig_Man_t *pAig, DdManager *dd)
 
Abc_Cex_tLlb4_Nonlin4TransformCex (Aig_Man_t *pAig, Vec_Ptr_t *vStates, int iCexPo, int fVerbose)
 DECLARATIONS ///. More...
 
DdNodeLlb_Nonlin4Image (DdManager *dd, Vec_Ptr_t *vParts, DdNode *bCurrent, Vec_Int_t *vVars2Q)
 
Vec_Ptr_tLlb_Nonlin4Group (DdManager *dd, Vec_Ptr_t *vParts, Vec_Int_t *vVars2Q, int nSizeMax)
 
void Llb4_Nonlin4Sweep (Aig_Man_t *pAig, int nSweepMax, int nClusterMax, DdManager **pdd, Vec_Int_t **pvOrder, Vec_Ptr_t **pvGroups, int fVerbose)
 

Typedef Documentation

typedef struct Llb_Grp_t_ Llb_Grp_t

Definition at line 48 of file llbInt.h.

typedef typedefABC_NAMESPACE_HEADER_START struct Llb_Man_t_ Llb_Man_t

INCLUDES ///.

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

FileName [llbInt.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [BDD-based reachability.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - May 8, 2010.]

Revision [

Id:
llbInt.h,v 1.00 2010/05/08 00:00:00 alanmi Exp

]PARAMETERS ///BASIC TYPES ///

Definition at line 46 of file llbInt.h.

typedef struct Llb_Mtr_t_ Llb_Mtr_t

Definition at line 47 of file llbInt.h.

Function Documentation

void Llb4_Nonlin4Sweep ( Aig_Man_t pAig,
int  nSweepMax,
int  nClusterMax,
DdManager **  pdd,
Vec_Int_t **  pvOrder,
Vec_Ptr_t **  pvGroups,
int  fVerbose 
)

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

Synopsis [Performs BDD sweep on the netlist.]

Description [Returns BDD manager, ordering, clusters, and bad states inside dd->bFunc.]

SideEffects []

SeeAlso []

Definition at line 520 of file llb4Sweep.c.

521 {
522  DdManager * ddBad, * ddWork;
523  Vec_Ptr_t * vGroups;
524  Vec_Int_t * vOrder;
525  int Counter, nCutPoints;
526 
527  // get the original ordering
528  Aig_ManCleanMarkA( pAig );
529  vOrder = Llb_Nonlin4SweepOrder( pAig, &Counter, 1 );
530  assert( Counter == Aig_ManNodeNum(pAig) );
531  // mark the nodes
532  nCutPoints = Llb4_Nonlin4SweepCutpoints( pAig, vOrder, nSweepMax, fVerbose );
533  Vec_IntFree( vOrder );
534  // get better ordering
535  vOrder = Llb_Nonlin4SweepOrder( pAig, &Counter, 0 );
536  assert( Counter == nCutPoints );
537  Aig_ManCleanMarkA( pAig );
538  // compute the BAD states
539  ddBad = Llb4_Nonlin4SweepBadStates( pAig, vOrder, nCutPoints + Aig_ManCiNum(pAig) + Aig_ManCoNum(pAig) );
540  // compute the clusters
541  ddWork = Llb4_Nonlin4SweepGroups( pAig, vOrder, nCutPoints + Aig_ManCiNum(pAig) + Aig_ManCoNum(pAig), &vGroups, nClusterMax, fVerbose );
542  // transfer the result from the Bad manager
543 //printf( "Bad before = %d.\n", Cudd_DagSize(ddBad->bFunc) );
544  ddWork->bFunc = Cudd_bddTransfer( ddBad, ddWork, ddBad->bFunc ); Cudd_Ref( ddWork->bFunc );
545  Cudd_RecursiveDeref( ddBad, ddBad->bFunc ); ddBad->bFunc = NULL;
546  Extra_StopManager( ddBad );
547  // update ordering to exclude quantified variables
548 //printf( "Bad after = %d.\n", Cudd_DagSize(ddWork->bFunc) );
549 
550  Llb_Nonlin4SweepPrintSuppProfile( ddWork, pAig, vOrder, vGroups, fVerbose );
551 
552  // return the result
553  *pdd = ddWork;
554  *pvOrder = vOrder;
555  *pvGroups = vGroups;
556 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
DdNode * bFunc
Definition: cuddInt.h:487
void Llb_Nonlin4SweepPrintSuppProfile(DdManager *dd, Aig_Man_t *pAig, Vec_Int_t *vOrder, Vec_Ptr_t *vGroups, int fVerbose)
Definition: llb4Sweep.c:461
void Extra_StopManager(DdManager *dd)
Definition: extraBddMisc.c:223
static int Aig_ManNodeNum(Aig_Man_t *p)
Definition: aig.h:256
DdNode * Cudd_bddTransfer(DdManager *ddSource, DdManager *ddDestination, DdNode *f)
Definition: cuddBridge.c:409
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
static int Counter
Vec_Int_t * Llb_Nonlin4SweepOrder(Aig_Man_t *pAig, int *pCounter, int fSaveAll)
Definition: llb4Sweep.c:86
DdManager * Llb4_Nonlin4SweepGroups(Aig_Man_t *pAig, Vec_Int_t *vOrder, int nVars, Vec_Ptr_t **pvGroups, int nBddLimitClp, int fVerbose)
Definition: llb4Sweep.c:420
void Aig_ManCleanMarkA(Aig_Man_t *p)
Definition: aigUtil.c:148
DdManager * Llb4_Nonlin4SweepBadStates(Aig_Man_t *pAig, Vec_Int_t *vOrder, int nVars)
Definition: llb4Sweep.c:384
#define assert(ex)
Definition: util_old.h:213
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
int Llb4_Nonlin4SweepCutpoints(Aig_Man_t *pAig, Vec_Int_t *vOrder, int nBddLimit, int fVerbose)
Definition: llb4Sweep.c:121
Abc_Cex_t* Llb4_Nonlin4TransformCex ( Aig_Man_t pAig,
Vec_Ptr_t vStates,
int  iCexPo,
int  fVerbose 
)

DECLARATIONS ///.

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

FileName [llb2Cex.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [BDD based reachability.]

Synopsis [Non-linear quantification scheduling.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
llb2Cex.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

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

Synopsis [Translates a sequence of states into a counter-example.]

Description []

SideEffects []

SeeAlso []

Definition at line 47 of file llb4Cex.c.

48 {
49  Abc_Cex_t * pCex;
50  Cnf_Dat_t * pCnf;
51  Vec_Int_t * vAssumps;
52  sat_solver * pSat;
53  Aig_Obj_t * pObj;
54  unsigned * pNext, * pThis;
55  int i, k, iBit, status, nRegs;//, clk = Abc_Clock();
56 /*
57  Vec_PtrForEachEntry( unsigned *, vStates, pNext, i )
58  {
59  printf( "%4d : ", i );
60  Extra_PrintBinary( stdout, pNext, Aig_ManRegNum(pAig) );
61  printf( "\n" );
62  }
63 */
64  // derive SAT solver
65  nRegs = Aig_ManRegNum(pAig); pAig->nRegs = 0;
66  pCnf = Cnf_Derive( pAig, Aig_ManCoNum(pAig) );
67  pAig->nRegs = nRegs;
68 // Cnf_DataTranformPolarity( pCnf, 0 );
69  // convert into SAT solver
70  pSat = (sat_solver *)Cnf_DataWriteIntoSolver( pCnf, 1, 0 );
71  if ( pSat == NULL )
72  {
73  printf( "Llb4_Nonlin4TransformCex(): Counter-example generation has failed.\n" );
74  Cnf_DataFree( pCnf );
75  return NULL;
76  }
77  // simplify the problem
78  status = sat_solver_simplify(pSat);
79  if ( status == 0 )
80  {
81  printf( "Llb4_Nonlin4TransformCex(): SAT solver is invalid.\n" );
82  sat_solver_delete( pSat );
83  Cnf_DataFree( pCnf );
84  return NULL;
85  }
86  // start the counter-example
87  pCex = Abc_CexAlloc( Saig_ManRegNum(pAig), Saig_ManPiNum(pAig), Vec_PtrSize(vStates) );
88  pCex->iFrame = Vec_PtrSize(vStates)-1;
89  pCex->iPo = -1;
90 
91  // solve each time frame
92  iBit = Saig_ManRegNum(pAig);
93  pThis = (unsigned *)Vec_PtrEntry( vStates, 0 );
94  vAssumps = Vec_IntAlloc( 2 * Aig_ManRegNum(pAig) );
95  Vec_PtrForEachEntryStart( unsigned *, vStates, pNext, i, 1 )
96  {
97  // create assumptions
98  Vec_IntClear( vAssumps );
99  Saig_ManForEachLo( pAig, pObj, k )
100  Vec_IntPush( vAssumps, toLitCond( pCnf->pVarNums[Aig_ObjId(pObj)], !Abc_InfoHasBit(pThis,k) ) );
101  Saig_ManForEachLi( pAig, pObj, k )
102  Vec_IntPush( vAssumps, toLitCond( pCnf->pVarNums[Aig_ObjId(pObj)], !Abc_InfoHasBit(pNext,k) ) );
103  // solve SAT problem
104  status = sat_solver_solve( pSat, Vec_IntArray(vAssumps), Vec_IntArray(vAssumps) + Vec_IntSize(vAssumps),
105  (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
106  // if the problem is SAT, get the counterexample
107  if ( status != l_True )
108  {
109  printf( "Llb4_Nonlin4TransformCex(): There is no transition between state %d and %d.\n", i-1, i );
110  Vec_IntFree( vAssumps );
111  sat_solver_delete( pSat );
112  Cnf_DataFree( pCnf );
113  ABC_FREE( pCex );
114  return NULL;
115  }
116  // get the assignment of PIs
117  Saig_ManForEachPi( pAig, pObj, k )
118  if ( sat_solver_var_value(pSat, pCnf->pVarNums[Aig_ObjId(pObj)]) )
119  Abc_InfoSetBit( pCex->pData, iBit + k );
120  // update the counter
121  iBit += Saig_ManPiNum(pAig);
122  pThis = pNext;
123  }
124 
125  // add the last frame when the property fails
126  Vec_IntClear( vAssumps );
127  if ( iCexPo >= 0 )
128  {
129  Saig_ManForEachPo( pAig, pObj, k )
130  if ( k == iCexPo )
131  Vec_IntPush( vAssumps, toLitCond( pCnf->pVarNums[Aig_ObjId(pObj)], 0 ) );
132  }
133  else
134  {
135  Saig_ManForEachPo( pAig, pObj, k )
136  Vec_IntPush( vAssumps, toLitCond( pCnf->pVarNums[Aig_ObjId(pObj)], 0 ) );
137  }
138 
139  // add clause
140  status = sat_solver_addclause( pSat, Vec_IntArray(vAssumps), Vec_IntArray(vAssumps) + Vec_IntSize(vAssumps) );
141  if ( status == 0 )
142  {
143  printf( "Llb4_Nonlin4TransformCex(): The SAT solver is unsat after adding last clause.\n" );
144  Vec_IntFree( vAssumps );
145  sat_solver_delete( pSat );
146  Cnf_DataFree( pCnf );
147  ABC_FREE( pCex );
148  return NULL;
149  }
150  // create assumptions
151  Vec_IntClear( vAssumps );
152  Saig_ManForEachLo( pAig, pObj, k )
153  Vec_IntPush( vAssumps, toLitCond( pCnf->pVarNums[Aig_ObjId(pObj)], !Abc_InfoHasBit(pThis,k) ) );
154  // solve the last frame
155  status = sat_solver_solve( pSat, Vec_IntArray(vAssumps), Vec_IntArray(vAssumps) + Vec_IntSize(vAssumps),
156  (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0, (ABC_INT64_T)0 );
157  if ( status != l_True )
158  {
159  printf( "Llb4_Nonlin4TransformCex(): There is no last transition that makes the property fail.\n" );
160  Vec_IntFree( vAssumps );
161  sat_solver_delete( pSat );
162  Cnf_DataFree( pCnf );
163  ABC_FREE( pCex );
164  return NULL;
165  }
166  // get the assignment of PIs
167  Saig_ManForEachPi( pAig, pObj, k )
168  if ( sat_solver_var_value(pSat, pCnf->pVarNums[Aig_ObjId(pObj)]) )
169  Abc_InfoSetBit( pCex->pData, iBit + k );
170  iBit += Saig_ManPiNum(pAig);
171  assert( iBit == pCex->nBits );
172 
173  // free the sat_solver
174  Vec_IntFree( vAssumps );
175  sat_solver_delete( pSat );
176  Cnf_DataFree( pCnf );
177 
178  // verify counter-example
179  status = Saig_ManFindFailedPoCex( pAig, pCex );
180  if ( status >= 0 && status < Saig_ManPoNum(pAig) )
181  pCex->iPo = status;
182  else
183  {
184  printf( "Llb4_Nonlin4TransformCex(): Counter-example verification has FAILED.\n" );
185  ABC_FREE( pCex );
186  return NULL;
187  }
188  // report the results
189 // if ( fVerbose )
190 // Abc_PrintTime( 1, "SAT-based cex generation time", Abc_Clock() - clk );
191  return pCex;
192 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
Definition: vecPtr.h:57
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
Cnf_Dat_t * Cnf_Derive(Aig_Man_t *pAig, int nOutputs)
Definition: cnfCore.c:165
int sat_solver_addclause(sat_solver *s, lit *begin, lit *end)
Definition: satSolver.c:1492
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_InfoHasBit(unsigned *p, int i)
Definition: abc_global.h:258
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.
Definition: utilCex.c:51
int sat_solver_solve(sat_solver *s, lit *begin, lit *end, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, ABC_INT64_T nConfLimitGlobal, ABC_INT64_T nInsLimitGlobal)
Definition: satSolver.c:1700
void sat_solver_delete(sat_solver *s)
Definition: satSolver.c:1141
#define l_True
Definition: SolverTypes.h:84
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Definition: cnf.h:56
static int sat_solver_var_value(sat_solver *s, int v)
Definition: satSolver.h:200
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
static lit toLitCond(int v, int c)
Definition: satVec.h:143
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
static int Saig_ManRegNum(Aig_Man_t *p)
Definition: saig.h:77
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static void Abc_InfoSetBit(unsigned *p, int i)
Definition: abc_global.h:259
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
int sat_solver_simplify(sat_solver *s)
Definition: satSolver.c:1276
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
void * Cnf_DataWriteIntoSolver(Cnf_Dat_t *p, int nFrames, int fInit)
Definition: cnfMan.c:463
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
#define ABC_FREE(obj)
Definition: abc_global.h:232
void Cnf_DataFree(Cnf_Dat_t *p)
Definition: cnfMan.c:180
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition: utilCex.h:39
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
int Saig_ManFindFailedPoCex(Aig_Man_t *pAig, Abc_Cex_t *p)
Definition: saigDup.c:434
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
DdNode* Llb_BddComputeBad ( Aig_Man_t pInit,
DdManager dd,
abctime  TimeOut 
)

DECLARATIONS ///.

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

FileName [llb2Bad.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [BDD based reachability.]

Synopsis [Computing bad states.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
llb2Bad.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

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

Synopsis [Computes bad in working manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file llb2Bad.c.

46 {
47  Vec_Ptr_t * vNodes;
48  DdNode * bBdd0, * bBdd1, * bTemp, * bResult;
49  Aig_Obj_t * pObj;
50  int i, k;
51  assert( Cudd_ReadSize(dd) == Aig_ManCiNum(pInit) );
52  // initialize elementary variables
53  Aig_ManConst1(pInit)->pData = Cudd_ReadOne( dd );
54  Saig_ManForEachLo( pInit, pObj, i )
55  pObj->pData = Cudd_bddIthVar( dd, i );
56  Saig_ManForEachPi( pInit, pObj, i )
57  pObj->pData = Cudd_bddIthVar( dd, Aig_ManRegNum(pInit) + i );
58  // compute internal nodes
59  vNodes = Aig_ManDfsNodes( pInit, (Aig_Obj_t **)Vec_PtrArray(pInit->vCos), Saig_ManPoNum(pInit) );
60  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
61  {
62  if ( !Aig_ObjIsNode(pObj) )
63  continue;
64  bBdd0 = Cudd_NotCond( (DdNode *)Aig_ObjFanin0(pObj)->pData, Aig_ObjFaninC0(pObj) );
65  bBdd1 = Cudd_NotCond( (DdNode *)Aig_ObjFanin1(pObj)->pData, Aig_ObjFaninC1(pObj) );
66 // pObj->pData = Extra_bddAndTime( dd, bBdd0, bBdd1, TimeOut );
67  pObj->pData = Cudd_bddAnd( dd, bBdd0, bBdd1 );
68  if ( pObj->pData == NULL )
69  {
70  Vec_PtrForEachEntryStop( Aig_Obj_t *, vNodes, pObj, k, i )
71  if ( pObj->pData )
72  Cudd_RecursiveDeref( dd, (DdNode *)pObj->pData );
73  Vec_PtrFree( vNodes );
74  return NULL;
75  }
76  Cudd_Ref( (DdNode *)pObj->pData );
77  }
78  // quantify PIs of each PO
79  bResult = Cudd_ReadLogicZero( dd ); Cudd_Ref( bResult );
80  Saig_ManForEachPo( pInit, pObj, i )
81  {
82  bBdd0 = Cudd_NotCond( Aig_ObjFanin0(pObj)->pData, Aig_ObjFaninC0(pObj) );
83  bResult = Cudd_bddOr( dd, bTemp = bResult, bBdd0 ); Cudd_Ref( bResult );
84  Cudd_RecursiveDeref( dd, bTemp );
85  }
86  // deref
87  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
88  {
89  if ( !Aig_ObjIsNode(pObj) )
90  continue;
91  Cudd_RecursiveDeref( dd, (DdNode *)pObj->pData );
92  }
93  Vec_PtrFree( vNodes );
94  Cudd_Deref( bResult );
95  return bResult;
96 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
void Cudd_Deref(DdNode *node)
Definition: cuddRef.c:438
void * pData
Definition: aig.h:87
DdNode * Cudd_ReadLogicZero(DdManager *dd)
Definition: cuddAPI.c:1058
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
int Cudd_ReadSize(DdManager *dd)
Definition: cuddAPI.c:1441
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
Vec_Ptr_t * Aig_ManDfsNodes(Aig_Man_t *p, Aig_Obj_t **ppNodes, int nNodes)
Definition: aigDfs.c:333
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
DdNode * Cudd_bddOr(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:381
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
DdNode * Cudd_ReadOne(DdManager *dd)
Definition: cuddAPI.c:987
#define Vec_PtrForEachEntryStop(Type, vVec, pEntry, i, Stop)
Definition: vecPtr.h:59
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:416
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define Cudd_NotCond(node, c)
Definition: cudd.h:383
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:314
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
#define assert(ex)
Definition: util_old.h:213
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void ** Vec_PtrArray(Vec_Ptr_t *p)
Definition: vecPtr.h:279
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
DdNode* Llb_BddQuantifyPis ( Aig_Man_t pInit,
DdManager dd,
DdNode bFunc 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 109 of file llb2Bad.c.

110 {
111  DdNode * bVar, * bCube, * bTemp;
112  Aig_Obj_t * pObj;
113  int i;
114  abctime TimeStop;
115  assert( Cudd_ReadSize(dd) == Aig_ManCiNum(pInit) );
116  TimeStop = dd->TimeStop; dd->TimeStop = 0;
117  // create PI cube
118  bCube = Cudd_ReadOne( dd ); Cudd_Ref( bCube );
119  Saig_ManForEachPi( pInit, pObj, i ) {
120  bVar = Cudd_bddIthVar( dd, Aig_ManRegNum(pInit) + i );
121  bCube = Cudd_bddAnd( dd, bTemp = bCube, bVar ); Cudd_Ref( bCube );
122  Cudd_RecursiveDeref( dd, bTemp );
123  }
124  // quantify PI cube
125  bFunc = Cudd_bddExistAbstract( dd, bFunc, bCube ); Cudd_Ref( bFunc );
126  Cudd_RecursiveDeref( dd, bCube );
127  Cudd_Deref( bFunc );
128  dd->TimeStop = TimeStop;
129  return bFunc;
130 }
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
abctime TimeStop
Definition: cuddInt.h:489
Definition: cudd.h:278
void Cudd_Deref(DdNode *node)
Definition: cuddRef.c:438
DdNode * Cudd_bddExistAbstract(DdManager *manager, DdNode *f, DdNode *cube)
Definition: cuddBddAbs.c:130
int Cudd_ReadSize(DdManager *dd)
Definition: cuddAPI.c:1441
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
Definition: aig.h:69
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
DdNode * Cudd_ReadOne(DdManager *dd)
Definition: cuddAPI.c:987
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:416
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:314
#define assert(ex)
Definition: util_old.h:213
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
ABC_INT64_T abctime
Definition: abc_global.h:278
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
DdNode* Llb_CoreComputeCube ( DdManager dd,
Vec_Int_t vVars,
int  fUseVarIndex,
char *  pValues 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Computes cube composed of given variables with given values.]

Description []

SideEffects []

SeeAlso []

Definition at line 68 of file llb2Core.c.

69 {
70  DdNode * bRes, * bVar, * bTemp;
71  int i, iVar, Index;
72  abctime TimeStop;
73  TimeStop = dd->TimeStop; dd->TimeStop = 0;
74  bRes = Cudd_ReadOne( dd ); Cudd_Ref( bRes );
75  Vec_IntForEachEntry( vVars, Index, i )
76  {
77  iVar = fUseVarIndex ? Index : i;
78  bVar = Cudd_NotCond( Cudd_bddIthVar(dd, iVar), (int)(pValues == NULL || pValues[i] != 1) );
79  bRes = Cudd_bddAnd( dd, bTemp = bRes, bVar ); Cudd_Ref( bRes );
80  Cudd_RecursiveDeref( dd, bTemp );
81  }
82  Cudd_Deref( bRes );
83  dd->TimeStop = TimeStop;
84  return bRes;
85 }
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
abctime TimeStop
Definition: cuddInt.h:489
Definition: cudd.h:278
void Cudd_Deref(DdNode *node)
Definition: cuddRef.c:438
DdNode * Cudd_ReadOne(DdManager *dd)
Definition: cuddAPI.c:987
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:416
#define Cudd_NotCond(node, c)
Definition: cudd.h:383
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:314
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
ABC_INT64_T abctime
Definition: abc_global.h:278
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
int Llb_CoreExperiment ( Aig_Man_t pInit,
Aig_Man_t pAig,
Gia_ParLlb_t pPars,
Vec_Ptr_t vResult,
abctime  TimeTarget 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 694 of file llb2Core.c.

695 {
696  int RetValue;
697  Llb_Img_t * p;
698 // printf( "\n" );
699 // pPars->fVerbose = 1;
700  p = Llb_CoreStart( pInit, pAig, pPars );
701  p->vDdMans = Llb_CoreConstructAll( pAig, vResult, p->vVarsNs, TimeTarget );
702  if ( p->vDdMans == NULL )
703  {
704  if ( !pPars->fSilent )
705  printf( "Reached timeout (%d seconds) while deriving the partitions.\n", pPars->TimeLimit );
706  Llb_CoreStop( p );
707  return -1;
708  }
709  RetValue = Llb_CoreReachability( p );
710  Llb_CoreStop( p );
711  return RetValue;
712 }
typedefABC_NAMESPACE_IMPL_START struct Llb_Img_t_ Llb_Img_t
DECLARATIONS ///.
Definition: llb2Core.c:30
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Llb_Img_t * Llb_CoreStart(Aig_Man_t *pInit, Aig_Man_t *pAig, Gia_ParLlb_t *pPars)
Definition: llb2Core.c:618
int Llb_CoreReachability(Llb_Img_t *p)
Definition: llb2Core.c:499
void Llb_CoreStop(Llb_Img_t *p)
Definition: llb2Core.c:650
Vec_Ptr_t * Llb_CoreConstructAll(Aig_Man_t *p, Vec_Ptr_t *vResult, Vec_Int_t *vVarsNs, abctime TimeTarget)
Definition: llb2Core.c:534
Vec_Int_t* Llb_DriverCollectCs ( Aig_Man_t pAig)

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

Synopsis [Returns array of CS variables.]

Description []

SideEffects []

SeeAlso []

Definition at line 106 of file llb2Driver.c.

107 {
108  Vec_Int_t * vVars;
109  Aig_Obj_t * pObj;
110  int i;
111  vVars = Vec_IntAlloc( Aig_ManRegNum(pAig) );
112  Saig_ManForEachLo( pAig, pObj, i )
113  Vec_IntPush( vVars, Aig_ObjId(pObj) );
114  return vVars;
115 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
Vec_Int_t* Llb_DriverCollectNs ( Aig_Man_t pAig,
Vec_Int_t vDriRefs 
)

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

Synopsis [Returns array of NS variables.]

Description []

SideEffects []

SeeAlso []

Definition at line 78 of file llb2Driver.c.

79 {
80  Vec_Int_t * vVars;
81  Aig_Obj_t * pObj, * pDri;
82  int i;
83  vVars = Vec_IntAlloc( Aig_ManRegNum(pAig) );
84  Saig_ManForEachLi( pAig, pObj, i )
85  {
86  pDri = Aig_ObjFanin0(pObj);
87  if ( Vec_IntEntry( vDriRefs, Aig_ObjId(pDri) ) != 1 || Saig_ObjIsPi(pAig, pDri) || Aig_ObjIsConst1(pDri) )
88  Vec_IntPush( vVars, Aig_ObjId(pObj) );
89  else
90  Vec_IntPush( vVars, Aig_ObjId(pDri) );
91  }
92  return vVars;
93 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
static int Saig_ObjIsPi(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:82
Vec_Int_t* Llb_DriverCountRefs ( Aig_Man_t p)

DECLARATIONS ///.

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

FileName [llb2Driver.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [BDD based reachability.]

Synopsis [Procedures working with flop drivers.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
llb2Driver.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

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

Synopsis [Returns the array of times each flop driver is referenced.]

Description []

SideEffects []

SeeAlso []

Definition at line 56 of file llb2Driver.c.

57 {
58  Vec_Int_t * vCounts;
59  Aig_Obj_t * pObj;
60  int i;
61  vCounts = Vec_IntStart( Aig_ManObjNumMax(p) );
62  Saig_ManForEachLi( p, pObj, i )
63  Vec_IntAddToEntry( vCounts, Aig_ObjFaninId0(pObj), 1 );
64  return vCounts;
65 }
static int Aig_ObjFaninId0(Aig_Obj_t *pObj)
Definition: aig.h:304
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
static void Vec_IntAddToEntry(Vec_Int_t *p, int i, int Addition)
Definition: bblif.c:302
Definition: aig.h:69
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
DdManager* Llb_DriverLastPartition ( Aig_Man_t p,
Vec_Int_t vVarsNs,
abctime  TimeTarget 
)

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

Synopsis [Compute the last partition.]

Description []

SideEffects []

SeeAlso []

Definition at line 163 of file llb2Driver.c.

164 {
165 // int fVerbose = 1;
166  DdManager * dd;
167  DdNode * bVar1, * bVar2, * bProd, * bRes, * bTemp;
168  Aig_Obj_t * pObj;
169  int i;
172  dd->TimeStop = TimeTarget;
173  bRes = Cudd_ReadOne(dd); Cudd_Ref( bRes );
174 
175  // mark the duplicated flop inputs
176  Aig_ManForEachObjVec( vVarsNs, p, pObj, i )
177  {
178  if ( !Saig_ObjIsLi(p, pObj) )
179  continue;
180  bVar1 = Cudd_bddIthVar( dd, Aig_ObjId(pObj) );
181  bVar2 = Cudd_bddIthVar( dd, Aig_ObjFaninId0(pObj) );
182  if ( Aig_ObjIsConst1(Aig_ObjFanin0(pObj)) )
183  bVar2 = Cudd_ReadOne(dd);
184  bVar2 = Cudd_NotCond( bVar2, Aig_ObjFaninC0(pObj) );
185  bProd = Cudd_bddXnor( dd, bVar1, bVar2 ); Cudd_Ref( bProd );
186 // bRes = Cudd_bddAnd( dd, bTemp = bRes, bProd ); Cudd_Ref( bRes );
187 // bRes = Extra_bddAndTime( dd, bTemp = bRes, bProd, TimeTarget );
188  bRes = Cudd_bddAnd( dd, bTemp = bRes, bProd );
189  if ( bRes == NULL )
190  {
191  Cudd_RecursiveDeref( dd, bTemp );
192  Cudd_RecursiveDeref( dd, bProd );
193  return NULL;
194  }
195  Cudd_Ref( bRes );
196  Cudd_RecursiveDeref( dd, bTemp );
197  Cudd_RecursiveDeref( dd, bProd );
198  }
199 
200 /*
201  Saig_ManForEachLi( p, pObj, i )
202  printf( "%d ", Aig_ObjId(pObj) );
203  printf( "\n" );
204  Saig_ManForEachLi( p, pObj, i )
205  printf( "%c%d ", Aig_ObjFaninC0(pObj)? '-':'+', Aig_ObjFaninId0(pObj) );
206  printf( "\n" );
207 */
208  Cudd_AutodynDisable( dd );
209 // Cudd_RecursiveDeref( dd, bRes );
210 // Extra_StopManager( dd );
211  dd->bFunc = bRes;
212  dd->TimeStop = 0;
213  return dd;
214 }
#define CUDD_UNIQUE_SLOTS
Definition: cudd.h:97
static int Aig_ObjFaninId0(Aig_Obj_t *pObj)
Definition: aig.h:304
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
abctime TimeStop
Definition: cuddInt.h:489
Definition: cudd.h:278
#define Aig_ManForEachObjVec(vIds, p, pObj, i)
Definition: aig.h:408
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define CUDD_CACHE_SLOTS
Definition: cudd.h:98
DdNode * bFunc
Definition: cuddInt.h:487
static int Saig_ObjIsLi(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:85
DdManager * Cudd_Init(unsigned int numVars, unsigned int numVarsZ, unsigned int numSlots, unsigned int cacheSize, unsigned long maxMemory)
Definition: cuddInit.c:125
static int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
Definition: aig.h:69
DdNode * Cudd_bddXnor(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:507
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
void Cudd_AutodynDisable(DdManager *unique)
Definition: cuddAPI.c:708
DdNode * Cudd_ReadOne(DdManager *dd)
Definition: cuddAPI.c:987
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:416
#define Cudd_NotCond(node, c)
Definition: cudd.h:383
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:314
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
void Cudd_AutodynEnable(DdManager *unique, Cudd_ReorderingType method)
Definition: cuddAPI.c:669
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
DdNode* Llb_DriverPhaseCube ( Aig_Man_t pAig,
Vec_Int_t vDriRefs,
DdManager dd 
)

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

Synopsis [Create cube for phase swapping.]

Description []

SideEffects []

SeeAlso []

Definition at line 128 of file llb2Driver.c.

129 {
130  DdNode * bCube, * bVar, * bTemp;
131  Aig_Obj_t * pObj;
132  int i;
133  abctime TimeStop;
134  TimeStop = dd->TimeStop; dd->TimeStop = 0;
135  bCube = Cudd_ReadOne( dd ); Cudd_Ref( bCube );
136  Saig_ManForEachLi( pAig, pObj, i )
137  {
138  assert( Vec_IntEntry( vDriRefs, Aig_ObjFaninId0(pObj) ) >= 1 );
139  if ( Vec_IntEntry( vDriRefs, Aig_ObjFaninId0(pObj) ) != 1 )
140  continue;
141  if ( !Aig_ObjFaninC0(pObj) )
142  continue;
143  bVar = Cudd_bddIthVar( dd, Aig_ObjFaninId0(pObj) );
144  bCube = Cudd_bddAnd( dd, bTemp = bCube, bVar ); Cudd_Ref( bCube );
145  Cudd_RecursiveDeref( dd, bTemp );
146  }
147  Cudd_Deref( bCube );
148  dd->TimeStop = TimeStop;
149  return bCube;
150 }
static int Aig_ObjFaninId0(Aig_Obj_t *pObj)
Definition: aig.h:304
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
abctime TimeStop
Definition: cuddInt.h:489
Definition: cudd.h:278
void Cudd_Deref(DdNode *node)
Definition: cuddRef.c:438
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Definition: aig.h:69
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
DdNode * Cudd_ReadOne(DdManager *dd)
Definition: cuddAPI.c:987
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:416
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:314
#define assert(ex)
Definition: util_old.h:213
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
ABC_INT64_T abctime
Definition: abc_global.h:278
DdNode* Llb_ImgComputeImage ( Aig_Man_t pAig,
Vec_Ptr_t vDdMans,
DdManager dd,
DdNode bInit,
Vec_Ptr_t vQuant0,
Vec_Ptr_t vQuant1,
Vec_Int_t vDriRefs,
abctime  TimeTarget,
int  fBackward,
int  fReorder,
int  fVerbose 
)

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

Synopsis [Computes image of the initial set of states.]

Description []

SideEffects []

SeeAlso []

Definition at line 364 of file llb2Image.c.

367 {
368 // int fCheckSupport = 0;
369  DdManager * ddPart;
370  DdNode * bImage, * bGroup, * bCube, * bTemp;
371  int i;
372  abctime clk, clk0 = Abc_Clock();
373 
374  bImage = bInit; Cudd_Ref( bImage );
375  if ( fBackward )
376  {
377  // change polarity
378  bCube = Llb_DriverPhaseCube( pAig, vDriRefs, dd ); Cudd_Ref( bCube );
379  bImage = Extra_bddChangePolarity( dd, bTemp = bImage, bCube ); Cudd_Ref( bImage );
380  Cudd_RecursiveDeref( dd, bTemp );
381  Cudd_RecursiveDeref( dd, bCube );
382  }
383  else
384  {
385  // quantify unique vriables
386  bCube = Llb_ImgComputeCube( pAig, (Vec_Int_t *)Vec_PtrEntry(vQuant0, 0), dd ); Cudd_Ref( bCube );
387  bImage = Cudd_bddExistAbstract( dd, bTemp = bImage, bCube );
388  if ( bImage == NULL )
389  {
390  Cudd_RecursiveDeref( dd, bTemp );
391  Cudd_RecursiveDeref( dd, bCube );
392  return NULL;
393  }
394  Cudd_Ref( bImage );
395  Cudd_RecursiveDeref( dd, bTemp );
396  Cudd_RecursiveDeref( dd, bCube );
397  }
398  // perform image computation
399  Vec_PtrForEachEntry( DdManager *, vDdMans, ddPart, i )
400  {
401  clk = Abc_Clock();
402 if ( fVerbose )
403 printf( " %2d : ", i );
404  // transfer the BDD from the group manager to the main manager
405  bGroup = Cudd_bddTransfer( ddPart, dd, ddPart->bFunc );
406  if ( bGroup == NULL )
407  return NULL;
408  Cudd_Ref( bGroup );
409 if ( fVerbose )
410 printf( "Pt0 =%6d. Pt1 =%6d. ", Cudd_DagSize(ddPart->bFunc), Cudd_DagSize(bGroup) );
411  // perform partial product
412  bCube = Llb_ImgComputeCube( pAig, (Vec_Int_t *)Vec_PtrEntry(vQuant1, i+1), dd ); Cudd_Ref( bCube );
413 // bImage = Cudd_bddAndAbstract( dd, bTemp = bImage, bGroup, bCube );
414 // bImage = Extra_bddAndAbstractTime( dd, bTemp = bImage, bGroup, bCube, TimeTarget );
415  bImage = Cudd_bddAndAbstract( dd, bTemp = bImage, bGroup, bCube );
416  if ( bImage == NULL )
417  {
418  Cudd_RecursiveDeref( dd, bTemp );
419  Cudd_RecursiveDeref( dd, bCube );
420  Cudd_RecursiveDeref( dd, bGroup );
421  return NULL;
422  }
423  Cudd_Ref( bImage );
424 
425 if ( fVerbose )
426 printf( "Im0 =%6d. Im1 =%6d. ", Cudd_DagSize(bTemp), Cudd_DagSize(bImage) );
427 //printf("\n"); Extra_bddPrintSupport(dd, bImage); printf("\n");
428  Cudd_RecursiveDeref( dd, bTemp );
429  Cudd_RecursiveDeref( dd, bCube );
430  Cudd_RecursiveDeref( dd, bGroup );
431 
432 // Cudd_ReduceHeap( dd, CUDD_REORDER_SYMM_SIFT, 100 );
433 // Abc_Print( 1, "Reo =%6d. ", Cudd_DagSize(bImage) );
434 
435 if ( fVerbose )
436 printf( "Supp =%3d. ", Cudd_SupportSize(dd, bImage) );
437 if ( fVerbose )
438 Abc_PrintTime( 1, "T", Abc_Clock() - clk );
439  }
440 
441  if ( !fBackward )
442  {
443  // change polarity
444  bCube = Llb_DriverPhaseCube( pAig, vDriRefs, dd ); Cudd_Ref( bCube );
445  bImage = Extra_bddChangePolarity( dd, bTemp = bImage, bCube ); Cudd_Ref( bImage );
446  Cudd_RecursiveDeref( dd, bTemp );
447  Cudd_RecursiveDeref( dd, bCube );
448  }
449  else
450  {
451  // quantify unique vriables
452  bCube = Llb_ImgComputeCube( pAig, (Vec_Int_t *)Vec_PtrEntry(vQuant0, 0), dd ); Cudd_Ref( bCube );
453  bImage = Cudd_bddExistAbstract( dd, bTemp = bImage, bCube ); Cudd_Ref( bImage );
454  Cudd_RecursiveDeref( dd, bTemp );
455  Cudd_RecursiveDeref( dd, bCube );
456  }
457 
458  if ( fReorder )
459  {
460  if ( fVerbose )
461  Abc_Print( 1, " Reordering... Before =%5d. ", Cudd_DagSize(bImage) );
463  if ( fVerbose )
464  Abc_Print( 1, "After =%5d. ", Cudd_DagSize(bImage) );
465 // Cudd_ReduceHeap( dd, CUDD_REORDER_SYMM_SIFT, 100 );
466 // Abc_Print( 1, "After =%5d. ", Cudd_DagSize(bImage) );
467  if ( fVerbose )
468  Abc_PrintTime( 1, "Time", Abc_Clock() - clk0 );
469 // Abc_Print( 1, "\n" );
470  }
471 
472  Cudd_Deref( bImage );
473  return bImage;
474 }
DdNode * Llb_ImgComputeCube(Aig_Man_t *pAig, Vec_Int_t *vNodeIds, DdManager *dd)
Definition: llb2Image.c:259
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Cudd_Deref(DdNode *node)
Definition: cuddRef.c:438
DdNode * Cudd_bddExistAbstract(DdManager *manager, DdNode *f, DdNode *cube)
Definition: cuddBddAbs.c:130
DdNode * bFunc
Definition: cuddInt.h:487
static abctime Abc_Clock()
Definition: abc_global.h:279
DdNode * Cudd_bddTransfer(DdManager *ddSource, DdManager *ddDestination, DdNode *f)
Definition: cuddBridge.c:409
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
DdNode * Cudd_bddAndAbstract(DdManager *manager, DdNode *f, DdNode *g, DdNode *cube)
Definition: cuddAndAbs.c:124
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
DdNode * Llb_DriverPhaseCube(Aig_Man_t *pAig, Vec_Int_t *vDriRefs, DdManager *dd)
Definition: llb2Driver.c:128
int Cudd_ReduceHeap(DdManager *table, Cudd_ReorderingType heuristic, int minsize)
Definition: cuddReorder.c:176
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_INT64_T abctime
Definition: abc_global.h:278
DdNode * Extra_bddChangePolarity(DdManager *dd, DdNode *bFunc, DdNode *bVars)
int Cudd_SupportSize(DdManager *dd, DdNode *f)
Definition: cuddUtil.c:857
int Cudd_DagSize(DdNode *node)
Definition: cuddUtil.c:442
DdManager* Llb_ImgPartition ( Aig_Man_t p,
Vec_Ptr_t vLower,
Vec_Ptr_t vUpper,
abctime  TimeTarget 
)

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

Synopsis [Computes one partition in a separate BDD manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 183 of file llb2Image.c.

184 {
185  Vec_Ptr_t * vNodes, * vRange;
186  Aig_Obj_t * pObj;
187  DdManager * dd;
188  DdNode * bBdd0, * bBdd1, * bProd, * bRes, * bTemp;
189  int i;
190 
193  dd->TimeStop = TimeTarget;
194 
195  Vec_PtrForEachEntry( Aig_Obj_t *, vLower, pObj, i )
196  pObj->pData = Cudd_bddIthVar( dd, Aig_ObjId(pObj) );
197 
198  vNodes = Llb_ManCutNodes( p, vLower, vUpper );
199  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
200  {
201  bBdd0 = Cudd_NotCond( (DdNode *)Aig_ObjFanin0(pObj)->pData, Aig_ObjFaninC0(pObj) );
202  bBdd1 = Cudd_NotCond( (DdNode *)Aig_ObjFanin1(pObj)->pData, Aig_ObjFaninC1(pObj) );
203 // pObj->pData = Cudd_bddAnd( dd, bBdd0, bBdd1 ); Cudd_Ref( (DdNode *)pObj->pData );
204 // pObj->pData = Extra_bddAndTime( dd, bBdd0, bBdd1, TimeTarget );
205  pObj->pData = Cudd_bddAnd( dd, bBdd0, bBdd1 );
206  if ( pObj->pData == NULL )
207  {
208  Cudd_Quit( dd );
209  Vec_PtrFree( vNodes );
210  return NULL;
211  }
212  Cudd_Ref( (DdNode *)pObj->pData );
213  }
214 
215  vRange = Llb_ManCutRange( p, vLower, vUpper );
216  bRes = Cudd_ReadOne(dd); Cudd_Ref( bRes );
217  Vec_PtrForEachEntry( Aig_Obj_t *, vRange, pObj, i )
218  {
219  assert( Aig_ObjIsNode(pObj) );
220  bProd = Cudd_bddXnor( dd, Cudd_bddIthVar(dd, Aig_ObjId(pObj)), (DdNode *)pObj->pData ); Cudd_Ref( bProd );
221 // bRes = Cudd_bddAnd( dd, bTemp = bRes, bProd ); Cudd_Ref( bRes );
222 // bRes = Extra_bddAndTime( dd, bTemp = bRes, bProd, TimeTarget );
223  bRes = Cudd_bddAnd( dd, bTemp = bRes, bProd );
224  if ( bRes == NULL )
225  {
226  Cudd_Quit( dd );
227  Vec_PtrFree( vRange );
228  Vec_PtrFree( vNodes );
229  return NULL;
230  }
231  Cudd_Ref( bRes );
232  Cudd_RecursiveDeref( dd, bTemp );
233  Cudd_RecursiveDeref( dd, bProd );
234  }
235  Vec_PtrForEachEntry( Aig_Obj_t *, vNodes, pObj, i )
236  Cudd_RecursiveDeref( dd, (DdNode *)pObj->pData );
237 
238  Vec_PtrFree( vRange );
239  Vec_PtrFree( vNodes );
240  Cudd_AutodynDisable( dd );
241 // Cudd_RecursiveDeref( dd, bRes );
242 // Extra_StopManager( dd );
243  dd->bFunc = bRes;
244  dd->TimeStop = 0;
245  return dd;
246 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
#define CUDD_UNIQUE_SLOTS
Definition: cudd.h:97
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
abctime TimeStop
Definition: cuddInt.h:489
Definition: cudd.h:278
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
#define CUDD_CACHE_SLOTS
Definition: cudd.h:98
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
DdManager * Cudd_Init(unsigned int numVars, unsigned int numVarsZ, unsigned int numSlots, unsigned int cacheSize, unsigned long maxMemory)
Definition: cuddInit.c:125
Definition: aig.h:69
DdNode * Cudd_bddXnor(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:507
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
ABC_NAMESPACE_IMPL_START Vec_Ptr_t * Llb_ManCutNodes(Aig_Man_t *p, Vec_Ptr_t *vLower, Vec_Ptr_t *vUpper)
DECLARATIONS ///.
Definition: llb2Flow.c:374
void Cudd_AutodynDisable(DdManager *unique)
Definition: cuddAPI.c:708
DdNode * Cudd_ReadOne(DdManager *dd)
Definition: cuddAPI.c:987
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:416
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
Definition: aig.h:307
#define Cudd_NotCond(node, c)
Definition: cudd.h:383
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:314
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define assert(ex)
Definition: util_old.h:213
void Cudd_Quit(DdManager *unique)
Definition: cuddInit.c:225
void Cudd_AutodynEnable(DdManager *unique, Cudd_ReorderingType method)
Definition: cuddAPI.c:669
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Vec_Ptr_t * Llb_ManCutRange(Aig_Man_t *p, Vec_Ptr_t *vLower, Vec_Ptr_t *vUpper)
Definition: llb2Flow.c:436
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Llb_ImgQuantifyFirst ( Aig_Man_t pAig,
Vec_Ptr_t vDdMans,
Vec_Ptr_t vQuant0,
int  fVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 288 of file llb2Image.c.

289 {
290  DdManager * dd;
291  DdNode * bProd, * bRes, * bTemp;
292  int i;
293  abctime clk = Abc_Clock();
294  Vec_PtrForEachEntry( DdManager *, vDdMans, dd, i )
295  {
296  // remember unquantified ones
297  assert( dd->bFunc2 == NULL );
298  dd->bFunc2 = dd->bFunc; Cudd_Ref( dd->bFunc2 );
299 
301 
302  bRes = dd->bFunc;
303  if ( fVerbose )
304  Abc_Print( 1, "Part %2d : Init =%5d. ", i, Cudd_DagSize(bRes) );
305  bProd = Llb_ImgComputeCube( pAig, (Vec_Int_t *)Vec_PtrEntry(vQuant0, i+1), dd ); Cudd_Ref( bProd );
306  bRes = Cudd_bddExistAbstract( dd, bTemp = bRes, bProd ); Cudd_Ref( bRes );
307  Cudd_RecursiveDeref( dd, bTemp );
308  Cudd_RecursiveDeref( dd, bProd );
309  dd->bFunc = bRes;
310 
311  Cudd_AutodynDisable( dd );
312 
313  if ( fVerbose )
314  Abc_Print( 1, "Quant =%5d. ", Cudd_DagSize(bRes) );
316  if ( fVerbose )
317  Abc_Print( 1, "Reo = %5d. ", Cudd_DagSize(bRes) );
319  if ( fVerbose )
320  Abc_Print( 1, "Reo = %5d. ", Cudd_DagSize(bRes) );
321  if ( fVerbose )
322  Abc_Print( 1, "Supp = %3d. ", Cudd_SupportSize(dd, bRes) );
323  if ( fVerbose )
324  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
325 
326  }
327 }
DdNode * Llb_ImgComputeCube(Aig_Man_t *pAig, Vec_Int_t *vNodeIds, DdManager *dd)
Definition: llb2Image.c:259
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
DdNode * Cudd_bddExistAbstract(DdManager *manager, DdNode *f, DdNode *cube)
Definition: cuddBddAbs.c:130
DdNode * bFunc
Definition: cuddInt.h:487
static abctime Abc_Clock()
Definition: abc_global.h:279
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
DdNode * bFunc2
Definition: cuddInt.h:488
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
void Cudd_AutodynDisable(DdManager *unique)
Definition: cuddAPI.c:708
#define assert(ex)
Definition: util_old.h:213
int Cudd_ReduceHeap(DdManager *table, Cudd_ReorderingType heuristic, int minsize)
Definition: cuddReorder.c:176
void Cudd_AutodynEnable(DdManager *unique, Cudd_ReorderingType method)
Definition: cuddAPI.c:669
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_INT64_T abctime
Definition: abc_global.h:278
int Cudd_SupportSize(DdManager *dd, DdNode *f)
Definition: cuddUtil.c:857
int Cudd_DagSize(DdNode *node)
Definition: cuddUtil.c:442
void Llb_ImgQuantifyReset ( Vec_Ptr_t vDdMans)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 340 of file llb2Image.c.

341 {
342  DdManager * dd;
343  int i;
344  Vec_PtrForEachEntry( DdManager *, vDdMans, dd, i )
345  {
346  assert( dd->bFunc2 != NULL );
347  Cudd_RecursiveDeref( dd, dd->bFunc );
348  dd->bFunc = dd->bFunc2;
349  dd->bFunc2 = NULL;
350  }
351 }
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
DdNode * bFunc
Definition: cuddInt.h:487
DdNode * bFunc2
Definition: cuddInt.h:488
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Llb_ImgSchedule ( Vec_Ptr_t vSupps,
Vec_Ptr_t **  pvQuant0,
Vec_Ptr_t **  pvQuant1,
int  fVerbose 
)

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

Synopsis [Computes quantification schedule.]

Description [Input array contains supports: 0=starting, ... intermediate... N-1=final. Output arrays contain immediately quantifiable vars (vQuant0) and vars that should be quantified after conjunction (vQuant1).]

SideEffects []

SeeAlso []

Definition at line 122 of file llb2Image.c.

123 {
124  Vec_Int_t * vOne;
125  int nVarsAll, Counter, iSupp = -1, Entry, i, k;
126  // start quantification arrays
127  *pvQuant0 = Vec_PtrAlloc( Vec_PtrSize(vSupps) );
128  *pvQuant1 = Vec_PtrAlloc( Vec_PtrSize(vSupps) );
129  Vec_PtrForEachEntry( Vec_Int_t *, vSupps, vOne, k )
130  {
131  Vec_PtrPush( *pvQuant0, Vec_IntAlloc(16) );
132  Vec_PtrPush( *pvQuant1, Vec_IntAlloc(16) );
133  }
134  // count how many times each var appears
135  nVarsAll = Vec_IntSize( (Vec_Int_t *)Vec_PtrEntry(vSupps, 0) );
136  for ( i = 0; i < nVarsAll; i++ )
137  {
138  Counter = 0;
139  Vec_PtrForEachEntry( Vec_Int_t *, vSupps, vOne, k )
140  if ( Vec_IntEntry(vOne, i) )
141  {
142  iSupp = k;
143  Counter++;
144  }
145  if ( Counter == 0 )
146  continue;
147  if ( Counter == 1 )
148  Vec_IntPush( (Vec_Int_t *)Vec_PtrEntry(*pvQuant0, iSupp), i );
149  else // if ( Counter > 1 )
150  Vec_IntPush( (Vec_Int_t *)Vec_PtrEntry(*pvQuant1, iSupp), i );
151  }
152 
153  if ( fVerbose )
154  for ( i = 0; i < Vec_PtrSize(vSupps); i++ )
155  {
156  printf( "%2d : Quant0 = ", i );
157  Vec_IntForEachEntry( (Vec_Int_t *)Vec_PtrEntry(*pvQuant0, i), Entry, k )
158  printf( "%d ", Entry );
159  printf( "\n" );
160  }
161 
162  if ( fVerbose )
163  for ( i = 0; i < Vec_PtrSize(vSupps); i++ )
164  {
165  printf( "%2d : Quant1 = ", i );
166  Vec_IntForEachEntry( (Vec_Int_t *)Vec_PtrEntry(*pvQuant1, i), Entry, k )
167  printf( "%d ", Entry );
168  printf( "\n" );
169  }
170 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
for(p=first;p->value< newval;p=p->next)
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
if(last==0)
Definition: sparse_int.h:34
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Counter
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Vec_Ptr_t* Llb_ImgSupports ( Aig_Man_t p,
Vec_Ptr_t vDdMans,
Vec_Int_t vStart,
Vec_Int_t vStop,
int  fAddPis,
int  fVerbose 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Computes supports of the partitions.]

Description []

SideEffects []

SeeAlso []

Definition at line 48 of file llb2Image.c.

49 {
50  Vec_Ptr_t * vSupps;
51  Vec_Int_t * vOne;
52  Aig_Obj_t * pObj;
53  DdManager * dd;
54  DdNode * bSupp, * bTemp;
55  int i, Entry, nSize;
56  nSize = Cudd_ReadSize( (DdManager *)Vec_PtrEntry( vDdMans, 0 ) );
57  vSupps = Vec_PtrAlloc( 100 );
58  // create initial
59  vOne = Vec_IntStart( nSize );
60  Vec_IntForEachEntry( vStart, Entry, i )
61  Vec_IntWriteEntry( vOne, Entry, 1 );
62  Vec_PtrPush( vSupps, vOne );
63  // create intermediate
64  Vec_PtrForEachEntry( DdManager *, vDdMans, dd, i )
65  {
66  vOne = Vec_IntStart( nSize );
67  bSupp = Cudd_Support( dd, dd->bFunc ); Cudd_Ref( bSupp );
68  for ( bTemp = bSupp; bTemp != Cudd_ReadOne(dd); bTemp = cuddT(bTemp) )
69  Vec_IntWriteEntry( vOne, bTemp->index, 1 );
70  Cudd_RecursiveDeref( dd, bSupp );
71  Vec_PtrPush( vSupps, vOne );
72  }
73  // create final
74  vOne = Vec_IntStart( nSize );
75  Vec_IntForEachEntry( vStop, Entry, i )
76  Vec_IntWriteEntry( vOne, Entry, 1 );
77  if ( fAddPis )
78  Saig_ManForEachPi( p, pObj, i )
79  Vec_IntWriteEntry( vOne, Aig_ObjId(pObj), 1 );
80  Vec_PtrPush( vSupps, vOne );
81 
82  // print supports
83  assert( nSize == Aig_ManObjNumMax(p) );
84  if ( !fVerbose )
85  return vSupps;
86  Aig_ManForEachObj( p, pObj, i )
87  {
88  int k, Counter = 0;
89  Vec_PtrForEachEntry( Vec_Int_t *, vSupps, vOne, k )
90  Counter += Vec_IntEntry(vOne, i);
91  if ( Counter == 0 )
92  continue;
93  printf( "Obj = %4d : ", i );
94  if ( Saig_ObjIsPi(p,pObj) )
95  printf( "pi " );
96  else if ( Saig_ObjIsLo(p,pObj) )
97  printf( "lo " );
98  else if ( Saig_ObjIsLi(p,pObj) )
99  printf( "li " );
100  else if ( Aig_ObjIsNode(pObj) )
101  printf( "and " );
102  Vec_PtrForEachEntry( Vec_Int_t *, vSupps, vOne, k )
103  printf( "%d", Vec_IntEntry(vOne, i) );
104  printf( "\n" );
105  }
106  return vSupps;
107 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:84
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
DdNode * Cudd_Support(DdManager *dd, DdNode *f)
Definition: cuddUtil.c:740
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
int Cudd_ReadSize(DdManager *dd)
Definition: cuddAPI.c:1441
static int Saig_ObjIsLi(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:85
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
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 Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
Definition: aig.h:69
static int Counter
#define cuddT(node)
Definition: cuddInt.h:636
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
DdNode * Cudd_ReadOne(DdManager *dd)
Definition: cuddAPI.c:987
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
DdHalfWord index
Definition: cudd.h:279
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define assert(ex)
Definition: util_old.h:213
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static int Saig_ObjIsPi(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:82
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
void Llb_ManCluster ( Llb_Mtr_t p)

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

Synopsis [Combines one pair of columns.]

Description []

SideEffects []

SeeAlso []

Definition at line 324 of file llb1Cluster.c.

325 {
326  int RetValue;
327  do
328  {
329  do {
330  RetValue = Llb_ManComputeBestQuant( p );
331  if ( RetValue > 0 )
332  Llb_ManClusterOne( p, RetValue >> 16, RetValue & 0xffff );
333  }
334  while ( RetValue > 0 );
335 
336  RetValue = Llb_ManComputeBestAttr( p );
337  if ( RetValue > 0 )
338  Llb_ManClusterOne( p, RetValue >> 16, RetValue & 0xffff );
339 
340  Llb_MtrVerifyMatrix( p );
341  }
342  while ( RetValue > 0 );
343 
345 
346  Llb_MtrVerifyMatrix( p );
347 }
void Llb_MtrVerifyMatrix(Llb_Mtr_t *p)
Definition: llb1Matrix.c:115
void Llb_ManClusterOne(Llb_Mtr_t *p, int iCol1, int iCol2)
Definition: llb1Cluster.c:258
void Llb_ManClusterCompress(Llb_Mtr_t *p)
Definition: llb1Cluster.c:293
int Llb_ManComputeBestAttr(Llb_Mtr_t *p)
Definition: llb1Cluster.c:164
int Llb_ManComputeBestQuant(Llb_Mtr_t *p)
Definition: llb1Cluster.c:72
Vec_Int_t* Llb_ManDeriveConstraints ( Aig_Man_t p)

FUNCTION DECLARATIONS ///.

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

Synopsis [Derives inductive constraints.]

Description []

SideEffects []

SeeAlso []

Definition at line 267 of file llb1Constr.c.

268 {
269  DdManager * dd;
270  Vec_Int_t * vNodes;
271  if ( Saig_ManPoNum(p) != 1 )
272  {
273  printf( "The AIG has %d property outputs.\n", Saig_ManPoNum(p) );
274  return NULL;
275  }
276  assert( Saig_ManPoNum(p) == 1 );
278  vNodes = Llb_ManComputeBaseCase( p, dd );
279  if ( Llb_ManCountEntries(vNodes) > 0 )
280  Llb_ManComputeIndCase( p, dd, vNodes );
281  if ( Llb_ManCountEntries(vNodes) == 0 )
282  Vec_IntFreeP( &vNodes );
283  Llb_ManDerefenceBdds( p, dd );
284  Extra_StopManager( dd );
285  return vNodes;
286 }
void Llb_ManComputeIndCase(Aig_Man_t *p, DdManager *dd, Vec_Int_t *vNodes)
Definition: llb1Constr.c:142
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Extra_StopManager(DdManager *dd)
Definition: extraBddMisc.c:223
ABC_NAMESPACE_IMPL_START int Llb_ManCountEntries(Vec_Int_t *vCands)
DECLARATIONS ///.
Definition: llb1Constr.c:45
void Llb_ManDerefenceBdds(Aig_Man_t *p, DdManager *dd)
Definition: llb1Constr.c:96
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
#define assert(ex)
Definition: util_old.h:213
Vec_Int_t * Llb_ManComputeBaseCase(Aig_Man_t *p, DdManager *dd)
Definition: llb1Constr.c:199
DdManager * Llb_ManConstructGlobalBdds(Aig_Man_t *p)
Definition: llb1Constr.c:229
void Llb_ManDumpReached ( DdManager ddG,
DdNode bReached,
char *  pModel,
char *  pFileName 
)

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

Synopsis [Writes reached state BDD into a BLIF file.]

Description []

SideEffects []

SeeAlso []

Definition at line 63 of file llb2Dump.c.

64 {
65  FILE * pFile;
66  Vec_Ptr_t * vNamesIn, * vNamesOut;
67  char * pName;
68  int i, nDigits;
69  // reorder the BDD
71 
72  // create input names
73  nDigits = Abc_Base10Log( Cudd_ReadSize(ddG) );
74  vNamesIn = Vec_PtrAlloc( Cudd_ReadSize(ddG) );
75  for ( i = 0; i < Cudd_ReadSize(ddG); i++ )
76  {
77  pName = Llb_ManGetDummyName( "ff", i, nDigits );
78  Vec_PtrPush( vNamesIn, Extra_UtilStrsav(pName) );
79  }
80  // create output names
81  vNamesOut = Vec_PtrAlloc( 1 );
82  Vec_PtrPush( vNamesOut, Extra_UtilStrsav("Reached") );
83 
84  // write the file
85  pFile = fopen( pFileName, "wb" );
86  Cudd_DumpBlif( ddG, 1, &bReached, (char **)Vec_PtrArray(vNamesIn), (char **)Vec_PtrArray(vNamesOut), pModel, pFile, 0 );
87  fclose( pFile );
88 
89  // cleanup
90  Vec_PtrForEachEntry( char *, vNamesIn, pName, i )
91  ABC_FREE( pName );
92  Vec_PtrForEachEntry( char *, vNamesOut, pName, i )
93  ABC_FREE( pName );
94  Vec_PtrFree( vNamesIn );
95  Vec_PtrFree( vNamesOut );
96 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_NAMESPACE_IMPL_START char * Llb_ManGetDummyName(char *pPrefix, int Num, int nDigits)
DECLARATIONS ///.
Definition: llb2Dump.c:45
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
int Cudd_ReadSize(DdManager *dd)
Definition: cuddAPI.c:1441
char * Extra_UtilStrsav(const char *s)
static int Abc_Base10Log(unsigned n)
Definition: abc_global.h:252
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
int Cudd_DumpBlif(DdManager *dd, int n, DdNode **f, char **inames, char **onames, char *mname, FILE *fp, int mv)
Definition: cuddExport.c:136
#define ABC_FREE(obj)
Definition: abc_global.h:232
int Cudd_ReduceHeap(DdManager *table, Cudd_ReorderingType heuristic, int minsize)
Definition: cuddReorder.c:176
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void ** Vec_PtrArray(Vec_Ptr_t *p)
Definition: vecPtr.h:279
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Vec_Ptr_t* Llb_ManFlow ( Aig_Man_t p,
Vec_Ptr_t vSources,
int *  pnFlow 
)

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

Synopsis [Implementation of max-flow/min-cut computation.]

Description []

SideEffects []

SeeAlso []

Definition at line 762 of file llb2Flow.c.

763 {
764  Vec_Ptr_t * vMinCut;
765  Aig_Obj_t * pObj;
766  int Flow, FlowCur, RetValue, i;
767  // find the max-flow
768  Flow = 0;
769  Aig_ManCleanData( p );
771  Vec_PtrForEachEntry( Aig_Obj_t *, vSources, pObj, i )
772  {
773  assert( !pObj->fMarkA && pObj->fMarkB );
774  if ( !Aig_ObjFanin0(pObj)->fMarkB )
775  {
776  FlowCur = Llb_ManFlowBwdPath2_rec( p, Aig_ObjFanin0(pObj) );
777  Flow += FlowCur;
778  if ( FlowCur )
780  }
781  if ( Aig_ObjIsNode(pObj) && !Aig_ObjFanin1(pObj)->fMarkB )
782  {
783  FlowCur = Llb_ManFlowBwdPath2_rec( p, Aig_ObjFanin1(pObj) );
784  Flow += FlowCur;
785  if ( FlowCur )
787  }
788  }
789  if ( pnFlow )
790  *pnFlow = Flow;
791 
792  // mark the nodes reachable from the latches
794  Vec_PtrForEachEntry( Aig_Obj_t *, vSources, pObj, i )
795  {
796  assert( !pObj->fMarkA && pObj->fMarkB );
797  if ( !Aig_ObjFanin0(pObj)->fMarkB )
798  {
799  RetValue = Llb_ManFlowBwdPath2_rec( p, Aig_ObjFanin0(pObj) );
800  assert( RetValue == 0 );
801  }
802  if ( Aig_ObjIsNode(pObj) && !Aig_ObjFanin1(pObj)->fMarkB )
803  {
804  RetValue = Llb_ManFlowBwdPath2_rec( p, Aig_ObjFanin1(pObj) );
805  assert( RetValue == 0 );
806  }
807  }
808 
809  // find the min-cut with the smallest volume
810  vMinCut = Llb_ManFlowMinCut( p );
811  assert( Vec_PtrSize(vMinCut) == Flow );
812  // verify the cut
813  if ( !Llb_ManFlowVerifyCut(p, vMinCut) )
814  printf( "Llb_ManFlow() error! The computed min-cut is not a cut!\n" );
815 // Llb_ManFlowPrintCut( p, vMinCut );
816  return vMinCut;
817 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
unsigned int fMarkB
Definition: aig.h:80
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Vec_Ptr_t * Llb_ManFlowMinCut(Aig_Man_t *p)
Definition: llb2Flow.c:670
unsigned int fMarkA
Definition: aig.h:79
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int Llb_ManFlowVerifyCut(Aig_Man_t *p, Vec_Ptr_t *vMinCut)
Definition: llb2Flow.c:734
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
Definition: aig.h:69
int Llb_ManFlowBwdPath2_rec(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: llb2Flow.c:548
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Aig_ManCleanData(Aig_Man_t *p)
Definition: aigUtil.c:205
Llb_Grp_t* Llb_ManGroupAlloc ( Llb_Man_t pMan)

DECLARATIONS ///.

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

FileName [llb1Group.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [BDD based reachability.]

Synopsis [Initial partition computation.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
llb1Group.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file llb1Group.c.

46 {
47  Llb_Grp_t * p;
48  p = ABC_CALLOC( Llb_Grp_t, 1 );
49  p->pMan = pMan;
50  p->vIns = Vec_PtrAlloc( 8 );
51  p->vOuts = Vec_PtrAlloc( 8 );
52  p->Id = Vec_PtrSize( pMan->vGroups );
53  Vec_PtrPush( pMan->vGroups, p );
54  return p;
55 }
Llb_Man_t * pMan
Definition: llbInt.h:100
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
int Id
Definition: llbInt.h:96
Vec_Ptr_t * vOuts
Definition: llbInt.h:98
Vec_Ptr_t * vIns
Definition: llbInt.h:97
Llb_Grp_t* Llb_ManGroupCreateFromCuts ( Llb_Man_t pMan,
Vec_Int_t vCut1,
Vec_Int_t vCut2 
)

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

Synopsis [Creates group from two cuts derived by the flow computation.]

Description []

SideEffects []

SeeAlso []

Definition at line 312 of file llb1Group.c.

313 {
314  Llb_Grp_t * p;
315  Aig_Obj_t * pObj;
316  int i;
317  p = Llb_ManGroupAlloc( pMan );
318 
319  // mark Cut1
320  Aig_ManIncrementTravId( pMan->pAig );
321  Aig_ManForEachObjVec( vCut1, pMan->pAig, pObj, i )
322  Aig_ObjSetTravIdCurrent( pMan->pAig, pObj );
323  // collect unmarked Cut2
324  Aig_ManForEachObjVec( vCut2, pMan->pAig, pObj, i )
325  if ( !Aig_ObjIsTravIdCurrent( pMan->pAig, pObj ) )
326  Vec_PtrPush( p->vOuts, pObj );
327 
328  // mark nodes reachable from Cut2
329  Aig_ManIncrementTravId( pMan->pAig );
330  Aig_ManForEachObjVec( vCut2, pMan->pAig, pObj, i )
331  Llb_ManGroupMarkNodes_rec( pMan->pAig, pObj );
332  // collect marked Cut1
333  Aig_ManForEachObjVec( vCut1, pMan->pAig, pObj, i )
334  if ( Aig_ObjIsTravIdCurrent( pMan->pAig, pObj ) )
335  Vec_PtrPush( p->vIns, pObj );
336 
337  // derive internal objects
338  assert( p->vNodes == NULL );
339  p->vNodes = Llb_ManGroupCollect( p );
340  return p;
341 }
#define Aig_ManForEachObjVec(vIds, p, pObj, i)
Definition: aig.h:408
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Aig_ObjIsTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:295
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
ABC_NAMESPACE_IMPL_START Llb_Grp_t * Llb_ManGroupAlloc(Llb_Man_t *pMan)
DECLARATIONS ///.
Definition: llb1Group.c:45
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
void Llb_ManGroupMarkNodes_rec(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: llb1Group.c:286
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
Vec_Ptr_t * Llb_ManGroupCollect(Llb_Grp_t *pGroup)
Definition: llb1Group.c:120
#define assert(ex)
Definition: util_old.h:213
Llb_Grp_t* Llb_ManGroupsCombine ( Llb_Grp_t p1,
Llb_Grp_t p2 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 251 of file llb1Group.c.

252 {
253  Llb_Grp_t * p;
254  Aig_Obj_t * pObj;
255  int i;
256  p = Llb_ManGroupAlloc( p1->pMan );
257  // create inputs
258  Vec_PtrForEachEntry( Aig_Obj_t *, p1->vIns, pObj, i )
259  Vec_PtrPush( p->vIns, pObj );
260  Vec_PtrForEachEntry( Aig_Obj_t *, p2->vIns, pObj, i )
261  Vec_PtrPushUnique( p->vIns, pObj );
262  // create outputs
263  Vec_PtrForEachEntry( Aig_Obj_t *, p1->vOuts, pObj, i )
264  Vec_PtrPush( p->vOuts, pObj );
265  Vec_PtrForEachEntry( Aig_Obj_t *, p2->vOuts, pObj, i )
266  Vec_PtrPushUnique( p->vOuts, pObj );
267 
268  // derive internal objects
269  assert( p->vNodes == NULL );
270  p->vNodes = Llb_ManGroupCollect( p );
271  return p;
272 }
Llb_Man_t * pMan
Definition: llbInt.h:100
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_PtrPushUnique(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:656
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
ABC_NAMESPACE_IMPL_START Llb_Grp_t * Llb_ManGroupAlloc(Llb_Man_t *pMan)
DECLARATIONS ///.
Definition: llb1Group.c:45
Definition: aig.h:69
Vec_Ptr_t * Llb_ManGroupCollect(Llb_Grp_t *pGroup)
Definition: llb1Group.c:120
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Vec_Ptr_t * vIns
Definition: llbInt.h:97
void Llb_ManGroupStop ( Llb_Grp_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 68 of file llb1Group.c.

69 {
70  if ( p == NULL )
71  return;
72  Vec_PtrWriteEntry( p->pMan->vGroups, p->Id, NULL );
73  Vec_PtrFreeP( &p->vIns );
74  Vec_PtrFreeP( &p->vOuts );
75  Vec_PtrFreeP( &p->vNodes );
76  ABC_FREE( p );
77 }
Llb_Man_t * pMan
Definition: llbInt.h:100
Vec_Ptr_t * vNodes
Definition: llbInt.h:99
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_PtrFreeP(Vec_Ptr_t **p)
Definition: vecPtr.h:240
int Id
Definition: llbInt.h:96
Vec_Ptr_t * vOuts
Definition: llbInt.h:98
Vec_Ptr_t * vIns
Definition: llbInt.h:97
Vec_Int_t* Llb_ManMarkPivotNodes ( Aig_Man_t p,
int  fUseInternal 
)

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

Synopsis [Determine starting cut-points.]

Description []

SideEffects []

SeeAlso []

Definition at line 220 of file llb1Pivot.c.

221 {
222  Vec_Int_t * vVar2Obj;
223  Aig_Obj_t * pObj;
224  int i;
225  // mark inputs/outputs
226  Aig_ManForEachCi( p, pObj, i )
227  pObj->fMarkA = 1;
228  Saig_ManForEachLi( p, pObj, i )
229  pObj->fMarkA = 1;
230 
231  // mark internal pivot nodes
232  if ( fUseInternal )
234 
235  // assign variable numbers
236  Aig_ManConst1(p)->fMarkA = 0;
237  vVar2Obj = Vec_IntAlloc( 100 );
238  Aig_ManForEachCi( p, pObj, i )
239  Vec_IntPush( vVar2Obj, Aig_ObjId(pObj) );
240  Aig_ManForEachNode( p, pObj, i )
241  if ( pObj->fMarkA )
242  Vec_IntPush( vVar2Obj, Aig_ObjId(pObj) );
243  Saig_ManForEachLi( p, pObj, i )
244  Vec_IntPush( vVar2Obj, Aig_ObjId(pObj) );
245  return vVar2Obj;
246 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition: aig.h:393
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
void Llb_ManMarkInternalPivots(Aig_Man_t *p)
Definition: llb1Pivot.c:175
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
int Llb_ManModelCheckAig ( Aig_Man_t pAigGlo,
Gia_ParLlb_t pPars,
Vec_Int_t vHints,
DdManager **  pddGlo 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 112 of file llb1Core.c.

113 {
114  Llb_Man_t * p = NULL;
115  Aig_Man_t * pAig;
116  int RetValue = -1;
117  abctime clk = Abc_Clock();
118 
119  if ( pPars->fIndConstr )
120  {
121  assert( vHints == NULL );
122  vHints = Llb_ManDeriveConstraints( pAigGlo );
123  }
124 
125  // derive AIG for hints
126  if ( vHints == NULL )
127  pAig = Aig_ManDupSimple( pAigGlo );
128  else
129  {
130  if ( pPars->fVerbose )
131  Llb_ManPrintEntries( pAigGlo, vHints );
132  pAig = Aig_ManDupSimpleWithHints( pAigGlo, vHints );
133  }
134 
135 
136  if ( pPars->fUseFlow )
137  {
138 // p = Llb_ManStartFlow( pAigGlo, pAig, pPars );
139  }
140  else
141  {
142  p = Llb_ManStart( pAigGlo, pAig, pPars );
143  if ( pPars->fVerbose )
144  {
145  Llb_ManPrintAig( p );
146  printf( "Original matrix: " );
147  Llb_MtrPrintMatrixStats( p->pMatrix );
148  if ( pPars->fVeryVerbose )
149  Llb_MtrPrint( p->pMatrix, 1 );
150  }
151  if ( pPars->fCluster )
152  {
153  Llb_ManCluster( p->pMatrix );
154  if ( pPars->fVerbose )
155  {
156  printf( "Matrix after clustering: " );
157  Llb_MtrPrintMatrixStats( p->pMatrix );
158  if ( pPars->fVeryVerbose )
159  Llb_MtrPrint( p->pMatrix, 1 );
160  }
161  }
162  if ( pPars->fSchedule )
163  {
164  Llb_MtrSchedule( p->pMatrix );
165  if ( pPars->fVerbose )
166  {
167  printf( "Matrix after scheduling: " );
168  Llb_MtrPrintMatrixStats( p->pMatrix );
169  if ( pPars->fVeryVerbose )
170  Llb_MtrPrint( p->pMatrix, 1 );
171  }
172  }
173  }
174 
175  if ( !p->pPars->fSkipReach )
176  RetValue = Llb_ManReachability( p, vHints, pddGlo );
177  Llb_ManStop( p );
178 
179  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
180 
181  if ( pPars->fIndConstr )
182  Vec_IntFreeP( &vHints );
183  return RetValue;
184 }
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Llb_ManReachability(Llb_Man_t *p, Vec_Int_t *vHints, DdManager **pddGlo)
Definition: llb1Reach.c:582
static abctime Abc_Clock()
Definition: abc_global.h:279
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
void Llb_ManCluster(Llb_Mtr_t *p)
Definition: llb1Cluster.c:324
Aig_Man_t * Aig_ManDupSimpleWithHints(Aig_Man_t *p, Vec_Int_t *vHints)
Definition: aigDup.c:107
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
Vec_Int_t * Llb_ManDeriveConstraints(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: llb1Constr.c:267
void Llb_MtrPrint(Llb_Mtr_t *p, int fOrder)
Definition: llb1Matrix.c:206
void Llb_MtrPrintMatrixStats(Llb_Mtr_t *p)
Definition: llb1Matrix.c:236
#define assert(ex)
Definition: util_old.h:213
void Llb_ManPrintAig(Llb_Man_t *p)
Definition: llb1Core.c:87
Llb_Man_t * Llb_ManStart(Aig_Man_t *pAigGlo, Aig_Man_t *pAig, Gia_ParLlb_t *pPars)
Definition: llb1Man.c:193
ABC_INT64_T abctime
Definition: abc_global.h:278
void Llb_MtrSchedule(Llb_Mtr_t *p)
Definition: llb1Sched.c:222
typedefABC_NAMESPACE_HEADER_START struct Llb_Man_t_ Llb_Man_t
INCLUDES ///.
Definition: llbInt.h:46
Aig_Man_t * Aig_ManDupSimple(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigDup.c:46
void Llb_ManPrintEntries(Aig_Man_t *p, Vec_Int_t *vCands)
Definition: llb1Constr.c:64
void Llb_ManStop(Llb_Man_t *p)
Definition: llb1Man.c:130
int Llb_ManModelCheckAigWithHints ( Aig_Man_t pAigGlo,
Gia_ParLlb_t pPars 
)

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

Synopsis [Derives AIG whose PI is substituted by a constant.]

Description []

SideEffects []

SeeAlso []

Definition at line 162 of file llb1Hint.c.

163 {
164  DdManager * ddGlo = NULL;
165  Vec_Int_t * vHints;
166  Vec_Int_t * vHFCands;
167  int i, Entry, RetValue = -1;
168  abctime clk = Abc_Clock();
169  assert( pPars->nHintDepth > 0 );
170 /*
171  // perform reachability without hints
172  RetValue = Llb_ManModelCheckAig( pAigGlo, pPars, NULL, NULL );
173  if ( RetValue >= 0 )
174  return RetValue;
175 */
176  // create hints representation
177  vHFCands = Llb_ManCollectHighFanoutObjects( pAigGlo, pPars->nHintDepth+pPars->HintFirst, 1 );
178  vHints = Vec_IntStartFull( Aig_ManObjNumMax(pAigGlo) );
179  // add one hint at a time till the problem is solved
180  Vec_IntForEachEntryStart( vHFCands, Entry, i, pPars->HintFirst )
181  {
182  Vec_IntWriteEntry( vHints, Entry, 1 ); // change to 1 to start from zero cof!!!
183  // solve under hints
184  RetValue = Llb_ManModelCheckAig( pAigGlo, pPars, vHints, &ddGlo );
185  if ( RetValue == 0 )
186  goto Finish;
187  if ( RetValue == 1 )
188  break;
189  }
190  if ( RetValue == -1 )
191  goto Finish;
192  // undo the hints one at a time
193  for ( ; i >= pPars->HintFirst; i-- )
194  {
195  Entry = Vec_IntEntry( vHFCands, i );
196  Vec_IntWriteEntry( vHints, Entry, -1 );
197  // solve under relaxed hints
198  RetValue = Llb_ManModelCheckAig( pAigGlo, pPars, vHints, &ddGlo );
199  if ( RetValue == 0 )
200  goto Finish;
201  if ( RetValue == 1 )
202  continue;
203  break;
204  }
205 Finish:
206  if ( ddGlo )
207  {
208  if ( ddGlo->bFunc )
209  Cudd_RecursiveDeref( ddGlo, ddGlo->bFunc );
210  Extra_StopManager( ddGlo );
211  }
212  Vec_IntFreeP( &vHFCands );
213  Vec_IntFreeP( &vHints );
214  if ( pPars->fVerbose )
215  Abc_PrintTime( 1, "Total runtime", Abc_Clock() - clk );
216  return RetValue;
217 }
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
DdNode * bFunc
Definition: cuddInt.h:487
static abctime Abc_Clock()
Definition: abc_global.h:279
void Extra_StopManager(DdManager *dd)
Definition: extraBddMisc.c:223
static Vec_Int_t * Vec_IntStartFull(int nSize)
Definition: vecInt.h:119
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 int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t * Llb_ManCollectHighFanoutObjects(Aig_Man_t *pAig, int nCandMax, int fCisOnly)
Definition: llb1Hint.c:96
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition: vecInt.h:56
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
int Llb_ManModelCheckAig(Aig_Man_t *pAigGlo, Gia_ParLlb_t *pPars, Vec_Int_t *vHints, DdManager **pddGlo)
Definition: llb1Core.c:112
#define assert(ex)
Definition: util_old.h:213
ABC_INT64_T abctime
Definition: abc_global.h:278
void Llb_ManPrepareGroups ( Llb_Man_t pMan)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 356 of file llb1Group.c.

357 {
358  Aig_Obj_t * pObj;
359  int i;
360  assert( pMan->vGroups == NULL );
361  pMan->vGroups = Vec_PtrAlloc( 1000 );
362  Llb_ManGroupCreateFirst( pMan );
363  Aig_ManForEachNode( pMan->pAig, pObj, i )
364  {
365  if ( pObj->fMarkA )
366  Llb_ManGroupCreate( pMan, pObj );
367  }
368  Saig_ManForEachLi( pMan->pAig, pObj, i )
369  {
370  if ( pObj->fMarkA )
371  Llb_ManGroupCreate( pMan, pObj );
372  }
373  Llb_ManGroupCreateLast( pMan );
374 }
Llb_Grp_t * Llb_ManGroupCreate(Llb_Man_t *pMan, Aig_Obj_t *pObj)
Definition: llb1Group.c:175
unsigned int fMarkA
Definition: aig.h:79
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
Definition: aig.h:69
Llb_Grp_t * Llb_ManGroupCreateLast(Llb_Man_t *pMan)
Definition: llb1Group.c:229
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
Llb_Grp_t * Llb_ManGroupCreateFirst(Llb_Man_t *pMan)
Definition: llb1Group.c:207
void Llb_ManPrepareVarLimits ( Llb_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 88 of file llb1Man.c.

89 {
90  Llb_Grp_t * pGroup;
91  Aig_Obj_t * pVar;
92  int i, k;
93  assert( p->vVarBegs == NULL );
94  assert( p->vVarEnds == NULL );
95  p->vVarEnds = Vec_IntStart( Aig_ManObjNumMax(p->pAig) );
96  p->vVarBegs = Vec_IntStart( Aig_ManObjNumMax(p->pAig) );
97  Vec_IntFill( p->vVarBegs, Aig_ManObjNumMax(p->pAig), p->pMatrix->nCols );
98 
99  for ( i = 0; i < p->pMatrix->nCols; i++ )
100  {
101  pGroup = p->pMatrix->pColGrps[i];
102 
103  Vec_PtrForEachEntry( Aig_Obj_t *, pGroup->vIns, pVar, k )
104  if ( Vec_IntEntry(p->vVarBegs, pVar->Id) > i )
105  Vec_IntWriteEntry( p->vVarBegs, pVar->Id, i );
106  Vec_PtrForEachEntry( Aig_Obj_t *, pGroup->vOuts, pVar, k )
107  if ( Vec_IntEntry(p->vVarBegs, pVar->Id) > i )
108  Vec_IntWriteEntry( p->vVarBegs, pVar->Id, i );
109 
110  Vec_PtrForEachEntry( Aig_Obj_t *, pGroup->vIns, pVar, k )
111  if ( Vec_IntEntry(p->vVarEnds, pVar->Id) < i )
112  Vec_IntWriteEntry( p->vVarEnds, pVar->Id, i );
113  Vec_PtrForEachEntry( Aig_Obj_t *, pGroup->vOuts, pVar, k )
114  if ( Vec_IntEntry(p->vVarEnds, pVar->Id) < i )
115  Vec_IntWriteEntry( p->vVarEnds, pVar->Id, i );
116  }
117 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
static Llb_Mgr_t * p
Definition: llb3Image.c:950
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 Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Vec_Ptr_t * vIns
Definition: llbInt.h:97
void Llb_ManPrepareVarMap ( Llb_Man_t p)

DECLARATIONS ///.

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

FileName [llb1Man.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [BDD based reachability.]

Synopsis [Reachability manager.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
llb1Man.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file llb1Man.c.

46 {
47  Aig_Obj_t * pObjLi, * pObjLo;
48  int i, iVarLi, iVarLo;
49  assert( p->vNs2Glo == NULL );
50  assert( p->vCs2Glo == NULL );
51  assert( p->vGlo2Cs == NULL );
52  assert( p->vGlo2Ns == NULL );
53  p->vNs2Glo = Vec_IntStartFull( Vec_IntSize(p->vVar2Obj) );
54  p->vCs2Glo = Vec_IntStartFull( Vec_IntSize(p->vVar2Obj) );
55  p->vGlo2Cs = Vec_IntStartFull( Aig_ManRegNum(p->pAig) );
56  p->vGlo2Ns = Vec_IntStartFull( Aig_ManRegNum(p->pAig) );
57  Saig_ManForEachLiLo( p->pAig, pObjLi, pObjLo, i )
58  {
59  iVarLi = Vec_IntEntry(p->vObj2Var, Aig_ObjId(pObjLi));
60  iVarLo = Vec_IntEntry(p->vObj2Var, Aig_ObjId(pObjLo));
61  assert( iVarLi >= 0 && iVarLi < Vec_IntSize(p->vVar2Obj) );
62  assert( iVarLo >= 0 && iVarLo < Vec_IntSize(p->vVar2Obj) );
63  Vec_IntWriteEntry( p->vNs2Glo, iVarLi, i );
64  Vec_IntWriteEntry( p->vCs2Glo, iVarLo, i );
65  Vec_IntWriteEntry( p->vGlo2Cs, i, iVarLo );
66  Vec_IntWriteEntry( p->vGlo2Ns, i, iVarLi );
67  }
68  // add mapping of the PIs
69  Saig_ManForEachPi( p->pAig, pObjLo, i )
70  {
71  iVarLo = Vec_IntEntry(p->vObj2Var, Aig_ObjId(pObjLo));
72  Vec_IntWriteEntry( p->vCs2Glo, iVarLo, Aig_ManRegNum(p->pAig)+i );
73  Vec_IntWriteEntry( p->vNs2Glo, iVarLo, Aig_ManRegNum(p->pAig)+i );
74  }
75 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition: saig.h:101
static Vec_Int_t * Vec_IntStartFull(int nSize)
Definition: vecInt.h:119
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Definition: aig.h:69
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define assert(ex)
Definition: util_old.h:213
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
void Llb_ManPrintEntries ( Aig_Man_t p,
Vec_Int_t vCands 
)

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

Synopsis [Returns the array of constraint candidates.]

Description []

SideEffects []

SeeAlso []

Definition at line 64 of file llb1Constr.c.

65 {
66  int i, Entry;
67  if ( vCands == NULL )
68  {
69  printf( "There is no hints.\n" );
70  return;
71  }
72  Entry = Llb_ManCountEntries(vCands);
73  printf( "\n*** Using %d hint%s:\n", Entry, (Entry != 1 ? "s":"") );
74  Vec_IntForEachEntry( vCands, Entry, i )
75  {
76  if ( Entry != 0 && Entry != 1 )
77  continue;
78  printf( "%c", Entry ? '+' : '-' );
79  printf( "%-6d : ", i );
80  Aig_ObjPrint( p, Aig_ManObj(p, i) );
81  printf( "\n" );
82  }
83 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Aig_Obj_t * Aig_ManObj(Aig_Man_t *p, int i)
Definition: aig.h:270
ABC_NAMESPACE_IMPL_START int Llb_ManCountEntries(Vec_Int_t *vCands)
DECLARATIONS ///.
Definition: llb1Constr.c:45
void Aig_ObjPrint(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aigObj.c:316
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
int Llb_ManReachability ( Llb_Man_t p,
Vec_Int_t vHints,
DdManager **  pddGlo 
)

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

Synopsis [Perform reachability with hints and returns reached states in ppGlo.]

Description []

SideEffects []

SeeAlso []

Definition at line 582 of file llb1Reach.c.

583 {
584  int * pNs2Glo = Vec_IntArray( p->vNs2Glo );
585  int * pCs2Glo = Vec_IntArray( p->vCs2Glo );
586  int * pGlo2Cs = Vec_IntArray( p->vGlo2Cs );
587  DdNode * bCurrent, * bReached, * bNext, * bTemp, * bCube;
588  DdNode * bConstrCs, * bConstrNs;
589  abctime clk2, clk = Abc_Clock();
590  int nIters, nBddSize = 0;
591 // int nThreshold = 10000;
592 
593  // compute time to stop
594  p->pPars->TimeTarget = p->pPars->TimeLimit ? p->pPars->TimeLimit * CLOCKS_PER_SEC + Abc_Clock(): 0;
595 
596  // define variable limits
598 
599  // start the managers
600  assert( p->dd == NULL );
601  assert( p->ddG == NULL );
602  assert( p->ddR == NULL );
603  p->dd = Cudd_Init( Vec_IntSize(p->vVar2Obj), 0, CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0 );
605  if ( pddGlo && *pddGlo )
606  p->ddG = *pddGlo, *pddGlo = NULL;
607  else
609 
610  if ( p->pPars->fReorder )
611  {
615  }
616  else
617  {
619  Cudd_AutodynDisable( p->ddG );
620  Cudd_AutodynDisable( p->ddR );
621  }
622 
623  // set the stop time parameter
624  p->dd->TimeStop = p->pPars->TimeTarget;
625  p->ddG->TimeStop = p->pPars->TimeTarget;
626  p->ddR->TimeStop = p->pPars->TimeTarget;
627 
628  // create bad state in the ring manager
629  p->ddR->bFunc = Llb_BddComputeBad( p->pAigGlo, p->ddR, p->pPars->TimeTarget );
630  if ( p->ddR->bFunc == NULL )
631  {
632  if ( !p->pPars->fSilent )
633  printf( "Reached timeout (%d seconds) during constructing the bad states.\n", p->pPars->TimeLimit );
634  p->pPars->iFrame = -1;
635  return -1;
636  }
637  Cudd_Ref( p->ddR->bFunc );
638 
639  // derive constraints
640  bConstrCs = Llb_ManCreateConstraints( p, vHints, 0 ); Cudd_Ref( bConstrCs );
641  bConstrNs = Llb_ManCreateConstraints( p, vHints, 1 ); Cudd_Ref( bConstrNs );
642 //Extra_bddPrint( p->dd, bConstrCs ); printf( "\n" );
643 //Extra_bddPrint( p->dd, bConstrNs ); printf( "\n" );
644 
645  // perform reachability analysis
646  // compute the starting set of states
647  if ( p->ddG->bFunc )
648  {
649  bReached = p->ddG->bFunc; p->ddG->bFunc = NULL;
650  bCurrent = Extra_TransferPermute( p->ddG, p->dd, bReached, pGlo2Cs ); Cudd_Ref( bCurrent );
651  }
652  else
653  {
654  bReached = Llb_ManComputeInitState( p, p->ddG ); Cudd_Ref( bReached );
655  bCurrent = Llb_ManComputeInitState( p, p->dd ); Cudd_Ref( bCurrent );
656  }
657 //Extra_bddPrintSupport( p->ddG, bReached ); printf( "\n" );
658 //Extra_bddPrintSupport( p->dd, bCurrent ); printf( "\n" );
659 
660 //Extra_bddPrintSupport( p->dd, bCurrent ); printf( "\n" );
661  for ( nIters = 0; nIters < p->pPars->nIterMax; nIters++ )
662  {
663  clk2 = Abc_Clock();
664  // check the runtime limit
665  if ( p->pPars->TimeLimit && Abc_Clock() > p->pPars->TimeTarget )
666  {
667  if ( !p->pPars->fSilent )
668  printf( "Reached timeout during image computation (%d seconds).\n", p->pPars->TimeLimit );
669  p->pPars->iFrame = nIters - 1;
670  Cudd_RecursiveDeref( p->dd, bCurrent ); bCurrent = NULL;
671  Cudd_RecursiveDeref( p->dd, bConstrCs ); bConstrCs = NULL;
672  Cudd_RecursiveDeref( p->dd, bConstrNs ); bConstrNs = NULL;
673  Cudd_RecursiveDeref( p->ddG, bReached ); bReached = NULL;
674  return -1;
675  }
676 
677  // save the onion ring
678  bTemp = Extra_TransferPermute( p->dd, p->ddR, bCurrent, pCs2Glo );
679  if ( bTemp == NULL )
680  {
681  if ( !p->pPars->fSilent )
682  printf( "Reached timeout (%d seconds) during ring transfer.\n", p->pPars->TimeLimit );
683  p->pPars->iFrame = nIters - 1;
684  Cudd_RecursiveDeref( p->dd, bCurrent ); bCurrent = NULL;
685  Cudd_RecursiveDeref( p->dd, bConstrCs ); bConstrCs = NULL;
686  Cudd_RecursiveDeref( p->dd, bConstrNs ); bConstrNs = NULL;
687  Cudd_RecursiveDeref( p->ddG, bReached ); bReached = NULL;
688  return -1;
689  }
690  Cudd_Ref( bTemp );
691  Vec_PtrPush( p->vRings, bTemp );
692 
693  // check it for bad states
694  if ( !p->pPars->fSkipOutCheck && !Cudd_bddLeq( p->ddR, bTemp, Cudd_Not(p->ddR->bFunc) ) )
695  {
696  assert( p->pAigGlo->pSeqModel == NULL );
697  if ( !p->pPars->fBackward )
698  p->pAigGlo->pSeqModel = Llb_ManReachDeriveCex( p );
699  if ( !p->pPars->fSilent )
700  {
701  if ( !p->pPars->fBackward )
702  Abc_Print( 1, "Output %d of miter \"%s\" was asserted in frame %d. ", p->pAigGlo->pSeqModel->iPo, p->pAigGlo->pName, p->pAigGlo->pName, nIters );
703  else
704  Abc_Print( 1, "Output ??? of miter \"%s\" was asserted in frame %d (counter-example is not produced). ", p->pAigGlo->pName, nIters );
705  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
706  }
707  p->pPars->iFrame = nIters - 1;
708  Cudd_RecursiveDeref( p->dd, bCurrent ); bCurrent = NULL;
709  Cudd_RecursiveDeref( p->dd, bConstrCs ); bConstrCs = NULL;
710  Cudd_RecursiveDeref( p->dd, bConstrNs ); bConstrNs = NULL;
711  Cudd_RecursiveDeref( p->ddG, bReached ); bReached = NULL;
712  return 0;
713  }
714 
715  // restrict reachable states using constraints
716  if ( vHints )
717  {
718  bCurrent = Cudd_bddAnd( p->dd, bTemp = bCurrent, bConstrCs ); Cudd_Ref( bCurrent );
719  Cudd_RecursiveDeref( p->dd, bTemp );
720  }
721 
722  // quantify variables appearing only in the init state
723  bCube = Llb_ManConstructQuantCubeIntern( p, (Llb_Grp_t *)Vec_PtrEntry(p->vGroups,0), 0, 0 ); Cudd_Ref( bCube );
724  bCurrent = Cudd_bddExistAbstract( p->dd, bTemp = bCurrent, bCube ); Cudd_Ref( bCurrent );
725  Cudd_RecursiveDeref( p->dd, bTemp );
726  Cudd_RecursiveDeref( p->dd, bCube );
727 
728  // compute the next states
729  bNext = Llb_ManComputeImage( p, bCurrent, 0 );
730  if ( bNext == NULL )
731  {
732  if ( !p->pPars->fSilent )
733  printf( "Reached timeout (%d seconds) during image computation.\n", p->pPars->TimeLimit );
734  p->pPars->iFrame = nIters - 1;
735  Cudd_RecursiveDeref( p->dd, bCurrent ); bCurrent = NULL;
736  Cudd_RecursiveDeref( p->dd, bConstrCs ); bConstrCs = NULL;
737  Cudd_RecursiveDeref( p->dd, bConstrNs ); bConstrNs = NULL;
738  Cudd_RecursiveDeref( p->ddG, bReached ); bReached = NULL;
739  return -1;
740  }
741  Cudd_Ref( bNext );
742  Cudd_RecursiveDeref( p->dd, bCurrent ); bCurrent = NULL;
743 
744  // restrict reachable states using constraints
745  if ( vHints )
746  {
747  bNext = Cudd_bddAnd( p->dd, bTemp = bNext, bConstrNs ); Cudd_Ref( bNext );
748  Cudd_RecursiveDeref( p->dd, bTemp );
749  }
750 //Extra_bddPrintSupport( p->dd, bNext ); printf( "\n" );
751 
752  // remap these states into the current state vars
753 // bNext = Extra_TransferPermute( p->dd, p->ddG, bTemp = bNext, pNs2Glo ); Cudd_Ref( bNext );
754 // Cudd_RecursiveDeref( p->dd, bTemp );
755 // bNext = Extra_TransferPermuteTime( p->dd, p->ddG, bTemp = bNext, pNs2Glo, p->pPars->TimeTarget );
756  bNext = Extra_TransferPermute( p->dd, p->ddG, bTemp = bNext, pNs2Glo );
757  if ( bNext == NULL )
758  {
759  if ( !p->pPars->fSilent )
760  printf( "Reached timeout (%d seconds) during image computation in transfer 1.\n", p->pPars->TimeLimit );
761  p->pPars->iFrame = nIters - 1;
762  Cudd_RecursiveDeref( p->dd, bTemp );
763  Cudd_RecursiveDeref( p->dd, bConstrCs ); bConstrCs = NULL;
764  Cudd_RecursiveDeref( p->dd, bConstrNs ); bConstrNs = NULL;
765  Cudd_RecursiveDeref( p->ddG, bReached ); bReached = NULL;
766  return -1;
767  }
768  Cudd_Ref( bNext );
769  Cudd_RecursiveDeref( p->dd, bTemp );
770 
771 
772  // check if there are any new states
773  if ( Cudd_bddLeq( p->ddG, bNext, bReached ) ) // implication = no new states
774  {
775  Cudd_RecursiveDeref( p->ddG, bNext ); bNext = NULL;
776  break;
777  }
778 
779  // check the BDD size
780  nBddSize = Cudd_DagSize(bNext);
781  if ( nBddSize > p->pPars->nBddMax )
782  {
783  Cudd_RecursiveDeref( p->ddG, bNext ); bNext = NULL;
784  break;
785  }
786 
787  // get the new states
788  bCurrent = Cudd_bddAnd( p->ddG, bNext, Cudd_Not(bReached) );
789  if ( bCurrent == NULL )
790  {
791  Cudd_RecursiveDeref( p->ddG, bNext ); bNext = NULL;
792  Cudd_RecursiveDeref( p->ddG, bReached ); bReached = NULL;
793  break;
794  }
795  Cudd_Ref( bCurrent );
796  // minimize the new states with the reached states
797 // bCurrent = Cudd_bddConstrain( p->ddG, bTemp = bCurrent, Cudd_Not(bReached) ); Cudd_Ref( bCurrent );
798 // bCurrent = Cudd_bddRestrict( p->ddG, bTemp = bCurrent, Cudd_Not(bReached) ); Cudd_Ref( bCurrent );
799 // Cudd_RecursiveDeref( p->ddG, bTemp );
800 //printf( "Initial BDD =%7d. Constrained BDD =%7d.\n", Cudd_DagSize(bTemp), Cudd_DagSize(bCurrent) );
801 
802  // remap these states into the current state vars
803 // bCurrent = Extra_TransferPermute( p->ddG, p->dd, bTemp = bCurrent, pGlo2Cs ); Cudd_Ref( bCurrent );
804 // Cudd_RecursiveDeref( p->ddG, bTemp );
805 // bCurrent = Extra_TransferPermuteTime( p->ddG, p->dd, bTemp = bCurrent, pGlo2Cs, p->pPars->TimeTarget );
806  bCurrent = Extra_TransferPermute( p->ddG, p->dd, bTemp = bCurrent, pGlo2Cs );
807  if ( bCurrent == NULL )
808  {
809  if ( !p->pPars->fSilent )
810  printf( "Reached timeout (%d seconds) during image computation in transfer 2.\n", p->pPars->TimeLimit );
811  p->pPars->iFrame = nIters - 1;
812  Cudd_RecursiveDeref( p->ddG, bTemp );
813  Cudd_RecursiveDeref( p->dd, bConstrCs ); bConstrCs = NULL;
814  Cudd_RecursiveDeref( p->dd, bConstrNs ); bConstrNs = NULL;
815  Cudd_RecursiveDeref( p->ddG, bReached ); bReached = NULL;
816  return -1;
817  }
818  Cudd_Ref( bCurrent );
819  Cudd_RecursiveDeref( p->ddG, bTemp );
820 
821 
822  // add to the reached states
823  bReached = Cudd_bddOr( p->ddG, bTemp = bReached, bNext );
824  if ( bReached == NULL )
825  {
826  Cudd_RecursiveDeref( p->ddG, bTemp ); bTemp = NULL;
827  Cudd_RecursiveDeref( p->ddG, bNext ); bNext = NULL;
828  break;
829  }
830  Cudd_Ref( bReached );
831  Cudd_RecursiveDeref( p->ddG, bTemp );
832  Cudd_RecursiveDeref( p->ddG, bNext );
833  bNext = NULL;
834 
835  if ( p->pPars->fVerbose )
836  {
837  fprintf( stdout, "F =%5d : ", nIters );
838  fprintf( stdout, "Im =%6d ", nBddSize );
839  fprintf( stdout, "(%4d %3d) ", Cudd_ReadReorderings(p->dd), Cudd_ReadGarbageCollections(p->dd) );
840  fprintf( stdout, "Rea =%6d ", Cudd_DagSize(bReached) );
841  fprintf( stdout, "(%4d%4d) ", Cudd_ReadReorderings(p->ddG), Cudd_ReadGarbageCollections(p->ddG) );
842  Abc_PrintTime( 1, "Time", Abc_Clock() - clk2 );
843  }
844 /*
845  if ( p->pPars->fVerbose )
846  {
847  double nMints = Cudd_CountMinterm(p->ddG, bReached, Saig_ManRegNum(p->pAig) );
848 // Extra_bddPrint( p->ddG, bReached );printf( "\n" );
849  fprintf( stdout, "Reachable states = %.0f. (Ratio = %.4f %%)\n", nMints, 100.0*nMints/pow(2.0, Saig_ManRegNum(p->pAig)) );
850  fflush( stdout );
851  }
852 */
853  }
854  Cudd_RecursiveDeref( p->dd, bConstrCs ); bConstrCs = NULL;
855  Cudd_RecursiveDeref( p->dd, bConstrNs ); bConstrNs = NULL;
856  if ( bReached == NULL )
857  {
858  p->pPars->iFrame = nIters - 1;
859  return 0; // reachable
860  }
861 // assert( bCurrent == NULL );
862  if ( bCurrent )
863  Cudd_RecursiveDeref( p->dd, bCurrent );
864  // report the stats
865  if ( p->pPars->fVerbose )
866  {
867  double nMints = Cudd_CountMinterm(p->ddG, bReached, Saig_ManRegNum(p->pAig) );
868  if ( nIters >= p->pPars->nIterMax || nBddSize > p->pPars->nBddMax )
869  fprintf( stdout, "Reachability analysis is stopped after %d frames.\n", nIters );
870  else
871  fprintf( stdout, "Reachability analysis completed after %d frames.\n", nIters );
872  fprintf( stdout, "Reachable states = %.0f. (Ratio = %.4f %%)\n", nMints, 100.0*nMints/pow(2.0, Saig_ManRegNum(p->pAig)) );
873  fflush( stdout );
874  }
875  if ( nIters >= p->pPars->nIterMax || nBddSize > p->pPars->nBddMax )
876  {
877  if ( !p->pPars->fSilent )
878  printf( "Verified only for states reachable in %d frames. ", nIters );
879  p->pPars->iFrame = p->pPars->nIterMax;
880  Cudd_RecursiveDeref( p->ddG, bReached );
881  return -1; // undecided
882  }
883  if ( pddGlo )
884  {
885  assert( p->ddG->bFunc == NULL );
886  p->ddG->bFunc = bReached; bReached = NULL;
887  assert( *pddGlo == NULL );
888  *pddGlo = p->ddG; p->ddG = NULL;
889  }
890  else
891  Cudd_RecursiveDeref( p->ddG, bReached );
892  if ( !p->pPars->fSilent )
893  printf( "The miter is proved unreachable after %d iterations. ", nIters );
894  p->pPars->iFrame = nIters - 1;
895  return 1; // unreachable
896 }
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
#define CUDD_UNIQUE_SLOTS
Definition: cudd.h:97
DdManager * dd
Definition: llb3Image.c:52
Aig_Man_t * pAig
Definition: llb3Image.c:49
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
double Cudd_CountMinterm(DdManager *manager, DdNode *node, int nvars)
Definition: cuddUtil.c:578
abctime TimeStop
Definition: cuddInt.h:489
Definition: cudd.h:278
#define Cudd_Not(node)
Definition: cudd.h:367
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Cudd_ReadReorderings(DdManager *dd)
Definition: cuddAPI.c:1696
Abc_Cex_t * Llb_ManReachDeriveCex(Llb_Man_t *p)
Definition: llb1Reach.c:469
DdNode * Cudd_bddExistAbstract(DdManager *manager, DdNode *f, DdNode *cube)
Definition: cuddBddAbs.c:130
ABC_NAMESPACE_IMPL_START DdNode * Llb_BddComputeBad(Aig_Man_t *pInit, DdManager *dd, abctime TimeOut)
DECLARATIONS ///.
Definition: llb2Bad.c:45
DdNode * Extra_TransferPermute(DdManager *ddSource, DdManager *ddDestination, DdNode *f, int *Permute)
Definition: extraBddMisc.c:87
#define CUDD_CACHE_SLOTS
Definition: cudd.h:98
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
DdNode * Llb_ManComputeInitState(Llb_Man_t *p, DdManager *dd)
Definition: llb1Reach.c:297
void Llb_ManPrepareVarLimits(Llb_Man_t *p)
Definition: llb1Man.c:88
static abctime Abc_Clock()
Definition: abc_global.h:279
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static int Aig_ManCiNum(Aig_Man_t *p)
Definition: aig.h:251
DdManager * Cudd_Init(unsigned int numVars, unsigned int numVarsZ, unsigned int numSlots, unsigned int cacheSize, unsigned long maxMemory)
Definition: cuddInit.c:125
DdNode * Cudd_bddOr(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:381
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Saig_ManRegNum(Aig_Man_t *p)
Definition: saig.h:77
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
void Cudd_AutodynDisable(DdManager *unique)
Definition: cuddAPI.c:708
DdNode * Llb_ManConstructQuantCubeIntern(Llb_Man_t *p, Llb_Grp_t *pGroup, int iGrpPlace, int fBackward)
Definition: llb1Reach.c:155
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
int Cudd_bddLeq(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:536
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:314
DdNode * Llb_ManCreateConstraints(Llb_Man_t *p, Vec_Int_t *vHints, int fUseNsVars)
Definition: llb1Reach.c:412
#define assert(ex)
Definition: util_old.h:213
DdNode * Llb_ManComputeImage(Llb_Man_t *p, DdNode *bInit, int fBackward)
Definition: llb1Reach.c:328
void Cudd_AutodynEnable(DdManager *unique, Cudd_ReorderingType method)
Definition: cuddAPI.c:669
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
ABC_INT64_T abctime
Definition: abc_global.h:278
int Cudd_ReadGarbageCollections(DdManager *dd)
Definition: cuddAPI.c:1741
int Cudd_DagSize(DdNode *node)
Definition: cuddUtil.c:442
int Llb_ManReachabilityWithHints ( Llb_Man_t p)
Llb_Man_t* Llb_ManStart ( Aig_Man_t pAigGlo,
Aig_Man_t pAig,
Gia_ParLlb_t pPars 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 193 of file llb1Man.c.

194 {
195  Llb_Man_t * p;
196  Aig_ManCleanMarkA( pAig );
197  p = ABC_CALLOC( Llb_Man_t, 1 );
198  p->pAigGlo = pAigGlo;
199  p->pPars = pPars;
200  p->pAig = pAig;
201  p->vVar2Obj = Llb_ManMarkPivotNodes( p->pAig, pPars->fUsePivots );
202  p->vObj2Var = Vec_IntInvert( p->vVar2Obj, -1 );
203  p->vRings = Vec_PtrAlloc( 100 );
206  Aig_ManCleanMarkA( pAig );
207  p->pMatrix = Llb_MtrCreate( p );
208  p->pMatrix->pMan = p;
209  return p;
210 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
ABC_NAMESPACE_IMPL_START void Llb_ManPrepareVarMap(Llb_Man_t *p)
DECLARATIONS ///.
Definition: llb1Man.c:45
static Vec_Int_t * Vec_IntInvert(Vec_Int_t *p, int Fill)
Definition: vecInt.h:1092
Vec_Int_t * Llb_ManMarkPivotNodes(Aig_Man_t *p, int fUseInternal)
Definition: llb1Pivot.c:220
Llb_Mtr_t * Llb_MtrCreate(Llb_Man_t *p)
Definition: llb1Matrix.c:410
void Llb_ManPrepareGroups(Llb_Man_t *pMan)
Definition: llb1Group.c:356
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
void Aig_ManCleanMarkA(Aig_Man_t *p)
Definition: aigUtil.c:148
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
typedefABC_NAMESPACE_HEADER_START struct Llb_Man_t_ Llb_Man_t
INCLUDES ///.
Definition: llbInt.h:46
void Llb_ManStop ( Llb_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 130 of file llb1Man.c.

131 {
132  Llb_Grp_t * pGrp;
133  DdNode * bTemp;
134  int i;
135 
136 // Vec_IntFreeP( &p->vMem );
137 // Vec_PtrFreeP( &p->vTops );
138 // Vec_PtrFreeP( &p->vBots );
139 // Vec_VecFreeP( (Vec_Vec_t **)&p->vCuts );
140 
141  if ( p->pMatrix )
142  Llb_MtrFree( p->pMatrix );
143  Vec_PtrForEachEntry( Llb_Grp_t *, p->vGroups, pGrp, i )
144  Llb_ManGroupStop( pGrp );
145  if ( p->dd )
146  {
147 // printf( "Manager dd\n" );
148  Extra_StopManager( p->dd );
149  }
150  if ( p->ddG )
151  {
152 // printf( "Manager ddG\n" );
153  if ( p->ddG->bFunc )
154  Cudd_RecursiveDeref( p->ddG, p->ddG->bFunc );
155  Extra_StopManager( p->ddG );
156  }
157  if ( p->ddR )
158  {
159 // printf( "Manager ddR\n" );
160  if ( p->ddR->bFunc )
161  Cudd_RecursiveDeref( p->ddR, p->ddR->bFunc );
162  Vec_PtrForEachEntry( DdNode *, p->vRings, bTemp, i )
163  Cudd_RecursiveDeref( p->ddR, bTemp );
164  Extra_StopManager( p->ddR );
165  }
166  Aig_ManStop( p->pAig );
167  Vec_PtrFreeP( &p->vGroups );
168  Vec_IntFreeP( &p->vVar2Obj );
169  Vec_IntFreeP( &p->vObj2Var );
170  Vec_IntFreeP( &p->vVarBegs );
171  Vec_IntFreeP( &p->vVarEnds );
172  Vec_PtrFreeP( &p->vRings );
173  Vec_IntFreeP( &p->vNs2Glo );
174  Vec_IntFreeP( &p->vCs2Glo );
175  Vec_IntFreeP( &p->vGlo2Cs );
176  Vec_IntFreeP( &p->vGlo2Ns );
177 // Vec_IntFreeP( &p->vHints );
178  ABC_FREE( p );
179 }
void Llb_ManGroupStop(Llb_Grp_t *p)
Definition: llb1Group.c:68
DdManager * dd
Definition: llb3Image.c:52
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
void Extra_StopManager(DdManager *dd)
Definition: extraBddMisc.c:223
if(last==0)
Definition: sparse_int.h:34
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_PtrFreeP(Vec_Ptr_t **p)
Definition: vecPtr.h:240
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Llb_MtrFree(Llb_Mtr_t *p)
Definition: llb1Matrix.c:321
int Llb_ManTracePaths ( Aig_Man_t p,
Aig_Obj_t pPivot 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 81 of file llb1Pivot.c.

82 {
83  Aig_Obj_t * pObj;
84  int i, Counter = 0;
85  Aig_ManIncrementTravId( p ); // prev = visited with path to LI (value 0)
86  Aig_ManIncrementTravId( p ); // cur = visited w/o path to LI (value 1)
87  Saig_ManForEachLo( p, pObj, i )
88  Counter += Llb_ManTracePaths_rec( p, pObj, pPivot );
89  return Counter;
90 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
ABC_NAMESPACE_IMPL_START int Llb_ManTracePaths_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Aig_Obj_t *pPivot)
DECLARATIONS ///.
Definition: llb1Pivot.c:45
Definition: aig.h:69
static int Counter
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
Llb_Mtr_t* Llb_MtrCreate ( Llb_Man_t p)

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

Synopsis [Matrix reduce.]

Description []

SideEffects []

SeeAlso []

Definition at line 410 of file llb1Matrix.c.

411 {
412  Llb_Mtr_t * pMatrix;
413  Llb_Grp_t * pGroup;
414  int i;
416  Vec_PtrSize(p->vGroups), Vec_IntSize(p->vVar2Obj) );
417  Vec_PtrForEachEntry( Llb_Grp_t *, p->vGroups, pGroup, i )
418  Llb_MtrAddColumn( pMatrix, pGroup );
419 // Llb_MtrRemoveSingletonRows( pMatrix );
420  return pMatrix;
421 }
Aig_Man_t * pAig
Definition: llb3Image.c:49
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Saig_ManRegNum(Aig_Man_t *p)
Definition: saig.h:77
void Llb_MtrAddColumn(Llb_Mtr_t *p, Llb_Grp_t *pGrp)
Definition: llb1Matrix.c:346
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
Definition: saig.h:73
Llb_Mtr_t * Llb_MtrAlloc(int nPis, int nFfs, int nCols, int nRows)
Definition: llb1Matrix.c:289
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Llb_MtrFree ( Llb_Mtr_t p)

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

Synopsis [Stops the matrix representation.]

Description []

SideEffects []

SeeAlso []

Definition at line 321 of file llb1Matrix.c.

322 {
323  int i;
324  ABC_FREE( p->pProdVars );
325  ABC_FREE( p->pProdNums );
326  for ( i = 0; i < p->nCols; i++ )
327  ABC_FREE( p->pMatrix[i] );
328  ABC_FREE( p->pRowSums );
329  ABC_FREE( p->pColSums );
330  ABC_FREE( p->pMatrix );
331  ABC_FREE( p->pColGrps );
332  ABC_FREE( p );
333 }
int * pProdNums
Definition: llbInt.h:91
int * pRowSums
Definition: llbInt.h:86
char ** pMatrix
Definition: llbInt.h:87
int nCols
Definition: llbInt.h:83
#define ABC_FREE(obj)
Definition: abc_global.h:232
char * pProdVars
Definition: llbInt.h:90
int * pColSums
Definition: llbInt.h:84
Llb_Grp_t ** pColGrps
Definition: llbInt.h:85
void Llb_MtrPrint ( Llb_Mtr_t p,
int  fOrder 
)

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

Synopsis [Creates one column with vars in the array.]

Description []

SideEffects []

SeeAlso []

Definition at line 206 of file llb1Matrix.c.

207 {
208  int * pOrder = NULL;
209  int i, iRow, iCol;
210  if ( fOrder )
211  pOrder = Llb_MtrFindVarOrder( p );
212  for ( i = 0; i < p->nRows; i++ )
213  {
214  iRow = pOrder ? pOrder[i] : i;
215  printf( "%3d : ", iRow );
216  printf( "%3d ", p->pRowSums[iRow] );
217  printf( "%3s ", Llb_MtrVarName(p, iRow) );
218  for ( iCol = 0; iCol < p->nCols; iCol++ )
219  printf( "%c", p->pMatrix[iCol][iRow] ? '*' : ' ' );
220  printf( "\n" );
221  }
222  ABC_FREE( pOrder );
223 }
int * pRowSums
Definition: llbInt.h:86
char * Llb_MtrVarName(Llb_Mtr_t *p, int iVar)
Definition: llb1Matrix.c:181
char ** pMatrix
Definition: llbInt.h:87
int nCols
Definition: llbInt.h:83
#define ABC_FREE(obj)
Definition: abc_global.h:232
int * Llb_MtrFindVarOrder(Llb_Mtr_t *p)
Definition: llb1Matrix.c:132
int nRows
Definition: llbInt.h:82
void Llb_MtrPrintMatrixStats ( Llb_Mtr_t p)

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

Synopsis [Verify columns.]

Description []

SideEffects []

SeeAlso []

Definition at line 236 of file llb1Matrix.c.

237 {
238  int iVar, iGrp, iGrp1, iGrp2, Span = 0, nCutSize = 0, nCutSizeMax = 0;
239  int * pGrp1 = ABC_CALLOC( int, p->nRows );
240  int * pGrp2 = ABC_CALLOC( int, p->nRows );
241  for ( iVar = 0; iVar < p->nRows; iVar++ )
242  {
243  if ( p->pRowSums[iVar] == 0 )
244  continue;
245  for ( iGrp1 = 0; iGrp1 < p->nCols; iGrp1++ )
246  if ( p->pMatrix[iGrp1][iVar] == 1 )
247  break;
248  for ( iGrp2 = p->nCols - 1; iGrp2 >= 0; iGrp2-- )
249  if ( p->pMatrix[iGrp2][iVar] == 1 )
250  break;
251  assert( iGrp1 <= iGrp2 );
252  pGrp1[iVar] = iGrp1;
253  pGrp2[iVar] = iGrp2;
254  Span += iGrp2 - iGrp1;
255  }
256  // compute span
257  for ( iGrp = 0; iGrp < p->nCols; iGrp++ )
258  {
259  for ( iVar = 0; iVar < p->nRows; iVar++ )
260  if ( pGrp1[iVar] == iGrp )
261  nCutSize++;
262  if ( nCutSizeMax < nCutSize )
263  nCutSizeMax = nCutSize;
264  for ( iVar = 0; iVar < p->nRows; iVar++ )
265  if ( pGrp2[iVar] == iGrp )
266  nCutSize--;
267  }
268  ABC_FREE( pGrp1 );
269  ABC_FREE( pGrp2 );
270  printf( "[%4d x %4d] Life-span =%6.2f Max-cut =%5d\n",
271  p->nCols, p->nRows, 1.0*Span/p->nRows, nCutSizeMax );
272  if ( nCutSize )
273  Abc_Print( -1, "Cut size is not zero (%d).\n", nCutSize );
274 }
int * pRowSums
Definition: llbInt.h:86
char ** pMatrix
Definition: llbInt.h:87
int nCols
Definition: llbInt.h:83
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
int nRows
Definition: llbInt.h:82
void Llb_MtrSchedule ( Llb_Mtr_t p)

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

Synopsis [Matrix reduce.]

Description []

SideEffects []

SeeAlso []

Definition at line 222 of file llb1Sched.c.

223 {
224  int iGrp, iGrpBest, i;
225  // start partial product
226  for ( i = 0; i < p->nRows; i++ )
227  {
228  if ( i >= p->nPis && i < p->nPis + p->nFfs )
229  {
230  p->pProdVars[i] = 1;
231  p->pProdNums[i] = p->pRowSums[i] - 1;
232  }
233  else
234  {
235  p->pProdVars[i] = 0;
236  p->pProdNums[i] = p->pRowSums[i];
237  }
238  }
239  // order the partitions
240  Llb_MtrVerifyMatrix( p );
241  for ( iGrp = 1; iGrp < p->nCols-1; iGrp++ )
242  {
243  Llb_MtrVerifyColumns( p, iGrp );
244  iGrpBest = Llb_MtrFindBestColumn( p, iGrp );
245  Llb_MtrUseSelectedColumn( p, iGrpBest );
246  Llb_MtrSwapColumns( p, iGrp, iGrpBest );
247  }
248  Llb_MtrVerifyMatrix( p );
249 }
void Llb_MtrVerifyMatrix(Llb_Mtr_t *p)
Definition: llb1Matrix.c:115
int Llb_MtrFindBestColumn(Llb_Mtr_t *p, int iGrpStart)
Definition: llb1Sched.c:80
void Llb_MtrVerifyColumns(Llb_Mtr_t *p, int iGrpStart)
Definition: llb1Sched.c:194
int * pProdNums
Definition: llbInt.h:91
int * pRowSums
Definition: llbInt.h:86
void Llb_MtrUseSelectedColumn(Llb_Mtr_t *p, int iCol)
Definition: llb1Sched.c:157
int nPis
Definition: llbInt.h:80
int nCols
Definition: llbInt.h:83
ABC_NAMESPACE_IMPL_START void Llb_MtrSwapColumns(Llb_Mtr_t *p, int iCol1, int iCol2)
DECLARATIONS ///.
Definition: llb1Sched.c:45
int nFfs
Definition: llbInt.h:81
int nRows
Definition: llbInt.h:82
char * pProdVars
Definition: llbInt.h:90
void Llb_MtrVerifyMatrix ( Llb_Mtr_t p)

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

Synopsis [Verify columns.]

Description []

SideEffects []

SeeAlso []

Definition at line 115 of file llb1Matrix.c.

116 {
119 }
ABC_NAMESPACE_IMPL_START void Llb_MtrVerifyRowsAll(Llb_Mtr_t *p)
DECLARATIONS ///.
Definition: llb1Matrix.c:67
void Llb_MtrVerifyColumnsAll(Llb_Mtr_t *p)
Definition: llb1Matrix.c:91
Vec_Ptr_t* Llb_Nonlin4Group ( DdManager dd,
Vec_Ptr_t vParts,
Vec_Int_t vVars2Q,
int  nSizeMax 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 806 of file llb4Image.c.

807 {
808  Vec_Ptr_t * vGroups;
809  Llb_Prt_t * pPart, * pPart1, * pPart2;
810  Llb_Mgr_t * p;
811  int i, nReorders;//, clk = Abc_Clock();
812  // start the manager
813  p = Llb_Nonlin4Alloc( dd, vParts, NULL, vVars2Q, nSizeMax );
814  // remove singles
815  Llb_MgrForEachPart( p, pPart, i )
816  if ( Llb_Nonlin4HasSingletonVars(p, pPart) )
817  Llb_Nonlin4Quantify1( p, pPart );
818  // compute scores
820  // iteratively quantify variables
821  while ( Llb_Nonlin4NextPartitions(p, &pPart1, &pPart2) )
822  {
823  nReorders = Cudd_ReadReorderings(dd);
824  if ( !Llb_Nonlin4Quantify2( p, pPart1, pPart2 ) )
825  {
826  Llb_Nonlin4Free( p );
827  return NULL;
828  }
829  if ( nReorders < Cudd_ReadReorderings(dd) )
831 // else
832 // Llb_Nonlin4VerifyScores( p );
833  }
834  // load partitions
835  vGroups = Vec_PtrAlloc( 1000 );
836  Llb_MgrForEachPart( p, pPart, i )
837  {
838 //printf( "Iteration %d ", pPart->iPart );
839  if ( Cudd_IsConstant(pPart->bFunc) )
840  {
841 //printf( "Constant\n" );
842  assert( !Cudd_IsComplement(pPart->bFunc) );
843  continue;
844  }
845 //printf( "\n" );
846  Vec_PtrPush( vGroups, pPart->bFunc );
847  Cudd_Ref( pPart->bFunc );
848 //printf( "Part %d ", pPart->iPart );
849 //Extra_bddPrintSupport( p->dd, pPart->bFunc ); printf( "\n" );
850  }
851  Llb_Nonlin4Free( p );
852 //Abc_PrintTime( 1, "Reparametrization time", Abc_Clock() - clk );
853  return vGroups;
854 }
void Llb_Nonlin4Free(Llb_Mgr_t *p)
Definition: llb4Image.c:726
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Cudd_ReadReorderings(DdManager *dd)
Definition: cuddAPI.c:1696
#define Cudd_IsConstant(node)
Definition: cudd.h:352
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define Cudd_IsComplement(node)
Definition: cudd.h:425
int Llb_Nonlin4NextPartitions(Llb_Mgr_t *p, Llb_Prt_t **ppPart1, Llb_Prt_t **ppPart2)
Definition: llb4Image.c:585
if(last==0)
Definition: sparse_int.h:34
void Llb_Nonlin4RecomputeScores(Llb_Mgr_t *p)
Definition: llb4Image.c:639
Llb_Mgr_t * Llb_Nonlin4Alloc(DdManager *dd, Vec_Ptr_t *vParts, DdNode *bCurrent, Vec_Int_t *vVars2Q, int nSizeMax)
Definition: llb4Image.c:692
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define Llb_MgrForEachPart(p, pPart, i)
Definition: llb4Image.c:69
int Llb_Nonlin4Quantify1(Llb_Mgr_t *p, Llb_Prt_t *pPart)
Definition: llb4Image.c:261
#define assert(ex)
Definition: util_old.h:213
int Llb_Nonlin4HasSingletonVars(Llb_Mgr_t *p, Llb_Prt_t *pPart)
Definition: llb4Image.c:207
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
int Llb_Nonlin4Quantify2(Llb_Mgr_t *p, Llb_Prt_t *pPart1, Llb_Prt_t *pPart2)
Definition: llb4Image.c:320
DdNode* Llb_Nonlin4Image ( DdManager dd,
Vec_Ptr_t vParts,
DdNode bCurrent,
Vec_Int_t vVars2Q 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 752 of file llb4Image.c.

753 {
754  Llb_Prt_t * pPart, * pPart1, * pPart2;
755  Llb_Mgr_t * p;
756  DdNode * bFunc, * bTemp;
757  int i, nReorders;
758  // start the manager
759  p = Llb_Nonlin4Alloc( dd, vParts, bCurrent, vVars2Q, 0 );
760  // remove singles
761  Llb_MgrForEachPart( p, pPart, i )
762  if ( Llb_Nonlin4HasSingletonVars(p, pPart) )
763  Llb_Nonlin4Quantify1( p, pPart );
764  // compute scores
766  // iteratively quantify variables
767  while ( Llb_Nonlin4NextPartitions(p, &pPart1, &pPart2) )
768  {
769  nReorders = Cudd_ReadReorderings(dd);
770  if ( !Llb_Nonlin4Quantify2( p, pPart1, pPart2 ) )
771  {
772  Llb_Nonlin4Free( p );
773  return NULL;
774  }
775  if ( nReorders < Cudd_ReadReorderings(dd) )
777 // else
778 // Llb_Nonlin4VerifyScores( p );
779  }
780  // load partitions
781  bFunc = Cudd_ReadOne(p->dd); Cudd_Ref( bFunc );
782  Llb_MgrForEachPart( p, pPart, i )
783  {
784  bFunc = Cudd_bddAnd( p->dd, bTemp = bFunc, pPart->bFunc ); Cudd_Ref( bFunc );
785  Cudd_RecursiveDeref( p->dd, bTemp );
786  }
787 // nSuppMax = p->nSuppMax;
788  Llb_Nonlin4Free( p );
789 //printf( "\n" );
790  // return
791  Cudd_Deref( bFunc );
792  return bFunc;
793 }
void Llb_Nonlin4Free(Llb_Mgr_t *p)
Definition: llb4Image.c:726
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Cudd_Deref(DdNode *node)
Definition: cuddRef.c:438
int Cudd_ReadReorderings(DdManager *dd)
Definition: cuddAPI.c:1696
int Llb_Nonlin4NextPartitions(Llb_Mgr_t *p, Llb_Prt_t **ppPart1, Llb_Prt_t **ppPart2)
Definition: llb4Image.c:585
if(last==0)
Definition: sparse_int.h:34
void Llb_Nonlin4RecomputeScores(Llb_Mgr_t *p)
Definition: llb4Image.c:639
Llb_Mgr_t * Llb_Nonlin4Alloc(DdManager *dd, Vec_Ptr_t *vParts, DdNode *bCurrent, Vec_Int_t *vVars2Q, int nSizeMax)
Definition: llb4Image.c:692
DdNode * Cudd_ReadOne(DdManager *dd)
Definition: cuddAPI.c:987
#define Llb_MgrForEachPart(p, pPart, i)
Definition: llb4Image.c:69
int Llb_Nonlin4Quantify1(Llb_Mgr_t *p, Llb_Prt_t *pPart)
Definition: llb4Image.c:261
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:314
int Llb_Nonlin4HasSingletonVars(Llb_Mgr_t *p, Llb_Prt_t *pPart)
Definition: llb4Image.c:207
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
int Llb_Nonlin4Quantify2(Llb_Mgr_t *p, Llb_Prt_t *pPart1, Llb_Prt_t *pPart2)
Definition: llb4Image.c:320
DdNode* Llb_NonlinComputeInitState ( Aig_Man_t pAig,
DdManager dd 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 214 of file llb3Nonlin.c.

215 {
216  Aig_Obj_t * pObj;
217  DdNode * bRes, * bVar, * bTemp;
218  int i, iVar;
219  abctime TimeStop;
220  TimeStop = dd->TimeStop; dd->TimeStop = 0;
221  bRes = Cudd_ReadOne( dd ); Cudd_Ref( bRes );
222  Saig_ManForEachLo( pAig, pObj, i )
223  {
224  iVar = (Cudd_ReadSize(dd) == Aig_ManRegNum(pAig)) ? i : Aig_ObjId(pObj);
225  bVar = Cudd_bddIthVar( dd, iVar );
226  bRes = Cudd_bddAnd( dd, bTemp = bRes, Cudd_Not(bVar) ); Cudd_Ref( bRes );
227  Cudd_RecursiveDeref( dd, bTemp );
228  }
229  Cudd_Deref( bRes );
230  dd->TimeStop = TimeStop;
231  return bRes;
232 }
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
abctime TimeStop
Definition: cuddInt.h:489
Definition: cudd.h:278
#define Cudd_Not(node)
Definition: cudd.h:367
void Cudd_Deref(DdNode *node)
Definition: cuddRef.c:438
int Cudd_ReadSize(DdManager *dd)
Definition: cuddAPI.c:1441
Definition: aig.h:69
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
DdNode * Cudd_ReadOne(DdManager *dd)
Definition: cuddAPI.c:987
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
Definition: cuddAPI.c:416
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:314
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
ABC_INT64_T abctime
Definition: abc_global.h:278
DdNode* Llb_NonlinImage ( Aig_Man_t pAig,
Vec_Ptr_t vLeaves,
Vec_Ptr_t vRoots,
int *  pVars2Q,
DdManager dd,
DdNode bCurrent,
int  fReorder,
int  fVerbose,
int *  pOrder 
)

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

Synopsis [Performs image computation.]

Description [Computes image of BDDs (vFuncs).]

SideEffects [BDDs in vFuncs are derefed inside. The result is refed.]

SeeAlso []

Definition at line 884 of file llb3Image.c.

886 {
887  Llb_Prt_t * pPart, * pPart1, * pPart2;
888  Llb_Mgr_t * p;
889  DdNode * bFunc, * bTemp;
890  int i, nReorders, timeInside;
891  abctime clk = Abc_Clock(), clk2;
892  // start the manager
893  clk2 = Abc_Clock();
894  p = Llb_NonlinAlloc( pAig, vLeaves, vRoots, pVars2Q, dd );
895  if ( !Llb_NonlinStart( p ) )
896  {
897  Llb_NonlinFree( p );
898  return NULL;
899  }
900  // add partition
901  Llb_NonlinAddPartition( p, p->iPartFree++, bCurrent );
902  // remove singles
903  Llb_MgrForEachPart( p, pPart, i )
904  if ( Llb_NonlinHasSingletonVars(p, pPart) )
905  Llb_NonlinQuantify1( p, pPart, 0 );
906  timeBuild += Abc_Clock() - clk2;
907  timeInside = Abc_Clock() - clk2;
908  // compute scores
910  // save permutation
911  if ( pOrder )
912  memcpy( pOrder, dd->invperm, sizeof(int) * dd->size );
913  // iteratively quantify variables
914  while ( Llb_NonlinNextPartitions(p, &pPart1, &pPart2) )
915  {
916  clk2 = Abc_Clock();
917  nReorders = Cudd_ReadReorderings(dd);
918  if ( !Llb_NonlinQuantify2( p, pPart1, pPart2 ) )
919  {
920  Llb_NonlinFree( p );
921  return NULL;
922  }
923  timeAndEx += Abc_Clock() - clk2;
924  timeInside += Abc_Clock() - clk2;
925  if ( nReorders < Cudd_ReadReorderings(dd) )
927 // else
928 // Llb_NonlinVerifyScores( p );
929  }
930  // load partitions
931  bFunc = Cudd_ReadOne(p->dd); Cudd_Ref( bFunc );
932  Llb_MgrForEachPart( p, pPart, i )
933  {
934  bFunc = Cudd_bddAnd( p->dd, bTemp = bFunc, pPart->bFunc ); Cudd_Ref( bFunc );
935  Cudd_RecursiveDeref( p->dd, bTemp );
936  }
937  nSuppMax = p->nSuppMax;
938  Llb_NonlinFree( p );
939  // reorder variables
940  if ( fReorder )
941  Llb_NonlinReorder( dd, 0, fVerbose );
942  timeOther += Abc_Clock() - clk - timeInside;
943  // return
944  Cudd_Deref( bFunc );
945  return bFunc;
946 }
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Llb_NonlinQuantify2(Llb_Mgr_t *p, Llb_Prt_t *pPart1, Llb_Prt_t *pPart2)
Definition: llb3Image.c:342
abctime timeAndEx
Definition: llb3Image.c:82
void Cudd_Deref(DdNode *node)
Definition: cuddRef.c:438
int Cudd_ReadReorderings(DdManager *dd)
Definition: cuddAPI.c:1696
abctime timeBuild
Definition: llb3Image.c:82
void Llb_NonlinRecomputeScores(Llb_Mgr_t *p)
Definition: llb3Image.c:777
char * memcpy()
abctime timeOther
Definition: llb3Image.c:82
static abctime Abc_Clock()
Definition: abc_global.h:279
int nSuppMax
Definition: llb3Image.c:83
Llb_Mgr_t * Llb_NonlinAlloc(Aig_Man_t *pAig, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vRoots, int *pVars2Q, DdManager *dd)
Definition: llb3Image.c:830
int Llb_NonlinHasSingletonVars(Llb_Mgr_t *p, Llb_Prt_t *pPart)
Definition: llb3Image.c:208
#define Llb_MgrForEachPart(p, pPart, i)
Definition: llb3Image.c:71
if(last==0)
Definition: sparse_int.h:34
static int size
Definition: cuddSign.c:86
int iPartFree
Definition: llb3Image.c:57
int Llb_NonlinNextPartitions(Llb_Mgr_t *p, Llb_Prt_t **ppPart1, Llb_Prt_t **ppPart2)
Definition: llb3Image.c:705
DdNode * Cudd_ReadOne(DdManager *dd)
Definition: cuddAPI.c:987
void Llb_NonlinFree(Llb_Mgr_t *p)
Definition: llb3Image.c:858
int Llb_NonlinQuantify1(Llb_Mgr_t *p, Llb_Prt_t *pPart, int fSubset)
Definition: llb3Image.c:262
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:314
int Llb_NonlinStart(Llb_Mgr_t *p)
Definition: llb3Image.c:660
void Llb_NonlinReorder(DdManager *dd, int fTwice, int fVerbose)
Definition: llb3Image.c:748
void Llb_NonlinAddPartition(Llb_Mgr_t *p, int i, DdNode *bFunc)
Definition: llb3Image.c:628
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
ABC_INT64_T abctime
Definition: abc_global.h:278
DdNode* Llb_NonlinImageCompute ( DdNode bCurrent,
int  fReorder,
int  fDrop,
int  fVerbose,
int *  pOrder 
)

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

Synopsis [Performs image computation.]

Description []

SideEffects []

SeeAlso []

Definition at line 999 of file llb3Image.c.

1000 {
1001  Llb_Prt_t * pPart, * pPart1, * pPart2;
1002  DdNode * bFunc, * bTemp;
1003  int i, nReorders, timeInside = 0;
1004  abctime clk = Abc_Clock(), clk2;
1005 
1006  // add partition
1007  Llb_NonlinAddPartition( p, p->iPartFree++, bCurrent );
1008  // remove singles
1009  Llb_MgrForEachPart( p, pPart, i )
1010  if ( Llb_NonlinHasSingletonVars(p, pPart) )
1011  Llb_NonlinQuantify1( p, pPart, 0 );
1012  // reorder
1013  if ( fReorder )
1014  Llb_NonlinReorder( p->dd, 0, 0 );
1015  // save permutation
1016  memcpy( pOrder, p->dd->invperm, sizeof(int) * p->dd->size );
1017 
1018  // compute scores
1020  // iteratively quantify variables
1021  while ( Llb_NonlinNextPartitions(p, &pPart1, &pPart2) )
1022  {
1023  clk2 = Abc_Clock();
1024  nReorders = Cudd_ReadReorderings(p->dd);
1025  if ( !Llb_NonlinQuantify2( p, pPart1, pPart2 ) )
1026  {
1027  Llb_NonlinFree( p );
1028  return NULL;
1029  }
1030  timeAndEx += Abc_Clock() - clk2;
1031  timeInside += Abc_Clock() - clk2;
1032  if ( nReorders < Cudd_ReadReorderings(p->dd) )
1034 // else
1035 // Llb_NonlinVerifyScores( p );
1036  }
1037  // load partitions
1038  bFunc = Cudd_ReadOne(p->dd); Cudd_Ref( bFunc );
1039  Llb_MgrForEachPart( p, pPart, i )
1040  {
1041  bFunc = Cudd_bddAnd( p->dd, bTemp = bFunc, pPart->bFunc );
1042  if ( bFunc == NULL )
1043  {
1044  Cudd_RecursiveDeref( p->dd, bTemp );
1045  Llb_NonlinFree( p );
1046  return NULL;
1047  }
1048  Cudd_Ref( bFunc );
1049  Cudd_RecursiveDeref( p->dd, bTemp );
1050  }
1051  nSuppMax = p->nSuppMax;
1052  // reorder variables
1053 // if ( fReorder )
1054 // Llb_NonlinReorder( p->dd, 0, fVerbose );
1055  // save permutation
1056 // memcpy( pOrder, p->dd->invperm, sizeof(int) * Cudd_ReadSize(p->dd) );
1057 
1058  timeOther += Abc_Clock() - clk - timeInside;
1059  // return
1060  Cudd_Deref( bFunc );
1061  return bFunc;
1062 }
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Llb_NonlinQuantify2(Llb_Mgr_t *p, Llb_Prt_t *pPart1, Llb_Prt_t *pPart2)
Definition: llb3Image.c:342
abctime timeAndEx
Definition: llb3Image.c:82
void Cudd_Deref(DdNode *node)
Definition: cuddRef.c:438
int Cudd_ReadReorderings(DdManager *dd)
Definition: cuddAPI.c:1696
void Llb_NonlinRecomputeScores(Llb_Mgr_t *p)
Definition: llb3Image.c:777
char * memcpy()
abctime timeOther
Definition: llb3Image.c:82
static abctime Abc_Clock()
Definition: abc_global.h:279
int nSuppMax
Definition: llb3Image.c:83
int Llb_NonlinHasSingletonVars(Llb_Mgr_t *p, Llb_Prt_t *pPart)
Definition: llb3Image.c:208
#define Llb_MgrForEachPart(p, pPart, i)
Definition: llb3Image.c:71
if(last==0)
Definition: sparse_int.h:34
static int size
Definition: cuddSign.c:86
int iPartFree
Definition: llb3Image.c:57
int Llb_NonlinNextPartitions(Llb_Mgr_t *p, Llb_Prt_t **ppPart1, Llb_Prt_t **ppPart2)
Definition: llb3Image.c:705
DdNode * Cudd_ReadOne(DdManager *dd)
Definition: cuddAPI.c:987
void Llb_NonlinFree(Llb_Mgr_t *p)
Definition: llb3Image.c:858
int Llb_NonlinQuantify1(Llb_Mgr_t *p, Llb_Prt_t *pPart, int fSubset)
Definition: llb3Image.c:262
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
Definition: cuddBddIte.c:314
void Llb_NonlinReorder(DdManager *dd, int fTwice, int fVerbose)
Definition: llb3Image.c:748
void Llb_NonlinAddPartition(Llb_Mgr_t *p, int i, DdNode *bFunc)
Definition: llb3Image.c:628
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
ABC_INT64_T abctime
Definition: abc_global.h:278
void Llb_NonlinImageQuit ( )

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

Synopsis [Quits image computation manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 1075 of file llb3Image.c.

1076 {
1077  DdManager * dd;
1078  if ( p == NULL )
1079  return;
1080  dd = p->dd;
1081  Llb_NonlinFree( p );
1082  if ( dd->bFunc )
1083  Cudd_RecursiveDeref( dd, dd->bFunc );
1084  Extra_StopManager( dd );
1085 // Cudd_Quit ( dd );
1086  p = NULL;
1087 }
DdManager * dd
Definition: llb3Image.c:52
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
static Llb_Mgr_t * p
Definition: llb3Image.c:950
DdNode * bFunc
Definition: cuddInt.h:487
void Extra_StopManager(DdManager *dd)
Definition: extraBddMisc.c:223
void Llb_NonlinFree(Llb_Mgr_t *p)
Definition: llb3Image.c:858
DdManager* Llb_NonlinImageStart ( Aig_Man_t pAig,
Vec_Ptr_t vLeaves,
Vec_Ptr_t vRoots,
int *  pVars2Q,
int *  pOrder,
int  fFirst,
abctime  TimeTarget 
)

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

Synopsis [Starts image computation manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 963 of file llb3Image.c.

964 {
965  DdManager * dd;
966  abctime clk = Abc_Clock();
967  assert( p == NULL );
968  // start a new manager (disable reordering)
970  dd->TimeStop = TimeTarget;
971  Cudd_ShuffleHeap( dd, pOrder );
972 // if ( fFirst )
974  // start the manager
975  p = Llb_NonlinAlloc( pAig, vLeaves, vRoots, pVars2Q, dd );
976  if ( !Llb_NonlinStart( p ) )
977  {
978  Llb_NonlinFree( p );
979  p = NULL;
980  return NULL;
981  }
982  timeBuild += Abc_Clock() - clk;
983 // if ( !fFirst )
984 // Cudd_AutodynEnable( dd, CUDD_REORDER_SYMM_SIFT );
985  return dd;
986 }
#define CUDD_UNIQUE_SLOTS
Definition: cudd.h:97
abctime TimeStop
Definition: cuddInt.h:489
static Llb_Mgr_t * p
Definition: llb3Image.c:950
abctime timeBuild
Definition: llb3Image.c:82
#define CUDD_CACHE_SLOTS
Definition: cudd.h:98
static abctime Abc_Clock()
Definition: abc_global.h:279
Llb_Mgr_t * Llb_NonlinAlloc(Aig_Man_t *pAig, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vRoots, int *pVars2Q, DdManager *dd)
Definition: llb3Image.c:830
int Cudd_ShuffleHeap(DdManager *table, int *permutation)
Definition: cuddReorder.c:338
DdManager * Cudd_Init(unsigned int numVars, unsigned int numVarsZ, unsigned int numSlots, unsigned int cacheSize, unsigned long maxMemory)
Definition: cuddInit.c:125
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
void Llb_NonlinFree(Llb_Mgr_t *p)
Definition: llb3Image.c:858
int Llb_NonlinStart(Llb_Mgr_t *p)
Definition: llb3Image.c:660
#define assert(ex)
Definition: util_old.h:213
void Cudd_AutodynEnable(DdManager *unique, Cudd_ReorderingType method)
Definition: cuddAPI.c:669
ABC_INT64_T abctime
Definition: abc_global.h:278
static int Llb_ObjBddVar ( Vec_Int_t vOrder,
Aig_Obj_t pObj 
)
inlinestatic

MACRO DEFINITIONS ///.

Definition at line 109 of file llbInt.h.

109 { return Vec_IntEntry(vOrder, Aig_ObjId(pObj)); }
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286