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

Go to the source code of this file.

Data Structures

struct  Llb_Var_t_
 
struct  Llb_Prt_t_
 
struct  Llb_Mgr_t_
 

Macros

#define Llb_MgrForEachVar(p, pVar, i)   for ( i = 0; (i < p->nVars) && (((pVar) = Llb_MgrVar(p, i)), 1); i++ ) if ( pVar == NULL ) {} else
 
#define Llb_MgrForEachPart(p, pPart, i)   for ( i = 0; (i < p->iPartFree) && (((pPart) = Llb_MgrPart(p, i)), 1); i++ ) if ( pPart == NULL ) {} else
 
#define Llb_PartForEachVar(p, pPart, pVar, i)   for ( i = 0; (i < Vec_IntSize(pPart->vVars)) && (((pVar) = Llb_MgrVar(p, Vec_IntEntry(pPart->vVars,i))), 1); i++ )
 
#define Llb_VarForEachPart(p, pVar, pPart, i)   for ( i = 0; (i < Vec_IntSize(pVar->vParts)) && (((pPart) = Llb_MgrPart(p, Vec_IntEntry(pVar->vParts,i))), 1); i++ )
 

Typedefs

typedef
typedefABC_NAMESPACE_IMPL_START
struct Llb_Var_t_ 
Llb_Var_t
 DECLARATIONS ///. More...
 
typedef struct Llb_Prt_t_ Llb_Prt_t
 
typedef struct Llb_Mgr_t_ Llb_Mgr_t
 

Functions

static Llb_Var_tLlb_MgrVar (Llb_Mgr_t *p, int i)
 
static Llb_Prt_tLlb_MgrPart (Llb_Mgr_t *p, int i)
 
void Llb_Nonlin4RemoveVar (Llb_Mgr_t *p, Llb_Var_t *pVar)
 FUNCTION DEFINITIONS ///. More...
 
void Llb_Nonlin4RemovePart (Llb_Mgr_t *p, Llb_Prt_t *pPart)
 
DdNodeLlb_Nonlin4CreateCube1 (Llb_Mgr_t *p, Llb_Prt_t *pPart)
 
DdNodeLlb_Nonlin4CreateCube2 (Llb_Mgr_t *p, Llb_Prt_t *pPart1, Llb_Prt_t *pPart2)
 
int Llb_Nonlin4HasSingletonVars (Llb_Mgr_t *p, Llb_Prt_t *pPart)
 
void Llb_Nonlin4Print (Llb_Mgr_t *p)
 
int Llb_Nonlin4Quantify1 (Llb_Mgr_t *p, Llb_Prt_t *pPart)
 
int Llb_Nonlin4Quantify2 (Llb_Mgr_t *p, Llb_Prt_t *pPart1, Llb_Prt_t *pPart2)
 
void Llb_Nonlin4CutNodes_rec (Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
 
Vec_Ptr_tLlb_Nonlin4CutNodes (Aig_Man_t *p, Vec_Ptr_t *vLower, Vec_Ptr_t *vUpper)
 
void Llb_Nonlin4AddPair (Llb_Mgr_t *p, int iPart, int iVar)
 
void Llb_Nonlin4AddPartition (Llb_Mgr_t *p, int i, DdNode *bFunc)
 
void Llb_Nonlin4CheckVars (Llb_Mgr_t *p)
 
int Llb_Nonlin4NextPartitions (Llb_Mgr_t *p, Llb_Prt_t **ppPart1, Llb_Prt_t **ppPart2)
 
void Llb_Nonlin4RecomputeScores (Llb_Mgr_t *p)
 
void Llb_Nonlin4VerifyScores (Llb_Mgr_t *p)
 
Llb_Mgr_tLlb_Nonlin4Alloc (DdManager *dd, Vec_Ptr_t *vParts, DdNode *bCurrent, Vec_Int_t *vVars2Q, int nSizeMax)
 
void Llb_Nonlin4Free (Llb_Mgr_t *p)
 
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)
 

Macro Definition Documentation

#define Llb_MgrForEachPart (   p,
  pPart,
 
)    for ( i = 0; (i < p->iPartFree) && (((pPart) = Llb_MgrPart(p, i)), 1); i++ ) if ( pPart == NULL ) {} else

Definition at line 69 of file llb4Image.c.

#define Llb_MgrForEachVar (   p,
  pVar,
 
)    for ( i = 0; (i < p->nVars) && (((pVar) = Llb_MgrVar(p, i)), 1); i++ ) if ( pVar == NULL ) {} else

Definition at line 66 of file llb4Image.c.

#define Llb_PartForEachVar (   p,
  pPart,
  pVar,
 
)    for ( i = 0; (i < Vec_IntSize(pPart->vVars)) && (((pVar) = Llb_MgrVar(p, Vec_IntEntry(pPart->vVars,i))), 1); i++ )

Definition at line 73 of file llb4Image.c.

#define Llb_VarForEachPart (   p,
  pVar,
  pPart,
 
)    for ( i = 0; (i < Vec_IntSize(pVar->vParts)) && (((pPart) = Llb_MgrPart(p, Vec_IntEntry(pVar->vParts,i))), 1); i++ )

Definition at line 76 of file llb4Image.c.

Typedef Documentation

typedef struct Llb_Mgr_t_ Llb_Mgr_t

Definition at line 46 of file llb4Image.c.

typedef struct Llb_Prt_t_ Llb_Prt_t

Definition at line 37 of file llb4Image.c.

typedef typedefABC_NAMESPACE_IMPL_START struct Llb_Var_t_ Llb_Var_t

DECLARATIONS ///.

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

FileName [llb3Image.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [BDD based reachability.]

Synopsis [Computes image using partitioned structure.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 29 of file llb4Image.c.

Function Documentation

static Llb_Prt_t* Llb_MgrPart ( Llb_Mgr_t p,
int  i 
)
inlinestatic

Definition at line 63 of file llb4Image.c.

63 { return p->pParts[i]; }
Llb_Prt_t ** pParts
Definition: llb3Image.c:55
static Llb_Var_t* Llb_MgrVar ( Llb_Mgr_t p,
int  i 
)
inlinestatic

Definition at line 62 of file llb4Image.c.

62 { return p->pVars[i]; }
Llb_Var_t ** pVars
Definition: llb3Image.c:56
void Llb_Nonlin4AddPair ( Llb_Mgr_t p,
int  iPart,
int  iVar 
)

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

Synopsis [Starts non-linear quantification scheduling.]

Description []

SideEffects []

SeeAlso []

Definition at line 510 of file llb4Image.c.

511 {
512  if ( p->pVars[iVar] == NULL )
513  {
514  p->pVars[iVar] = ABC_CALLOC( Llb_Var_t, 1 );
515  p->pVars[iVar]->iVar = iVar;
516  p->pVars[iVar]->nScore = 0;
517  p->pVars[iVar]->vParts = Vec_IntAlloc( 8 );
518  }
519  Vec_IntPush( p->pVars[iVar]->vParts, iPart );
520  Vec_IntPush( p->pParts[iPart]->vVars, iVar );
521 }
Llb_Prt_t ** pParts
Definition: llb3Image.c:55
typedefABC_NAMESPACE_IMPL_START struct Llb_Var_t_ Llb_Var_t
DECLARATIONS ///.
Definition: llb3Image.c:29
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
Llb_Var_t ** pVars
Definition: llb3Image.c:56
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
Vec_Int_t * vVars
Definition: llb3Image.c:43
void Llb_Nonlin4AddPartition ( Llb_Mgr_t p,
int  i,
DdNode bFunc 
)

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

Synopsis [Starts non-linear quantification scheduling.]

Description []

SideEffects []

SeeAlso []

Definition at line 534 of file llb4Image.c.

535 {
536  int k, nSuppSize;
537  assert( !Cudd_IsConstant(bFunc) );
538 //printf( "Creating init %d\n", i );
539  // create partition
540  p->pParts[i] = ABC_CALLOC( Llb_Prt_t, 1 );
541  p->pParts[i]->iPart = i;
542  p->pParts[i]->bFunc = bFunc; Cudd_Ref( bFunc );
543  p->pParts[i]->vVars = Vec_IntAlloc( 8 );
544  // add support dependencies
545  nSuppSize = 0;
546  Extra_SupportArray( p->dd, bFunc, p->pSupp );
547  for ( k = 0; k < p->nVars; k++ )
548  {
549  nSuppSize += p->pSupp[k];
550  if ( p->pSupp[k] && Vec_IntEntry(p->vVars2Q, k) )
551  Llb_Nonlin4AddPair( p, i, k );
552  }
553  p->nSuppMax = Abc_MaxInt( p->nSuppMax, nSuppSize );
554 }
Llb_Prt_t ** pParts
Definition: llb3Image.c:55
DdManager * dd
Definition: llb3Image.c:52
int * pSupp
Definition: llb3Image.c:61
#define Cudd_IsConstant(node)
Definition: cudd.h:352
int nSuppMax
Definition: llb3Image.c:59
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
int * Extra_SupportArray(DdManager *dd, DdNode *F, int *support)
Definition: extraBddMisc.c:537
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t * vVars2Q
Definition: llb4Image.c:50
int iPart
Definition: llb3Image.c:40
DdNode * bFunc
Definition: llb3Image.c:42
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
void Llb_Nonlin4AddPair(Llb_Mgr_t *p, int iPart, int iVar)
Definition: llb4Image.c:510
#define assert(ex)
Definition: util_old.h:213
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
Vec_Int_t * vVars
Definition: llb3Image.c:43
int nVars
Definition: llb3Image.c:58
Llb_Mgr_t* Llb_Nonlin4Alloc ( DdManager dd,
Vec_Ptr_t vParts,
DdNode bCurrent,
Vec_Int_t vVars2Q,
int  nSizeMax 
)

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

Synopsis [Starts non-linear quantification scheduling.]

Description []

SideEffects []

SeeAlso []

Definition at line 692 of file llb4Image.c.

693 {
694  Llb_Mgr_t * p;
695  DdNode * bFunc;
696  int i;
697  p = ABC_CALLOC( Llb_Mgr_t, 1 );
698  p->dd = dd;
699  p->nSizeMax = nSizeMax;
700  p->vVars2Q = vVars2Q;
701  p->nVars = Cudd_ReadSize(dd);
702  p->iPartFree = Vec_PtrSize(vParts);
703  p->pVars = ABC_CALLOC( Llb_Var_t *, p->nVars );
704  p->pParts = ABC_CALLOC( Llb_Prt_t *, 2 * p->iPartFree + 2 );
705  p->pSupp = ABC_ALLOC( int, Cudd_ReadSize(dd) );
706  // add pairs (refs are consumed inside)
707  Vec_PtrForEachEntry( DdNode *, vParts, bFunc, i )
708  Llb_Nonlin4AddPartition( p, i, bFunc );
709  // add partition
710  if ( bCurrent )
711  Llb_Nonlin4AddPartition( p, p->iPartFree++, bCurrent );
712  return p;
713 }
Llb_Prt_t ** pParts
Definition: llb3Image.c:55
DdManager * dd
Definition: llb3Image.c:52
Definition: cudd.h:278
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int * pSupp
Definition: llb3Image.c:61
void Llb_Nonlin4AddPartition(Llb_Mgr_t *p, int i, DdNode *bFunc)
Definition: llb4Image.c:534
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int nSizeMax
Definition: llb4Image.c:51
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int Cudd_ReadSize(DdManager *dd)
Definition: cuddAPI.c:1441
typedefABC_NAMESPACE_IMPL_START struct Llb_Var_t_ Llb_Var_t
DECLARATIONS ///.
Definition: llb3Image.c:29
Llb_Var_t ** pVars
Definition: llb3Image.c:56
if(last==0)
Definition: sparse_int.h:34
Vec_Int_t * vVars2Q
Definition: llb4Image.c:50
int iPartFree
Definition: llb3Image.c:57
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
int nVars
Definition: llb3Image.c:58
void Llb_Nonlin4CheckVars ( Llb_Mgr_t p)

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

Synopsis [Checks that each var appears in at least one partition.]

Description []

SideEffects []

SeeAlso []

Definition at line 566 of file llb4Image.c.

567 {
568  Llb_Var_t * pVar;
569  int i;
570  Llb_MgrForEachVar( p, pVar, i )
571  assert( Vec_IntSize(pVar->vParts) > 1 );
572 }
typedefABC_NAMESPACE_IMPL_START struct Llb_Var_t_ Llb_Var_t
DECLARATIONS ///.
Definition: llb3Image.c:29
#define Llb_MgrForEachVar(p, pVar, i)
Definition: llb4Image.c:66
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
DdNode* Llb_Nonlin4CreateCube1 ( Llb_Mgr_t p,
Llb_Prt_t pPart 
)

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

Synopsis [Create cube with singleton variables.]

Description []

SideEffects []

SeeAlso []

Definition at line 138 of file llb4Image.c.

139 {
140  DdNode * bCube, * bTemp;
141  Llb_Var_t * pVar;
142  int i;
143  abctime TimeStop;
144  TimeStop = p->dd->TimeStop; p->dd->TimeStop = 0;
145  bCube = Cudd_ReadOne(p->dd); Cudd_Ref( bCube );
146  Llb_PartForEachVar( p, pPart, pVar, i )
147  {
148  assert( Vec_IntSize(pVar->vParts) > 0 );
149  if ( Vec_IntSize(pVar->vParts) != 1 )
150  continue;
151  assert( Vec_IntEntry(pVar->vParts, 0) == pPart->iPart );
152  bCube = Cudd_bddAnd( p->dd, bTemp = bCube, Cudd_bddIthVar(p->dd, pVar->iVar) ); Cudd_Ref( bCube );
153  Cudd_RecursiveDeref( p->dd, bTemp );
154  }
155  Cudd_Deref( bCube );
156  p->dd->TimeStop = TimeStop;
157  return bCube;
158 }
DdManager * dd
Definition: llb3Image.c:52
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
typedefABC_NAMESPACE_IMPL_START struct Llb_Var_t_ Llb_Var_t
DECLARATIONS ///.
Definition: llb3Image.c:29
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
int iPart
Definition: llb3Image.c:40
DdNode * Cudd_ReadOne(DdManager *dd)
Definition: cuddAPI.c:987
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
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 Llb_PartForEachVar(p, pPart, pVar, i)
Definition: llb4Image.c:73
DdNode* Llb_Nonlin4CreateCube2 ( Llb_Mgr_t p,
Llb_Prt_t pPart1,
Llb_Prt_t pPart2 
)

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

Synopsis [Create cube of variables appearing only in two partitions.]

Description []

SideEffects []

SeeAlso []

Definition at line 171 of file llb4Image.c.

172 {
173  DdNode * bCube, * bTemp;
174  Llb_Var_t * pVar;
175  int i;
176  abctime TimeStop;
177  TimeStop = p->dd->TimeStop; p->dd->TimeStop = 0;
178  bCube = Cudd_ReadOne(p->dd); Cudd_Ref( bCube );
179  Llb_PartForEachVar( p, pPart1, pVar, i )
180  {
181  assert( Vec_IntSize(pVar->vParts) > 0 );
182  if ( Vec_IntSize(pVar->vParts) != 2 )
183  continue;
184  if ( (Vec_IntEntry(pVar->vParts, 0) == pPart1->iPart && Vec_IntEntry(pVar->vParts, 1) == pPart2->iPart) ||
185  (Vec_IntEntry(pVar->vParts, 0) == pPart2->iPart && Vec_IntEntry(pVar->vParts, 1) == pPart1->iPart) )
186  {
187  bCube = Cudd_bddAnd( p->dd, bTemp = bCube, Cudd_bddIthVar(p->dd, pVar->iVar) ); Cudd_Ref( bCube );
188  Cudd_RecursiveDeref( p->dd, bTemp );
189  }
190  }
191  Cudd_Deref( bCube );
192  p->dd->TimeStop = TimeStop;
193  return bCube;
194 }
DdManager * dd
Definition: llb3Image.c:52
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
typedefABC_NAMESPACE_IMPL_START struct Llb_Var_t_ Llb_Var_t
DECLARATIONS ///.
Definition: llb3Image.c:29
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
int iPart
Definition: llb3Image.c:40
DdNode * Cudd_ReadOne(DdManager *dd)
Definition: cuddAPI.c:987
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
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 Llb_PartForEachVar(p, pPart, pVar, i)
Definition: llb4Image.c:73
Vec_Ptr_t* Llb_Nonlin4CutNodes ( Aig_Man_t p,
Vec_Ptr_t vLower,
Vec_Ptr_t vUpper 
)

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

Synopsis [Computes volume of the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 483 of file llb4Image.c.

484 {
485  Vec_Ptr_t * vNodes;
486  Aig_Obj_t * pObj;
487  int i;
488  // mark the lower cut with the traversal ID
490  Vec_PtrForEachEntry( Aig_Obj_t *, vLower, pObj, i )
491  Aig_ObjSetTravIdCurrent( p, pObj );
492  // count the upper cut
493  vNodes = Vec_PtrAlloc( 100 );
494  Vec_PtrForEachEntry( Aig_Obj_t *, vUpper, pObj, i )
495  Llb_Nonlin4CutNodes_rec( p, pObj, vNodes );
496  return vNodes;
497 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Llb_Nonlin4CutNodes_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: llb4Image.c:454
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigUtil.c:44
Definition: aig.h:69
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
void Llb_Nonlin4CutNodes_rec ( Aig_Man_t p,
Aig_Obj_t pObj,
Vec_Ptr_t vNodes 
)

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

Synopsis [Computes volume of the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 454 of file llb4Image.c.

455 {
456  if ( Aig_ObjIsTravIdCurrent(p, pObj) )
457  return;
458  Aig_ObjSetTravIdCurrent(p, pObj);
459  if ( Saig_ObjIsLi(p, pObj) )
460  {
461  Llb_Nonlin4CutNodes_rec(p, Aig_ObjFanin0(pObj), vNodes);
462  return;
463  }
464  if ( Aig_ObjIsConst1(pObj) )
465  return;
466  assert( Aig_ObjIsNode(pObj) );
467  Llb_Nonlin4CutNodes_rec(p, Aig_ObjFanin0(pObj), vNodes);
468  Llb_Nonlin4CutNodes_rec(p, Aig_ObjFanin1(pObj), vNodes);
469  Vec_PtrPush( vNodes, pObj );
470 }
void Llb_Nonlin4CutNodes_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Ptr_t *vNodes)
Definition: llb4Image.c:454
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 Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Aig_Obj_t * Aig_ObjFanin1(Aig_Obj_t *pObj)
Definition: aig.h:309
static void Aig_ObjSetTravIdCurrent(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:293
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 int Aig_ObjIsConst1(Aig_Obj_t *pObj)
Definition: aig.h:274
#define assert(ex)
Definition: util_old.h:213
void Llb_Nonlin4Free ( Llb_Mgr_t p)

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

Synopsis [Stops non-linear quantification scheduling.]

Description []

SideEffects []

SeeAlso []

Definition at line 726 of file llb4Image.c.

727 {
728  Llb_Prt_t * pPart;
729  Llb_Var_t * pVar;
730  int i;
731  Llb_MgrForEachVar( p, pVar, i )
732  Llb_Nonlin4RemoveVar( p, pVar );
733  Llb_MgrForEachPart( p, pPart, i )
734  Llb_Nonlin4RemovePart( p, pPart );
735  ABC_FREE( p->pVars );
736  ABC_FREE( p->pParts );
737  ABC_FREE( p->pSupp );
738  ABC_FREE( p );
739 }
void Llb_Nonlin4RemovePart(Llb_Mgr_t *p, Llb_Prt_t *pPart)
Definition: llb4Image.c:117
void Llb_Nonlin4RemoveVar(Llb_Mgr_t *p, Llb_Var_t *pVar)
FUNCTION DEFINITIONS ///.
Definition: llb4Image.c:98
typedefABC_NAMESPACE_IMPL_START struct Llb_Var_t_ Llb_Var_t
DECLARATIONS ///.
Definition: llb3Image.c:29
#define Llb_MgrForEachVar(p, pVar, i)
Definition: llb4Image.c:66
#define Llb_MgrForEachPart(p, pPart, i)
Definition: llb4Image.c:69
#define ABC_FREE(obj)
Definition: abc_global.h:232
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
int Llb_Nonlin4HasSingletonVars ( Llb_Mgr_t p,
Llb_Prt_t pPart 
)

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

Synopsis [Returns 1 if partition has singleton variables.]

Description []

SideEffects []

SeeAlso []

Definition at line 207 of file llb4Image.c.

208 {
209  Llb_Var_t * pVar;
210  int i;
211  Llb_PartForEachVar( p, pPart, pVar, i )
212  if ( Vec_IntSize(pVar->vParts) == 1 )
213  return 1;
214  return 0;
215 }
typedefABC_NAMESPACE_IMPL_START struct Llb_Var_t_ Llb_Var_t
DECLARATIONS ///.
Definition: llb3Image.c:29
if(last==0)
Definition: sparse_int.h:34
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define Llb_PartForEachVar(p, pPart, pVar, i)
Definition: llb4Image.c:73
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
int Llb_Nonlin4NextPartitions ( Llb_Mgr_t p,
Llb_Prt_t **  ppPart1,
Llb_Prt_t **  ppPart2 
)

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

Synopsis [Find next partition to quantify]

Description []

SideEffects []

SeeAlso []

Definition at line 585 of file llb4Image.c.

586 {
587  Llb_Var_t * pVar, * pVarBest = NULL;
588  Llb_Prt_t * pPart, * pPart1Best = NULL, * pPart2Best = NULL;
589  int i;
591  // find variable with minimum score
592  Llb_MgrForEachVar( p, pVar, i )
593  {
594  if ( p->nSizeMax && pVar->nScore > p->nSizeMax )
595  continue;
596 // if ( pVarBest == NULL || Vec_IntSize(pVarBest->vParts) * pVarBest->nScore > Vec_IntSize(pVar->vParts) * pVar->nScore )
597  if ( pVarBest == NULL || pVarBest->nScore > pVar->nScore )
598  pVarBest = pVar;
599 // printf( "%d ", pVar->nScore );
600  }
601 //printf( "\n" );
602  if ( pVarBest == NULL )
603  return 0;
604  // find two partitions with minimum size
605  Llb_VarForEachPart( p, pVarBest, pPart, i )
606  {
607  if ( pPart1Best == NULL )
608  pPart1Best = pPart;
609  else if ( pPart2Best == NULL )
610  pPart2Best = pPart;
611  else if ( pPart1Best->nSize > pPart->nSize || pPart2Best->nSize > pPart->nSize )
612  {
613  if ( pPart1Best->nSize > pPart2Best->nSize )
614  pPart1Best = pPart;
615  else
616  pPart2Best = pPart;
617  }
618  }
619 //printf( "Selecting %d and parts %d and %d\n", pVarBest->iVar, pPart1Best->nSize, pPart2Best->nSize );
620 //Extra_bddPrintSupport( p->dd, pPart1Best->bFunc ); printf( "\n" );
621 //Extra_bddPrintSupport( p->dd, pPart2Best->bFunc ); printf( "\n" );
622 
623  *ppPart1 = pPart1Best;
624  *ppPart2 = pPart2Best;
625  return 1;
626 }
int nSizeMax
Definition: llb4Image.c:51
int nSize
Definition: llb3Image.c:41
typedefABC_NAMESPACE_IMPL_START struct Llb_Var_t_ Llb_Var_t
DECLARATIONS ///.
Definition: llb3Image.c:29
#define Llb_MgrForEachVar(p, pVar, i)
Definition: llb4Image.c:66
#define Llb_VarForEachPart(p, pVar, pPart, i)
Definition: llb4Image.c:76
void Llb_Nonlin4CheckVars(Llb_Mgr_t *p)
Definition: llb4Image.c:566
void Llb_Nonlin4Print ( Llb_Mgr_t p)

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

Synopsis [Returns 1 if partition has singleton variables.]

Description []

SideEffects []

SeeAlso []

Definition at line 228 of file llb4Image.c.

229 {
230  Llb_Prt_t * pPart;
231  Llb_Var_t * pVar;
232  int i, k;
233  printf( "\n" );
234  Llb_MgrForEachVar( p, pVar, i )
235  {
236  printf( "Var %3d : ", i );
237  Llb_VarForEachPart( p, pVar, pPart, k )
238  printf( "%d ", pPart->iPart );
239  printf( "\n" );
240  }
241  Llb_MgrForEachPart( p, pPart, i )
242  {
243  printf( "Part %3d : ", i );
244  Llb_PartForEachVar( p, pPart, pVar, k )
245  printf( "%d ", pVar->iVar );
246  printf( "\n" );
247  }
248 }
typedefABC_NAMESPACE_IMPL_START struct Llb_Var_t_ Llb_Var_t
DECLARATIONS ///.
Definition: llb3Image.c:29
#define Llb_MgrForEachVar(p, pVar, i)
Definition: llb4Image.c:66
#define Llb_MgrForEachPart(p, pPart, i)
Definition: llb4Image.c:69
#define Llb_VarForEachPart(p, pVar, pPart, i)
Definition: llb4Image.c:76
#define Llb_PartForEachVar(p, pPart, pVar, i)
Definition: llb4Image.c:73
int Llb_Nonlin4Quantify1 ( Llb_Mgr_t p,
Llb_Prt_t pPart 
)

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

Synopsis [Quantifies singles belonging to one partition.]

Description []

SideEffects []

SeeAlso []

Definition at line 261 of file llb4Image.c.

262 {
263  Llb_Var_t * pVar;
264  Llb_Prt_t * pTemp;
265  Vec_Ptr_t * vSingles;
266  DdNode * bCube, * bTemp;
267  int i, RetValue, nSizeNew;
268  // create cube to be quantified
269  bCube = Llb_Nonlin4CreateCube1( p, pPart ); Cudd_Ref( bCube );
270 // assert( !Cudd_IsConstant(bCube) );
271  // derive new function
272  pPart->bFunc = Cudd_bddExistAbstract( p->dd, bTemp = pPart->bFunc, bCube ); Cudd_Ref( pPart->bFunc );
273  Cudd_RecursiveDeref( p->dd, bTemp );
274  Cudd_RecursiveDeref( p->dd, bCube );
275  // get support
276  vSingles = Vec_PtrAlloc( 0 );
277  nSizeNew = Cudd_DagSize(pPart->bFunc);
278  Extra_SupportArray( p->dd, pPart->bFunc, p->pSupp );
279  Llb_PartForEachVar( p, pPart, pVar, i )
280  if ( p->pSupp[pVar->iVar] )
281  {
282  assert( Vec_IntSize(pVar->vParts) > 1 );
283  pVar->nScore -= pPart->nSize - nSizeNew;
284  }
285  else
286  {
287  RetValue = Vec_IntRemove( pVar->vParts, pPart->iPart );
288  assert( RetValue );
289  pVar->nScore -= pPart->nSize;
290  if ( Vec_IntSize(pVar->vParts) == 0 )
291  Llb_Nonlin4RemoveVar( p, pVar );
292  else if ( Vec_IntSize(pVar->vParts) == 1 )
293  Vec_PtrPushUnique( vSingles, Llb_MgrPart(p, Vec_IntEntry(pVar->vParts,0)) );
294  }
295 
296  // update partition
297  pPart->nSize = nSizeNew;
298  Vec_IntClear( pPart->vVars );
299  for ( i = 0; i < p->nVars; i++ )
300  if ( p->pSupp[i] && Vec_IntEntry(p->vVars2Q, i) )
301  Vec_IntPush( pPart->vVars, i );
302  // remove other variables
303  Vec_PtrForEachEntry( Llb_Prt_t *, vSingles, pTemp, i )
304  Llb_Nonlin4Quantify1( p, pTemp );
305  Vec_PtrFree( vSingles );
306  return 0;
307 }
DdNode * Llb_Nonlin4CreateCube1(Llb_Mgr_t *p, Llb_Prt_t *pPart)
Definition: llb4Image.c:138
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
DdManager * dd
Definition: llb3Image.c:52
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
static int Vec_PtrPushUnique(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:656
int * pSupp
Definition: llb3Image.c:61
DdNode * Cudd_bddExistAbstract(DdManager *manager, DdNode *f, DdNode *cube)
Definition: cuddBddAbs.c:130
static Llb_Prt_t * Llb_MgrPart(Llb_Mgr_t *p, int i)
Definition: llb4Image.c:63
void Llb_Nonlin4RemoveVar(Llb_Mgr_t *p, Llb_Var_t *pVar)
FUNCTION DEFINITIONS ///.
Definition: llb4Image.c:98
int nSize
Definition: llb3Image.c:41
typedefABC_NAMESPACE_IMPL_START struct Llb_Var_t_ Llb_Var_t
DECLARATIONS ///.
Definition: llb3Image.c:29
int * Extra_SupportArray(DdManager *dd, DdNode *F, int *support)
Definition: extraBddMisc.c:537
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
Vec_Int_t * vVars2Q
Definition: llb4Image.c:50
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Vec_IntRemove(Vec_Int_t *p, int Entry)
Definition: vecInt.h:915
int iPart
Definition: llb3Image.c:40
DdNode * bFunc
Definition: llb3Image.c:42
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
int Llb_Nonlin4Quantify1(Llb_Mgr_t *p, Llb_Prt_t *pPart)
Definition: llb4Image.c:261
#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_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
#define Llb_PartForEachVar(p, pPart, pVar, i)
Definition: llb4Image.c:73
Vec_Int_t * vVars
Definition: llb3Image.c:43
int Cudd_DagSize(DdNode *node)
Definition: cuddUtil.c:442
int nVars
Definition: llb3Image.c:58
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
int Llb_Nonlin4Quantify2 ( Llb_Mgr_t p,
Llb_Prt_t pPart1,
Llb_Prt_t pPart2 
)

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

Synopsis [Quantifies singles belonging to one partition.]

Description []

SideEffects []

SeeAlso []

Definition at line 320 of file llb4Image.c.

321 {
322  int fVerbose = 0;
323  Llb_Var_t * pVar;
324  Llb_Prt_t * pTemp;
325  Vec_Ptr_t * vSingles;
326  DdNode * bCube, * bFunc;
327  int i, RetValue, nSuppSize;
328 // int iPart1 = pPart1->iPart;
329 // int iPart2 = pPart2->iPart;
330  int liveBeg, liveEnd;
331 
332  // create cube to be quantified
333  bCube = Llb_Nonlin4CreateCube2( p, pPart1, pPart2 ); Cudd_Ref( bCube );
334 
335 //printf( "Quantifying " ); Extra_bddPrintSupport( p->dd, bCube ); printf( "\n" );
336 
337 if ( fVerbose )
338 {
339 printf( "\n" );
340 printf( "\n" );
341 Llb_Nonlin4Print( p );
342 printf( "Conjoining partitions %d and %d.\n", pPart1->iPart, pPart2->iPart );
343 Extra_bddPrintSupport( p->dd, bCube ); printf( "\n" );
344 }
345 liveBeg = p->dd->keys - p->dd->dead;
346  bFunc = Cudd_bddAndAbstract( p->dd, pPart1->bFunc, pPart2->bFunc, bCube );
347 liveEnd = p->dd->keys - p->dd->dead;
348 //printf( "%d ", liveEnd-liveBeg );
349 
350  if ( bFunc == NULL )
351  {
352  Cudd_RecursiveDeref( p->dd, bCube );
353  return 0;
354  }
355  Cudd_Ref( bFunc );
356  Cudd_RecursiveDeref( p->dd, bCube );
357 
358 //printf( "Creating part %d ", p->iPartFree ); Extra_bddPrintSupport( p->dd, bFunc ); printf( "\n" );
359 
360 //printf( "Creating %d\n", p->iPartFree );
361 
362  // create new partition
363  pTemp = p->pParts[p->iPartFree] = ABC_CALLOC( Llb_Prt_t, 1 );
364  pTemp->iPart = p->iPartFree++;
365  pTemp->nSize = Cudd_DagSize(bFunc);
366  pTemp->bFunc = bFunc;
367  pTemp->vVars = Vec_IntAlloc( 8 );
368  // update variables
369  Llb_PartForEachVar( p, pPart1, pVar, i )
370  {
371  RetValue = Vec_IntRemove( pVar->vParts, pPart1->iPart );
372  assert( RetValue );
373  pVar->nScore -= pPart1->nSize;
374  }
375  // update variables
376  Llb_PartForEachVar( p, pPart2, pVar, i )
377  {
378  RetValue = Vec_IntRemove( pVar->vParts, pPart2->iPart );
379  assert( RetValue );
380  pVar->nScore -= pPart2->nSize;
381  }
382  // add variables to the new partition
383  nSuppSize = 0;
384  Extra_SupportArray( p->dd, bFunc, p->pSupp );
385  for ( i = 0; i < p->nVars; i++ )
386  {
387  nSuppSize += p->pSupp[i];
388  if ( p->pSupp[i] && Vec_IntEntry(p->vVars2Q, i) )
389  {
390  pVar = Llb_MgrVar( p, i );
391  pVar->nScore += pTemp->nSize;
392  Vec_IntPush( pVar->vParts, pTemp->iPart );
393  Vec_IntPush( pTemp->vVars, i );
394  }
395  }
396  p->nSuppMax = Abc_MaxInt( p->nSuppMax, nSuppSize );
397  // remove variables and collect partitions with singleton variables
398  vSingles = Vec_PtrAlloc( 0 );
399  Llb_PartForEachVar( p, pPart1, pVar, i )
400  {
401  if ( Vec_IntSize(pVar->vParts) == 0 )
402  Llb_Nonlin4RemoveVar( p, pVar );
403  else if ( Vec_IntSize(pVar->vParts) == 1 )
404  {
405  if ( fVerbose )
406  printf( "Adding partition %d because of var %d.\n",
407  Llb_MgrPart(p, Vec_IntEntry(pVar->vParts,0))->iPart, pVar->iVar );
408  Vec_PtrPushUnique( vSingles, Llb_MgrPart(p, Vec_IntEntry(pVar->vParts,0)) );
409  }
410  }
411  Llb_PartForEachVar( p, pPart2, pVar, i )
412  {
413  if ( pVar == NULL )
414  continue;
415  if ( Vec_IntSize(pVar->vParts) == 0 )
416  Llb_Nonlin4RemoveVar( p, pVar );
417  else if ( Vec_IntSize(pVar->vParts) == 1 )
418  {
419  if ( fVerbose )
420  printf( "Adding partition %d because of var %d.\n",
421  Llb_MgrPart(p, Vec_IntEntry(pVar->vParts,0))->iPart, pVar->iVar );
422  Vec_PtrPushUnique( vSingles, Llb_MgrPart(p, Vec_IntEntry(pVar->vParts,0)) );
423  }
424  }
425  // remove partitions
426  Llb_Nonlin4RemovePart( p, pPart1 );
427  Llb_Nonlin4RemovePart( p, pPart2 );
428  // remove other variables
429 if ( fVerbose )
430 Llb_Nonlin4Print( p );
431  Vec_PtrForEachEntry( Llb_Prt_t *, vSingles, pTemp, i )
432  {
433 if ( fVerbose )
434 printf( "Updating partitiong %d with singlton vars.\n", pTemp->iPart );
435  Llb_Nonlin4Quantify1( p, pTemp );
436  }
437 if ( fVerbose )
438 Llb_Nonlin4Print( p );
439  Vec_PtrFree( vSingles );
440  return 1;
441 }
void Llb_Nonlin4RemovePart(Llb_Mgr_t *p, Llb_Prt_t *pPart)
Definition: llb4Image.c:117
Llb_Prt_t ** pParts
Definition: llb3Image.c:55
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
DdManager * dd
Definition: llb3Image.c:52
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
Definition: cudd.h:278
static int Vec_PtrPushUnique(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:656
static Llb_Var_t * Llb_MgrVar(Llb_Mgr_t *p, int i)
Definition: llb4Image.c:62
int * pSupp
Definition: llb3Image.c:61
void Extra_bddPrintSupport(DdManager *dd, DdNode *F)
Definition: extraBddMisc.c:302
int nSuppMax
Definition: llb3Image.c:59
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static Llb_Prt_t * Llb_MgrPart(Llb_Mgr_t *p, int i)
Definition: llb4Image.c:63
void Llb_Nonlin4RemoveVar(Llb_Mgr_t *p, Llb_Var_t *pVar)
FUNCTION DEFINITIONS ///.
Definition: llb4Image.c:98
unsigned int dead
Definition: cuddInt.h:371
int nSize
Definition: llb3Image.c:41
typedefABC_NAMESPACE_IMPL_START struct Llb_Var_t_ Llb_Var_t
DECLARATIONS ///.
Definition: llb3Image.c:29
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
unsigned int keys
Definition: cuddInt.h:369
int * Extra_SupportArray(DdManager *dd, DdNode *F, int *support)
Definition: extraBddMisc.c:537
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t * vVars2Q
Definition: llb4Image.c:50
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
DdNode * Cudd_bddAndAbstract(DdManager *manager, DdNode *f, DdNode *g, DdNode *cube)
Definition: cuddAndAbs.c:124
int iPartFree
Definition: llb3Image.c:57
static int Vec_IntRemove(Vec_Int_t *p, int Entry)
Definition: vecInt.h:915
int iPart
Definition: llb3Image.c:40
DdNode * bFunc
Definition: llb3Image.c:42
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
int Llb_Nonlin4Quantify1(Llb_Mgr_t *p, Llb_Prt_t *pPart)
Definition: llb4Image.c:261
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
void Llb_Nonlin4Print(Llb_Mgr_t *p)
Definition: llb4Image.c:228
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define Llb_PartForEachVar(p, pPart, pVar, i)
Definition: llb4Image.c:73
DdNode * Llb_Nonlin4CreateCube2(Llb_Mgr_t *p, Llb_Prt_t *pPart1, Llb_Prt_t *pPart2)
Definition: llb4Image.c:171
Vec_Int_t * vVars
Definition: llb3Image.c:43
int Cudd_DagSize(DdNode *node)
Definition: cuddUtil.c:442
int nVars
Definition: llb3Image.c:58
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Llb_Nonlin4RecomputeScores ( Llb_Mgr_t p)

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

Synopsis [Recomputes scores after variable reordering.]

Description []

SideEffects []

SeeAlso []

Definition at line 639 of file llb4Image.c.

640 {
641  Llb_Prt_t * pPart;
642  Llb_Var_t * pVar;
643  int i, k;
644  Llb_MgrForEachPart( p, pPart, i )
645  pPart->nSize = Cudd_DagSize(pPart->bFunc);
646  Llb_MgrForEachVar( p, pVar, i )
647  {
648  pVar->nScore = 0;
649  Llb_VarForEachPart( p, pVar, pPart, k )
650  pVar->nScore += pPart->nSize;
651  }
652 }
typedefABC_NAMESPACE_IMPL_START struct Llb_Var_t_ Llb_Var_t
DECLARATIONS ///.
Definition: llb3Image.c:29
#define Llb_MgrForEachVar(p, pVar, i)
Definition: llb4Image.c:66
#define Llb_MgrForEachPart(p, pPart, i)
Definition: llb4Image.c:69
#define Llb_VarForEachPart(p, pVar, pPart, i)
Definition: llb4Image.c:76
int Cudd_DagSize(DdNode *node)
Definition: cuddUtil.c:442
void Llb_Nonlin4RemovePart ( Llb_Mgr_t p,
Llb_Prt_t pPart 
)

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

Synopsis [Removes one partition.]

Description []

SideEffects []

SeeAlso []

Definition at line 117 of file llb4Image.c.

118 {
119 //printf( "Removing %d\n", pPart->iPart );
120  assert( p->pParts[pPart->iPart] == pPart );
121  p->pParts[pPart->iPart] = NULL;
122  Vec_IntFree( pPart->vVars );
123  Cudd_RecursiveDeref( p->dd, pPart->bFunc );
124  ABC_FREE( pPart );
125 }
Llb_Prt_t ** pParts
Definition: llb3Image.c:55
DdManager * dd
Definition: llb3Image.c:52
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
Definition: cuddRef.c:154
int iPart
Definition: llb3Image.c:40
DdNode * bFunc
Definition: llb3Image.c:42
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Vec_Int_t * vVars
Definition: llb3Image.c:43
void Llb_Nonlin4RemoveVar ( Llb_Mgr_t p,
Llb_Var_t pVar 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Removes one variable.]

Description []

SideEffects []

SeeAlso []

Definition at line 98 of file llb4Image.c.

99 {
100  assert( p->pVars[pVar->iVar] == pVar );
101  p->pVars[pVar->iVar] = NULL;
102  Vec_IntFree( pVar->vParts );
103  ABC_FREE( pVar );
104 }
Llb_Var_t ** pVars
Definition: llb3Image.c:56
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
void Llb_Nonlin4VerifyScores ( Llb_Mgr_t p)

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

Synopsis [Recomputes scores after variable reordering.]

Description []

SideEffects []

SeeAlso []

Definition at line 665 of file llb4Image.c.

666 {
667  Llb_Prt_t * pPart;
668  Llb_Var_t * pVar;
669  int i, k, nScore;
670  Llb_MgrForEachPart( p, pPart, i )
671  assert( pPart->nSize == Cudd_DagSize(pPart->bFunc) );
672  Llb_MgrForEachVar( p, pVar, i )
673  {
674  nScore = 0;
675  Llb_VarForEachPart( p, pVar, pPart, k )
676  nScore += pPart->nSize;
677  assert( nScore == pVar->nScore );
678  }
679 }
typedefABC_NAMESPACE_IMPL_START struct Llb_Var_t_ Llb_Var_t
DECLARATIONS ///.
Definition: llb3Image.c:29
#define Llb_MgrForEachVar(p, pVar, i)
Definition: llb4Image.c:66
#define Llb_MgrForEachPart(p, pPart, i)
Definition: llb4Image.c:69
#define Llb_VarForEachPart(p, pVar, pPart, i)
Definition: llb4Image.c:76
#define assert(ex)
Definition: util_old.h:213
int Cudd_DagSize(DdNode *node)
Definition: cuddUtil.c:442