abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
fxuInt.h File Reference
#include "base/abc/abc.h"

Go to the source code of this file.

Data Structures

struct  FxuListCube
 
struct  FxuListVar
 
struct  FxuListLit
 
struct  FxuListPair
 
struct  FxuListDouble
 
struct  FxuListSingle
 
struct  FxuHeapDouble
 
struct  FxuHeapSingle
 
struct  FxuMatrix
 
struct  FxuCube
 
struct  FxuVar
 
struct  FxuLit
 
struct  FxuPair
 
struct  FxuDouble
 
struct  FxuSingle
 

Macros

#define Fxu_Min(a, b)   ( ((a)<(b))? (a):(b) )
 MACRO DEFINITIONS ///. More...
 
#define Fxu_Max(a, b)   ( ((a)>(b))? (a):(b) )
 
#define Fxu_PairMinCube(pPair)   (((pPair)->iCube1 < (pPair)->iCube2)? (pPair)->pCube1: (pPair)->pCube2)
 
#define Fxu_PairMaxCube(pPair)   (((pPair)->iCube1 > (pPair)->iCube2)? (pPair)->pCube1: (pPair)->pCube2)
 
#define Fxu_PairMinCubeInt(pPair)   (((pPair)->iCube1 < (pPair)->iCube2)? (pPair)->iCube1: (pPair)->iCube2)
 
#define Fxu_PairMaxCubeInt(pPair)   (((pPair)->iCube1 > (pPair)->iCube2)? (pPair)->iCube1: (pPair)->iCube2)
 
#define Fxu_MatrixForEachCube(Matrix, Cube)
 
#define Fxu_MatrixForEachCubeSafe(Matrix, Cube, Cube2)
 
#define Fxu_MatrixForEachVariable(Matrix, Var)
 
#define Fxu_MatrixForEachVariableSafe(Matrix, Var, Var2)
 
#define Fxu_MatrixForEachSingle(Matrix, Single)
 
#define Fxu_MatrixForEachSingleSafe(Matrix, Single, Single2)
 
#define Fxu_TableForEachDouble(Matrix, Key, Div)
 
#define Fxu_TableForEachDoubleSafe(Matrix, Key, Div, Div2)
 
#define Fxu_MatrixForEachDouble(Matrix, Div, Index)
 
#define Fxu_MatrixForEachDoubleSafe(Matrix, Div, Div2, Index)
 
#define Fxu_CubeForEachLiteral(Cube, Lit)
 
#define Fxu_CubeForEachLiteralSafe(Cube, Lit, Lit2)
 
#define Fxu_VarForEachLiteral(Var, Lit)
 
#define Fxu_CubeForEachDivisor(Cube, Div)
 
#define Fxu_DoubleForEachPair(Div, Pair)
 
#define Fxu_DoubleForEachPairSafe(Div, Pair, Pair2)
 
#define Fxu_CubeForEachPair(pCube, pPair, i)
 
#define Fxu_HeapDoubleForEachItem(Heap, Div)
 
#define Fxu_HeapSingleForEachItem(Heap, Single)
 
#define Fxu_MatrixRingCubesStart(Matrix)   (((Matrix)->ppTailCubes = &((Matrix)->pOrderCubes)), ((Matrix)->pOrderCubes = NULL))
 
#define Fxu_MatrixRingVarsStart(Matrix)   (((Matrix)->ppTailVars = &((Matrix)->pOrderVars)), ((Matrix)->pOrderVars = NULL))
 
#define Fxu_MatrixRingCubesStop(Matrix)
 
#define Fxu_MatrixRingVarsStop(Matrix)
 
#define Fxu_MatrixRingCubesReset(Matrix)   (((Matrix)->pOrderCubes = NULL), ((Matrix)->ppTailCubes = NULL))
 
#define Fxu_MatrixRingVarsReset(Matrix)   (((Matrix)->pOrderVars = NULL), ((Matrix)->ppTailVars = NULL))
 
#define Fxu_MatrixRingCubesAdd(Matrix, Cube)   ((*((Matrix)->ppTailCubes) = Cube), ((Matrix)->ppTailCubes = &(Cube)->pOrder), ((Cube)->pOrder = (Fxu_Cube *)1))
 
#define Fxu_MatrixRingVarsAdd(Matrix, Var)   ((*((Matrix)->ppTailVars ) = Var ), ((Matrix)->ppTailVars = &(Var)->pOrder ), ((Var)->pOrder = (Fxu_Var *)1))
 
#define Fxu_MatrixForEachCubeInRing(Matrix, Cube)
 
#define Fxu_MatrixForEachCubeInRingSafe(Matrix, Cube, Cube2)
 
#define Fxu_MatrixForEachVarInRing(Matrix, Var)
 
#define Fxu_MatrixForEachVarInRingSafe(Matrix, Var, Var2)
 
#define MEM_ALLOC_FXU(Manager, Type, Size)   ((Type *)Fxu_MemFetch( Manager, (Size) * sizeof(Type) ))
 
#define MEM_FREE_FXU(Manager, Type, Size, Pointer)   if ( Pointer ) { Fxu_MemRecycle( Manager, (char *)(Pointer), (Size) * sizeof(Type) ); Pointer = NULL; }
 

Typedefs

typedef
typedefABC_NAMESPACE_HEADER_START
struct FxuMatrix 
Fxu_Matrix
 INCLUDES ///. More...
 
typedef struct FxuCube Fxu_Cube
 
typedef struct FxuVar Fxu_Var
 
typedef struct FxuLit Fxu_Lit
 
typedef struct FxuPair Fxu_Pair
 
typedef struct FxuDouble Fxu_Double
 
typedef struct FxuSingle Fxu_Single
 
typedef struct FxuListCube Fxu_ListCube
 
typedef struct FxuListVar Fxu_ListVar
 
typedef struct FxuListLit Fxu_ListLit
 
typedef struct FxuListPair Fxu_ListPair
 
typedef struct FxuListDouble Fxu_ListDouble
 
typedef struct FxuListSingle Fxu_ListSingle
 
typedef struct FxuHeapDouble Fxu_HeapDouble
 
typedef struct FxuHeapSingle Fxu_HeapSingle
 

Functions

void Fxu_MatrixRingCubesUnmark (Fxu_Matrix *p)
 
void Fxu_MatrixRingVarsUnmark (Fxu_Matrix *p)
 
char * Fxu_MemFetch (Fxu_Matrix *p, int nBytes)
 FUNCTION DEFINITIONS ///. More...
 
void Fxu_MemRecycle (Fxu_Matrix *p, char *pItem, int nBytes)
 
void Fxu_MatrixPrint (FILE *pFile, Fxu_Matrix *p)
 DECLARATIONS ///. More...
 
void Fxu_MatrixPrintDivisorProfile (FILE *pFile, Fxu_Matrix *p)
 
int Fxu_Select (Fxu_Matrix *p, Fxu_Single **ppSingle, Fxu_Double **ppDouble)
 FUNCTION DEFINITIONS ///. More...
 
int Fxu_SelectSCD (Fxu_Matrix *p, int Weight, Fxu_Var **ppVar1, Fxu_Var **ppVar2)
 
void Fxu_Update (Fxu_Matrix *p, Fxu_Single *pSingle, Fxu_Double *pDouble)
 FUNCTION DEFINITIONS ///. More...
 
void Fxu_UpdateDouble (Fxu_Matrix *p)
 
void Fxu_UpdateSingle (Fxu_Matrix *p)
 
void Fxu_PairCanonicize (Fxu_Cube **ppCube1, Fxu_Cube **ppCube2)
 FUNCTION DEFINITIONS ///. More...
 
unsigned Fxu_PairHashKeyArray (Fxu_Matrix *p, int piVarsC1[], int piVarsC2[], int nVarsC1, int nVarsC2)
 
unsigned Fxu_PairHashKey (Fxu_Matrix *p, Fxu_Cube *pCube1, Fxu_Cube *pCube2, int *pnBase, int *pnLits1, int *pnLits2)
 
unsigned Fxu_PairHashKeyMv (Fxu_Matrix *p, Fxu_Cube *pCube1, Fxu_Cube *pCube2, int *pnBase, int *pnLits1, int *pnLits2)
 
int Fxu_PairCompare (Fxu_Pair *pPair1, Fxu_Pair *pPair2)
 
void Fxu_PairAllocStorage (Fxu_Var *pVar, int nCubes)
 
void Fxu_PairFreeStorage (Fxu_Var *pVar)
 
void Fxu_PairClearStorage (Fxu_Cube *pCube)
 
Fxu_PairFxu_PairAlloc (Fxu_Matrix *p, Fxu_Cube *pCube1, Fxu_Cube *pCube2)
 
void Fxu_PairAdd (Fxu_Pair *pPair)
 
void Fxu_MatrixComputeSingles (Fxu_Matrix *p, int fUse0, int nSingleMax)
 FUNCTION DEFINITIONS ///. More...
 
void Fxu_MatrixComputeSinglesOne (Fxu_Matrix *p, Fxu_Var *pVar)
 
int Fxu_SingleCountCoincidence (Fxu_Matrix *p, Fxu_Var *pVar1, Fxu_Var *pVar2)
 
Fxu_MatrixFxu_MatrixAllocate ()
 DECLARATIONS ///. More...
 
void Fxu_MatrixDelete (Fxu_Matrix *p)
 
void Fxu_MatrixAddDivisor (Fxu_Matrix *p, Fxu_Cube *pCube1, Fxu_Cube *pCube2)
 
void Fxu_MatrixDelDivisor (Fxu_Matrix *p, Fxu_Double *pDiv)
 
void Fxu_MatrixAddSingle (Fxu_Matrix *p, Fxu_Var *pVar1, Fxu_Var *pVar2, int Weight)
 
Fxu_VarFxu_MatrixAddVar (Fxu_Matrix *p)
 
Fxu_CubeFxu_MatrixAddCube (Fxu_Matrix *p, Fxu_Var *pVar, int iCube)
 
void Fxu_MatrixAddLiteral (Fxu_Matrix *p, Fxu_Cube *pCube, Fxu_Var *pVar)
 
void Fxu_MatrixDelLiteral (Fxu_Matrix *p, Fxu_Lit *pLit)
 
void Fxu_ListMatrixAddVariable (Fxu_Matrix *p, Fxu_Var *pVar)
 DECLARATIONS ///. More...
 
void Fxu_ListMatrixDelVariable (Fxu_Matrix *p, Fxu_Var *pVar)
 
void Fxu_ListMatrixAddCube (Fxu_Matrix *p, Fxu_Cube *pCube)
 
void Fxu_ListMatrixDelCube (Fxu_Matrix *p, Fxu_Cube *pCube)
 
void Fxu_ListMatrixAddSingle (Fxu_Matrix *p, Fxu_Single *pSingle)
 
void Fxu_ListMatrixDelSingle (Fxu_Matrix *p, Fxu_Single *pSingle)
 
void Fxu_ListTableAddDivisor (Fxu_Matrix *p, Fxu_Double *pDiv)
 
void Fxu_ListTableDelDivisor (Fxu_Matrix *p, Fxu_Double *pDiv)
 
void Fxu_ListCubeAddLiteral (Fxu_Cube *pCube, Fxu_Lit *pLit)
 
void Fxu_ListCubeDelLiteral (Fxu_Cube *pCube, Fxu_Lit *pLit)
 
void Fxu_ListVarAddLiteral (Fxu_Var *pVar, Fxu_Lit *pLit)
 
void Fxu_ListVarDelLiteral (Fxu_Var *pVar, Fxu_Lit *pLit)
 
void Fxu_ListDoubleAddPairLast (Fxu_Double *pDiv, Fxu_Pair *pLink)
 
void Fxu_ListDoubleAddPairFirst (Fxu_Double *pDiv, Fxu_Pair *pLink)
 
void Fxu_ListDoubleAddPairMiddle (Fxu_Double *pDiv, Fxu_Pair *pSpot, Fxu_Pair *pLink)
 
void Fxu_ListDoubleDelPair (Fxu_Double *pDiv, Fxu_Pair *pPair)
 
Fxu_HeapDoubleFxu_HeapDoubleStart ()
 FUNCTION DEFINITIONS ///. More...
 
void Fxu_HeapDoubleStop (Fxu_HeapDouble *p)
 
void Fxu_HeapDoublePrint (FILE *pFile, Fxu_HeapDouble *p)
 
void Fxu_HeapDoubleCheck (Fxu_HeapDouble *p)
 
void Fxu_HeapDoubleCheckOne (Fxu_HeapDouble *p, Fxu_Double *pDiv)
 
void Fxu_HeapDoubleInsert (Fxu_HeapDouble *p, Fxu_Double *pDiv)
 
void Fxu_HeapDoubleUpdate (Fxu_HeapDouble *p, Fxu_Double *pDiv)
 
void Fxu_HeapDoubleDelete (Fxu_HeapDouble *p, Fxu_Double *pDiv)
 
int Fxu_HeapDoubleReadMaxWeight (Fxu_HeapDouble *p)
 
Fxu_DoubleFxu_HeapDoubleReadMax (Fxu_HeapDouble *p)
 
Fxu_DoubleFxu_HeapDoubleGetMax (Fxu_HeapDouble *p)
 
Fxu_HeapSingleFxu_HeapSingleStart ()
 FUNCTION DEFINITIONS ///. More...
 
void Fxu_HeapSingleStop (Fxu_HeapSingle *p)
 
void Fxu_HeapSinglePrint (FILE *pFile, Fxu_HeapSingle *p)
 
void Fxu_HeapSingleCheck (Fxu_HeapSingle *p)
 
void Fxu_HeapSingleCheckOne (Fxu_HeapSingle *p, Fxu_Single *pSingle)
 
void Fxu_HeapSingleInsert (Fxu_HeapSingle *p, Fxu_Single *pSingle)
 
void Fxu_HeapSingleUpdate (Fxu_HeapSingle *p, Fxu_Single *pSingle)
 
void Fxu_HeapSingleDelete (Fxu_HeapSingle *p, Fxu_Single *pSingle)
 
int Fxu_HeapSingleReadMaxWeight (Fxu_HeapSingle *p)
 
Fxu_SingleFxu_HeapSingleReadMax (Fxu_HeapSingle *p)
 
Fxu_SingleFxu_HeapSingleGetMax (Fxu_HeapSingle *p)
 

Macro Definition Documentation

#define Fxu_CubeForEachDivisor (   Cube,
  Div 
)
Value:
for ( Div = (Cube)->lDivs.pHead;\
Div;\
Div = Div->pCNext )

Definition at line 352 of file fxuInt.h.

#define Fxu_CubeForEachLiteral (   Cube,
  Lit 
)
Value:
for ( Lit = (Cube)->lLits.pHead;\
Lit;\
Lit = Lit->pHNext )

Definition at line 338 of file fxuInt.h.

#define Fxu_CubeForEachLiteralSafe (   Cube,
  Lit,
  Lit2 
)
Value:
for ( Lit = (Cube)->lLits.pHead, Lit2 = (Lit? Lit->pHNext: NULL);\
Lit;\
Lit = Lit2, Lit2 = (Lit? Lit->pHNext: NULL) )

Definition at line 342 of file fxuInt.h.

#define Fxu_CubeForEachPair (   pCube,
  pPair,
 
)
Value:
for ( i = 0;\
i < pCube->pVar->nCubes && (((pPair) = (pCube)->pVar->ppPairs[(pCube)->iCube][i]), 1);\
i++ )\
if ( pPair == NULL ) {} else

Definition at line 368 of file fxuInt.h.

#define Fxu_DoubleForEachPair (   Div,
  Pair 
)
Value:
for ( Pair = (Div)->lPairs.pHead;\
Pair;\
Pair = Pair->pDNext )

Definition at line 357 of file fxuInt.h.

#define Fxu_DoubleForEachPairSafe (   Div,
  Pair,
  Pair2 
)
Value:
for ( Pair = (Div)->lPairs.pHead, Pair2 = (Pair? Pair->pDNext: NULL);\
Pair;\
Pair = Pair2, Pair2 = (Pair? Pair->pDNext: NULL) )

Definition at line 361 of file fxuInt.h.

#define Fxu_HeapDoubleForEachItem (   Heap,
  Div 
)
Value:
for ( Heap->i = 1;\
Heap->i <= Heap->nItems && (Div = Heap->pTree[Heap->i]);\
Heap->i++ )

Definition at line 375 of file fxuInt.h.

#define Fxu_HeapSingleForEachItem (   Heap,
  Single 
)
Value:
for ( Heap->i = 1;\
Heap->i <= Heap->nItems && (Single = Heap->pTree[Heap->i]);\
Heap->i++ )

Definition at line 379 of file fxuInt.h.

#define Fxu_MatrixForEachCube (   Matrix,
  Cube 
)
Value:
for ( Cube = (Matrix)->lCubes.pHead;\
Cube;\
Cube = Cube->pNext )

Definition at line 294 of file fxuInt.h.

#define Fxu_MatrixForEachCubeInRing (   Matrix,
  Cube 
)
Value:
if ( (Matrix)->pOrderCubes )\
for ( Cube = (Matrix)->pOrderCubes;\
Cube != (Fxu_Cube *)1;\
Cube = Cube->pOrder )
for(p=first;p->value< newval;p=p->next)

Definition at line 397 of file fxuInt.h.

#define Fxu_MatrixForEachCubeInRingSafe (   Matrix,
  Cube,
  Cube2 
)
Value:
if ( (Matrix)->pOrderCubes )\
for ( Cube = (Matrix)->pOrderCubes, Cube2 = ((Cube != (Fxu_Cube *)1)? Cube->pOrder: (Fxu_Cube *)1);\
Cube != (Fxu_Cube *)1;\
Cube = Cube2, Cube2 = ((Cube != (Fxu_Cube *)1)? Cube->pOrder: (Fxu_Cube *)1) )
for(p=first;p->value< newval;p=p->next)

Definition at line 402 of file fxuInt.h.

#define Fxu_MatrixForEachCubeSafe (   Matrix,
  Cube,
  Cube2 
)
Value:
for ( Cube = (Matrix)->lCubes.pHead, Cube2 = (Cube? Cube->pNext: NULL);\
Cube;\
Cube = Cube2, Cube2 = (Cube? Cube->pNext: NULL) )

Definition at line 298 of file fxuInt.h.

#define Fxu_MatrixForEachDouble (   Matrix,
  Div,
  Index 
)
Value:
for ( Index = 0; Index < (Matrix)->nTableSize; Index++ )\
Fxu_TableForEachDouble( Matrix, Index, Div )
#define Fxu_TableForEachDouble(Matrix, Key, Div)
Definition: fxuInt.h:321

Definition at line 330 of file fxuInt.h.

#define Fxu_MatrixForEachDoubleSafe (   Matrix,
  Div,
  Div2,
  Index 
)
Value:
for ( Index = 0; Index < (Matrix)->nTableSize; Index++ )\
Fxu_TableForEachDoubleSafe( Matrix, Index, Div, Div2 )
#define Fxu_TableForEachDoubleSafe(Matrix, Key, Div, Div2)
Definition: fxuInt.h:325

Definition at line 333 of file fxuInt.h.

#define Fxu_MatrixForEachSingle (   Matrix,
  Single 
)
Value:
for ( Single = (Matrix)->lSingles.pHead;\
Single;\
Single = Single->pNext )

Definition at line 312 of file fxuInt.h.

#define Fxu_MatrixForEachSingleSafe (   Matrix,
  Single,
  Single2 
)
Value:
for ( Single = (Matrix)->lSingles.pHead, Single2 = (Single? Single->pNext: NULL);\
Single;\
Single = Single2, Single2 = (Single? Single->pNext: NULL) )

Definition at line 316 of file fxuInt.h.

#define Fxu_MatrixForEachVariable (   Matrix,
  Var 
)
Value:
for ( Var = (Matrix)->lVars.pHead;\
Var;\
Var = Var->pNext )
int Var
Definition: SolverTypes.h:42

Definition at line 303 of file fxuInt.h.

#define Fxu_MatrixForEachVariableSafe (   Matrix,
  Var,
  Var2 
)
Value:
for ( Var = (Matrix)->lVars.pHead, Var2 = (Var? Var->pNext: NULL);\
Var;\
Var = Var2, Var2 = (Var? Var->pNext: NULL) )
int Var
Definition: SolverTypes.h:42

Definition at line 307 of file fxuInt.h.

#define Fxu_MatrixForEachVarInRing (   Matrix,
  Var 
)
Value:
if ( (Matrix)->pOrderVars )\
for ( Var = (Matrix)->pOrderVars;\
Var != (Fxu_Var *)1;\
Var = Var->pOrder )
Definition: fxuInt.h:213
for(p=first;p->value< newval;p=p->next)
int Var
Definition: SolverTypes.h:42

Definition at line 407 of file fxuInt.h.

#define Fxu_MatrixForEachVarInRingSafe (   Matrix,
  Var,
  Var2 
)
Value:
if ( (Matrix)->pOrderVars )\
for ( Var = (Matrix)->pOrderVars, Var2 = ((Var != (Fxu_Var *)1)? Var->pOrder: (Fxu_Var *)1);\
Var != (Fxu_Var *)1;\
Var = Var2, Var2 = ((Var != (Fxu_Var *)1)? Var->pOrder: (Fxu_Var *)1) )
Definition: fxuInt.h:213
for(p=first;p->value< newval;p=p->next)
int Var
Definition: SolverTypes.h:42

Definition at line 412 of file fxuInt.h.

#define Fxu_MatrixRingCubesAdd (   Matrix,
  Cube 
)    ((*((Matrix)->ppTailCubes) = Cube), ((Matrix)->ppTailCubes = &(Cube)->pOrder), ((Cube)->pOrder = (Fxu_Cube *)1))

Definition at line 394 of file fxuInt.h.

#define Fxu_MatrixRingCubesReset (   Matrix)    (((Matrix)->pOrderCubes = NULL), ((Matrix)->ppTailCubes = NULL))

Definition at line 391 of file fxuInt.h.

#define Fxu_MatrixRingCubesStart (   Matrix)    (((Matrix)->ppTailCubes = &((Matrix)->pOrderCubes)), ((Matrix)->pOrderCubes = NULL))

Definition at line 385 of file fxuInt.h.

#define Fxu_MatrixRingCubesStop (   Matrix)

Definition at line 388 of file fxuInt.h.

#define Fxu_MatrixRingVarsAdd (   Matrix,
  Var 
)    ((*((Matrix)->ppTailVars ) = Var ), ((Matrix)->ppTailVars = &(Var)->pOrder ), ((Var)->pOrder = (Fxu_Var *)1))

Definition at line 395 of file fxuInt.h.

#define Fxu_MatrixRingVarsReset (   Matrix)    (((Matrix)->pOrderVars = NULL), ((Matrix)->ppTailVars = NULL))

Definition at line 392 of file fxuInt.h.

#define Fxu_MatrixRingVarsStart (   Matrix)    (((Matrix)->ppTailVars = &((Matrix)->pOrderVars)), ((Matrix)->pOrderVars = NULL))

Definition at line 386 of file fxuInt.h.

#define Fxu_MatrixRingVarsStop (   Matrix)

Definition at line 389 of file fxuInt.h.

#define Fxu_Max (   a,
 
)    ( ((a)>(b))? (a):(b) )

Definition at line 284 of file fxuInt.h.

#define Fxu_Min (   a,
 
)    ( ((a)<(b))? (a):(b) )

MACRO DEFINITIONS ///.

Definition at line 283 of file fxuInt.h.

#define Fxu_PairMaxCube (   pPair)    (((pPair)->iCube1 > (pPair)->iCube2)? (pPair)->pCube1: (pPair)->pCube2)

Definition at line 288 of file fxuInt.h.

#define Fxu_PairMaxCubeInt (   pPair)    (((pPair)->iCube1 > (pPair)->iCube2)? (pPair)->iCube1: (pPair)->iCube2)

Definition at line 290 of file fxuInt.h.

#define Fxu_PairMinCube (   pPair)    (((pPair)->iCube1 < (pPair)->iCube2)? (pPair)->pCube1: (pPair)->pCube2)

Definition at line 287 of file fxuInt.h.

#define Fxu_PairMinCubeInt (   pPair)    (((pPair)->iCube1 < (pPair)->iCube2)? (pPair)->iCube1: (pPair)->iCube2)

Definition at line 289 of file fxuInt.h.

#define Fxu_TableForEachDouble (   Matrix,
  Key,
  Div 
)
Value:
for ( Div = (Matrix)->pTable[Key].pHead;\
Div;\
Div = Div->pNext )

Definition at line 321 of file fxuInt.h.

#define Fxu_TableForEachDoubleSafe (   Matrix,
  Key,
  Div,
  Div2 
)
Value:
for ( Div = (Matrix)->pTable[Key].pHead, Div2 = (Div? Div->pNext: NULL);\
Div;\
Div = Div2, Div2 = (Div? Div->pNext: NULL) )

Definition at line 325 of file fxuInt.h.

#define Fxu_VarForEachLiteral (   Var,
  Lit 
)
Value:
for ( Lit = (Var)->lLits.pHead;\
Lit;\
Lit = Lit->pVNext )
int Var
Definition: SolverTypes.h:42

Definition at line 347 of file fxuInt.h.

#define MEM_ALLOC_FXU (   Manager,
  Type,
  Size 
)    ((Type *)Fxu_MemFetch( Manager, (Size) * sizeof(Type) ))

Definition at line 429 of file fxuInt.h.

#define MEM_FREE_FXU (   Manager,
  Type,
  Size,
  Pointer 
)    if ( Pointer ) { Fxu_MemRecycle( Manager, (char *)(Pointer), (Size) * sizeof(Type) ); Pointer = NULL; }

Definition at line 431 of file fxuInt.h.

Typedef Documentation

typedef struct FxuCube Fxu_Cube

Definition at line 66 of file fxuInt.h.

typedef struct FxuDouble Fxu_Double

Definition at line 72 of file fxuInt.h.

typedef struct FxuHeapDouble Fxu_HeapDouble

Definition at line 84 of file fxuInt.h.

typedef struct FxuHeapSingle Fxu_HeapSingle

Definition at line 85 of file fxuInt.h.

typedef struct FxuListCube Fxu_ListCube

Definition at line 76 of file fxuInt.h.

typedef struct FxuListDouble Fxu_ListDouble

Definition at line 80 of file fxuInt.h.

typedef struct FxuListLit Fxu_ListLit

Definition at line 78 of file fxuInt.h.

typedef struct FxuListPair Fxu_ListPair

Definition at line 79 of file fxuInt.h.

typedef struct FxuListSingle Fxu_ListSingle

Definition at line 81 of file fxuInt.h.

typedef struct FxuListVar Fxu_ListVar

Definition at line 77 of file fxuInt.h.

typedef struct FxuLit Fxu_Lit

Definition at line 68 of file fxuInt.h.

typedef typedefABC_NAMESPACE_HEADER_START struct FxuMatrix Fxu_Matrix

INCLUDES ///.

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

FileName [fxuInt.h]

PackageName [MVSIS 2.0: Multi-valued logic synthesis system.]

Synopsis [Internal declarations of fast extract for unate covers.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - February 1, 2003.]

Revision [

Id:
fxuInt.h,v 1.3 2003/04/10 05:42:44 donald Exp

]PARAMETERS ///STRUCTURE DEFINITIONS ///

Definition at line 63 of file fxuInt.h.

typedef struct FxuPair Fxu_Pair

Definition at line 71 of file fxuInt.h.

typedef struct FxuSingle Fxu_Single

Definition at line 73 of file fxuInt.h.

typedef struct FxuVar Fxu_Var

Definition at line 67 of file fxuInt.h.

Function Documentation

void Fxu_HeapDoubleCheck ( Fxu_HeapDouble p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 152 of file fxuHeapD.c.

153 {
154  Fxu_Double * pDiv;
155  Fxu_HeapDoubleForEachItem( p, pDiv )
156  {
157  assert( pDiv->HNum == p->i );
158  Fxu_HeapDoubleCheckOne( p, pDiv );
159  }
160 }
#define Fxu_HeapDoubleForEachItem(Heap, Div)
Definition: fxuInt.h:375
int HNum
Definition: fxuInt.h:257
void Fxu_HeapDoubleCheckOne(Fxu_HeapDouble *p, Fxu_Double *pDiv)
Definition: fxuHeapD.c:173
#define assert(ex)
Definition: util_old.h:213
void Fxu_HeapDoubleCheckOne ( Fxu_HeapDouble p,
Fxu_Double pDiv 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 173 of file fxuHeapD.c.

174 {
175  int Weight1, Weight2;
176  if ( FXU_HEAP_DOUBLE_CHILD1_EXISTS(p,pDiv) )
177  {
178  Weight1 = FXU_HEAP_DOUBLE_WEIGHT(pDiv);
179  Weight2 = FXU_HEAP_DOUBLE_WEIGHT( FXU_HEAP_DOUBLE_CHILD1(p,pDiv) );
180  assert( Weight1 >= Weight2 );
181  }
182  if ( FXU_HEAP_DOUBLE_CHILD2_EXISTS(p,pDiv) )
183  {
184  Weight1 = FXU_HEAP_DOUBLE_WEIGHT(pDiv);
185  Weight2 = FXU_HEAP_DOUBLE_WEIGHT( FXU_HEAP_DOUBLE_CHILD2(p,pDiv) );
186  assert( Weight1 >= Weight2 );
187  }
188 }
#define FXU_HEAP_DOUBLE_CHILD2(p, pDiv)
Definition: fxuHeapD.c:35
#define FXU_HEAP_DOUBLE_WEIGHT(pDiv)
DECLARATIONS ///.
Definition: fxuHeapD.c:28
#define FXU_HEAP_DOUBLE_CHILD2_EXISTS(p, pDiv)
Definition: fxuHeapD.c:32
#define FXU_HEAP_DOUBLE_CHILD1(p, pDiv)
Definition: fxuHeapD.c:34
#define FXU_HEAP_DOUBLE_CHILD1_EXISTS(p, pDiv)
Definition: fxuHeapD.c:31
#define assert(ex)
Definition: util_old.h:213
void Fxu_HeapDoubleDelete ( Fxu_HeapDouble p,
Fxu_Double pDiv 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 250 of file fxuHeapD.c.

251 {
252  FXU_HEAP_DOUBLE_ASSERT(p,pDiv);
253  // put the last entry to the deleted place
254  // decrement the number of entries
255  p->pTree[pDiv->HNum] = p->pTree[p->nItems--];
256  p->pTree[pDiv->HNum]->HNum = pDiv->HNum;
257  // move the top entry down if necessary
258  Fxu_HeapDoubleUpdate( p, p->pTree[pDiv->HNum] );
259  pDiv->HNum = 0;
260 }
void Fxu_HeapDoubleUpdate(Fxu_HeapDouble *p, Fxu_Double *pDiv)
Definition: fxuHeapD.c:223
int nItems
Definition: fxuInt.h:145
int HNum
Definition: fxuInt.h:257
Fxu_Double ** pTree
Definition: fxuInt.h:144
#define FXU_HEAP_DOUBLE_ASSERT(p, pDiv)
Definition: fxuHeapD.c:36
Fxu_Double* Fxu_HeapDoubleGetMax ( Fxu_HeapDouble p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 291 of file fxuHeapD.c.

292 {
293  Fxu_Double * pDiv;
294  if ( p->nItems == 0 )
295  return NULL;
296  // prepare the return value
297  pDiv = p->pTree[1];
298  pDiv->HNum = 0;
299  // put the last entry on top
300  // decrement the number of entries
301  p->pTree[1] = p->pTree[p->nItems--];
302  p->pTree[1]->HNum = 1;
303  // move the top entry down if necessary
304  Fxu_HeapDoubleMoveDn( p, p->pTree[1] );
305  return pDiv;
306 }
int nItems
Definition: fxuInt.h:145
static void Fxu_HeapDoubleMoveDn(Fxu_HeapDouble *p, Fxu_Double *pDiv)
Definition: fxuHeapD.c:391
int HNum
Definition: fxuInt.h:257
Fxu_Double ** pTree
Definition: fxuInt.h:144
void Fxu_HeapDoubleInsert ( Fxu_HeapDouble p,
Fxu_Double pDiv 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 201 of file fxuHeapD.c.

202 {
203  if ( p->nItems == p->nItemsAlloc )
205  // put the last entry to the last place and move up
206  p->pTree[++p->nItems] = pDiv;
207  pDiv->HNum = p->nItems;
208  // move the last entry up if necessary
209  Fxu_HeapDoubleMoveUp( p, pDiv );
210 }
static void Fxu_HeapDoubleMoveUp(Fxu_HeapDouble *p, Fxu_Double *pDiv)
Definition: fxuHeapD.c:363
int nItems
Definition: fxuInt.h:145
int HNum
Definition: fxuInt.h:257
int nItemsAlloc
Definition: fxuInt.h:146
static void Fxu_HeapDoubleResize(Fxu_HeapDouble *p)
Definition: fxuHeapD.c:82
Fxu_Double ** pTree
Definition: fxuInt.h:144
void Fxu_HeapDoublePrint ( FILE *  pFile,
Fxu_HeapDouble p 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 117 of file fxuHeapD.c.

118 {
119  Fxu_Double * pDiv;
120  int Counter = 1;
121  int Degree = 1;
122 
123  Fxu_HeapDoubleCheck( p );
124  fprintf( pFile, "The contents of the heap:\n" );
125  fprintf( pFile, "Level %d: ", Degree );
126  Fxu_HeapDoubleForEachItem( p, pDiv )
127  {
128  assert( Counter == p->pTree[Counter]->HNum );
129  fprintf( pFile, "%2d=%3d ", Counter, FXU_HEAP_DOUBLE_WEIGHT(p->pTree[Counter]) );
130  if ( ++Counter == (1 << Degree) )
131  {
132  fprintf( pFile, "\n" );
133  Degree++;
134  fprintf( pFile, "Level %d: ", Degree );
135  }
136  }
137  fprintf( pFile, "\n" );
138  fprintf( pFile, "End of the heap printout.\n" );
139 }
#define FXU_HEAP_DOUBLE_WEIGHT(pDiv)
DECLARATIONS ///.
Definition: fxuHeapD.c:28
void Fxu_HeapDoubleCheck(Fxu_HeapDouble *p)
Definition: fxuHeapD.c:152
#define Fxu_HeapDoubleForEachItem(Heap, Div)
Definition: fxuInt.h:375
static int Counter
int HNum
Definition: fxuInt.h:257
Fxu_Double ** pTree
Definition: fxuInt.h:144
#define assert(ex)
Definition: util_old.h:213
Fxu_Double* Fxu_HeapDoubleReadMax ( Fxu_HeapDouble p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 273 of file fxuHeapD.c.

274 {
275  if ( p->nItems == 0 )
276  return NULL;
277  return p->pTree[1];
278 }
int nItems
Definition: fxuInt.h:145
Fxu_Double ** pTree
Definition: fxuInt.h:144
int Fxu_HeapDoubleReadMaxWeight ( Fxu_HeapDouble p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 319 of file fxuHeapD.c.

320 {
321  if ( p->nItems == 0 )
322  return -1;
323  else
324  return FXU_HEAP_DOUBLE_WEIGHT(p->pTree[1]);
325 }
#define FXU_HEAP_DOUBLE_WEIGHT(pDiv)
DECLARATIONS ///.
Definition: fxuHeapD.c:28
int nItems
Definition: fxuInt.h:145
Fxu_Double ** pTree
Definition: fxuInt.h:144
Fxu_HeapDouble* Fxu_HeapDoubleStart ( )

FUNCTION DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 58 of file fxuHeapD.c.

59 {
60  Fxu_HeapDouble * p;
61  p = ABC_ALLOC( Fxu_HeapDouble, 1 );
62  memset( p, 0, sizeof(Fxu_HeapDouble) );
63  p->nItems = 0;
64  p->nItemsAlloc = 10000;
65  p->pTree = ABC_ALLOC( Fxu_Double *, p->nItemsAlloc + 1 );
66  p->pTree[0] = NULL;
67  return p;
68 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int nItems
Definition: fxuInt.h:145
int nItemsAlloc
Definition: fxuInt.h:146
Fxu_Double ** pTree
Definition: fxuInt.h:144
void Fxu_HeapDoubleStop ( Fxu_HeapDouble p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 99 of file fxuHeapD.c.

100 {
101  ABC_FREE( p->pTree );
102  ABC_FREE( p );
103 }
#define ABC_FREE(obj)
Definition: abc_global.h:232
Fxu_Double ** pTree
Definition: fxuInt.h:144
void Fxu_HeapDoubleUpdate ( Fxu_HeapDouble p,
Fxu_Double pDiv 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 223 of file fxuHeapD.c.

224 {
225 //printf( "Updating divisor %d.\n", pDiv->Num );
226 
227  FXU_HEAP_DOUBLE_ASSERT(p,pDiv);
228  if ( FXU_HEAP_DOUBLE_PARENT_EXISTS(p,pDiv) &&
230  Fxu_HeapDoubleMoveUp( p, pDiv );
231  else if ( FXU_HEAP_DOUBLE_CHILD1_EXISTS(p,pDiv) &&
233  Fxu_HeapDoubleMoveDn( p, pDiv );
234  else if ( FXU_HEAP_DOUBLE_CHILD2_EXISTS(p,pDiv) &&
236  Fxu_HeapDoubleMoveDn( p, pDiv );
237 }
#define FXU_HEAP_DOUBLE_CHILD2(p, pDiv)
Definition: fxuHeapD.c:35
#define FXU_HEAP_DOUBLE_WEIGHT(pDiv)
DECLARATIONS ///.
Definition: fxuHeapD.c:28
static void Fxu_HeapDoubleMoveUp(Fxu_HeapDouble *p, Fxu_Double *pDiv)
Definition: fxuHeapD.c:363
#define FXU_HEAP_DOUBLE_CHILD2_EXISTS(p, pDiv)
Definition: fxuHeapD.c:32
#define FXU_HEAP_DOUBLE_CHILD1(p, pDiv)
Definition: fxuHeapD.c:34
#define FXU_HEAP_DOUBLE_PARENT(p, pDiv)
Definition: fxuHeapD.c:33
static void Fxu_HeapDoubleMoveDn(Fxu_HeapDouble *p, Fxu_Double *pDiv)
Definition: fxuHeapD.c:391
#define FXU_HEAP_DOUBLE_PARENT_EXISTS(p, pDiv)
Definition: fxuHeapD.c:30
#define FXU_HEAP_DOUBLE_CHILD1_EXISTS(p, pDiv)
Definition: fxuHeapD.c:31
#define FXU_HEAP_DOUBLE_ASSERT(p, pDiv)
Definition: fxuHeapD.c:36
void Fxu_HeapSingleCheck ( Fxu_HeapSingle p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 155 of file fxuHeapS.c.

156 {
157  Fxu_Single * pSingle;
158  Fxu_HeapSingleForEachItem( p, pSingle )
159  {
160  assert( pSingle->HNum == p->i );
161  Fxu_HeapSingleCheckOne( p, pSingle );
162  }
163 }
int HNum
Definition: fxuInt.h:270
#define Fxu_HeapSingleForEachItem(Heap, Single)
Definition: fxuInt.h:379
void Fxu_HeapSingleCheckOne(Fxu_HeapSingle *p, Fxu_Single *pSingle)
Definition: fxuHeapS.c:176
#define assert(ex)
Definition: util_old.h:213
void Fxu_HeapSingleCheckOne ( Fxu_HeapSingle p,
Fxu_Single pSingle 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 176 of file fxuHeapS.c.

177 {
178  int Weight1, Weight2;
179  if ( FXU_HEAP_SINGLE_CHILD1_EXISTS(p,pSingle) )
180  {
181  Weight1 = FXU_HEAP_SINGLE_WEIGHT(pSingle);
182  Weight2 = FXU_HEAP_SINGLE_WEIGHT( FXU_HEAP_SINGLE_CHILD1(p,pSingle) );
183  assert( Weight1 >= Weight2 );
184  }
185  if ( FXU_HEAP_SINGLE_CHILD2_EXISTS(p,pSingle) )
186  {
187  Weight1 = FXU_HEAP_SINGLE_WEIGHT(pSingle);
188  Weight2 = FXU_HEAP_SINGLE_WEIGHT( FXU_HEAP_SINGLE_CHILD2(p,pSingle) );
189  assert( Weight1 >= Weight2 );
190  }
191 }
#define FXU_HEAP_SINGLE_CHILD2_EXISTS(p, pSingle)
Definition: fxuHeapS.c:32
#define FXU_HEAP_SINGLE_CHILD1_EXISTS(p, pSingle)
Definition: fxuHeapS.c:31
#define FXU_HEAP_SINGLE_WEIGHT(pSingle)
DECLARATIONS ///.
Definition: fxuHeapS.c:28
#define FXU_HEAP_SINGLE_CHILD1(p, pSingle)
Definition: fxuHeapS.c:34
#define assert(ex)
Definition: util_old.h:213
#define FXU_HEAP_SINGLE_CHILD2(p, pSingle)
Definition: fxuHeapS.c:35
void Fxu_HeapSingleDelete ( Fxu_HeapSingle p,
Fxu_Single pSingle 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 251 of file fxuHeapS.c.

252 {
253  int Place = pSingle->HNum;
254  FXU_HEAP_SINGLE_ASSERT(p,pSingle);
255  // put the last entry to the deleted place
256  // decrement the number of entries
257  p->pTree[Place] = p->pTree[p->nItems--];
258  p->pTree[Place]->HNum = Place;
259  // move the top entry down if necessary
260  Fxu_HeapSingleUpdate( p, p->pTree[Place] );
261  pSingle->HNum = 0;
262 }
int HNum
Definition: fxuInt.h:270
Fxu_Single ** pTree
Definition: fxuInt.h:153
void Fxu_HeapSingleUpdate(Fxu_HeapSingle *p, Fxu_Single *pSingle)
Definition: fxuHeapS.c:226
#define FXU_HEAP_SINGLE_ASSERT(p, pSingle)
Definition: fxuHeapS.c:36
int nItems
Definition: fxuInt.h:154
Fxu_Single* Fxu_HeapSingleGetMax ( Fxu_HeapSingle p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 293 of file fxuHeapS.c.

294 {
295  Fxu_Single * pSingle;
296  if ( p->nItems == 0 )
297  return NULL;
298  // prepare the return value
299  pSingle = p->pTree[1];
300  pSingle->HNum = 0;
301  // put the last entry on top
302  // decrement the number of entries
303  p->pTree[1] = p->pTree[p->nItems--];
304  p->pTree[1]->HNum = 1;
305  // move the top entry down if necessary
306  Fxu_HeapSingleMoveDn( p, p->pTree[1] );
307  return pSingle;
308 }
int HNum
Definition: fxuInt.h:270
static void Fxu_HeapSingleMoveDn(Fxu_HeapSingle *p, Fxu_Single *pSingle)
Definition: fxuHeapS.c:392
Fxu_Single ** pTree
Definition: fxuInt.h:153
int nItems
Definition: fxuInt.h:154
void Fxu_HeapSingleInsert ( Fxu_HeapSingle p,
Fxu_Single pSingle 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 204 of file fxuHeapS.c.

205 {
206  if ( p->nItems == p->nItemsAlloc )
208  // put the last entry to the last place and move up
209  p->pTree[++p->nItems] = pSingle;
210  pSingle->HNum = p->nItems;
211  // move the last entry up if necessary
212  Fxu_HeapSingleMoveUp( p, pSingle );
213 }
static void Fxu_HeapSingleMoveUp(Fxu_HeapSingle *p, Fxu_Single *pSingle)
Definition: fxuHeapS.c:364
int HNum
Definition: fxuInt.h:270
Fxu_Single ** pTree
Definition: fxuInt.h:153
static void Fxu_HeapSingleResize(Fxu_HeapSingle *p)
Definition: fxuHeapS.c:82
int nItemsAlloc
Definition: fxuInt.h:155
int nItems
Definition: fxuInt.h:154
void Fxu_HeapSinglePrint ( FILE *  pFile,
Fxu_HeapSingle p 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 120 of file fxuHeapS.c.

121 {
122  Fxu_Single * pSingle;
123  int Counter = 1;
124  int Degree = 1;
125 
126  Fxu_HeapSingleCheck( p );
127  fprintf( pFile, "The contents of the heap:\n" );
128  fprintf( pFile, "Level %d: ", Degree );
129  Fxu_HeapSingleForEachItem( p, pSingle )
130  {
131  assert( Counter == p->pTree[Counter]->HNum );
132  fprintf( pFile, "%2d=%3d ", Counter, FXU_HEAP_SINGLE_WEIGHT(p->pTree[Counter]) );
133  if ( ++Counter == (1 << Degree) )
134  {
135  fprintf( pFile, "\n" );
136  Degree++;
137  fprintf( pFile, "Level %d: ", Degree );
138  }
139  }
140  fprintf( pFile, "\n" );
141  fprintf( pFile, "End of the heap printout.\n" );
142 }
void Fxu_HeapSingleCheck(Fxu_HeapSingle *p)
Definition: fxuHeapS.c:155
int HNum
Definition: fxuInt.h:270
Fxu_Single ** pTree
Definition: fxuInt.h:153
#define FXU_HEAP_SINGLE_WEIGHT(pSingle)
DECLARATIONS ///.
Definition: fxuHeapS.c:28
#define Fxu_HeapSingleForEachItem(Heap, Single)
Definition: fxuInt.h:379
static int Counter
#define assert(ex)
Definition: util_old.h:213
Fxu_Single* Fxu_HeapSingleReadMax ( Fxu_HeapSingle p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 275 of file fxuHeapS.c.

276 {
277  if ( p->nItems == 0 )
278  return NULL;
279  return p->pTree[1];
280 }
Fxu_Single ** pTree
Definition: fxuInt.h:153
int nItems
Definition: fxuInt.h:154
int Fxu_HeapSingleReadMaxWeight ( Fxu_HeapSingle p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 321 of file fxuHeapS.c.

322 {
323  if ( p->nItems == 0 )
324  return -1;
325  return FXU_HEAP_SINGLE_WEIGHT(p->pTree[1]);
326 }
Fxu_Single ** pTree
Definition: fxuInt.h:153
#define FXU_HEAP_SINGLE_WEIGHT(pSingle)
DECLARATIONS ///.
Definition: fxuHeapS.c:28
int nItems
Definition: fxuInt.h:154
Fxu_HeapSingle* Fxu_HeapSingleStart ( )

FUNCTION DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 58 of file fxuHeapS.c.

59 {
60  Fxu_HeapSingle * p;
61  p = ABC_ALLOC( Fxu_HeapSingle, 1 );
62  memset( p, 0, sizeof(Fxu_HeapSingle) );
63  p->nItems = 0;
64  p->nItemsAlloc = 2000;
65  p->pTree = ABC_ALLOC( Fxu_Single *, p->nItemsAlloc + 10 );
66  p->pTree[0] = NULL;
67  return p;
68 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Fxu_Single ** pTree
Definition: fxuInt.h:153
int nItemsAlloc
Definition: fxuInt.h:155
int nItems
Definition: fxuInt.h:154
void Fxu_HeapSingleStop ( Fxu_HeapSingle p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 99 of file fxuHeapS.c.

100 {
101  int i;
102  i = 0;
103  ABC_FREE( p->pTree );
104  i = 1;
105  ABC_FREE( p );
106 }
Fxu_Single ** pTree
Definition: fxuInt.h:153
#define ABC_FREE(obj)
Definition: abc_global.h:232
void Fxu_HeapSingleUpdate ( Fxu_HeapSingle p,
Fxu_Single pSingle 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 226 of file fxuHeapS.c.

227 {
228  FXU_HEAP_SINGLE_ASSERT(p,pSingle);
229  if ( FXU_HEAP_SINGLE_PARENT_EXISTS(p,pSingle) &&
231  Fxu_HeapSingleMoveUp( p, pSingle );
232  else if ( FXU_HEAP_SINGLE_CHILD1_EXISTS(p,pSingle) &&
234  Fxu_HeapSingleMoveDn( p, pSingle );
235  else if ( FXU_HEAP_SINGLE_CHILD2_EXISTS(p,pSingle) &&
237  Fxu_HeapSingleMoveDn( p, pSingle );
238 }
static void Fxu_HeapSingleMoveUp(Fxu_HeapSingle *p, Fxu_Single *pSingle)
Definition: fxuHeapS.c:364
#define FXU_HEAP_SINGLE_CHILD2_EXISTS(p, pSingle)
Definition: fxuHeapS.c:32
#define FXU_HEAP_SINGLE_PARENT(p, pSingle)
Definition: fxuHeapS.c:33
#define FXU_HEAP_SINGLE_CHILD1_EXISTS(p, pSingle)
Definition: fxuHeapS.c:31
static void Fxu_HeapSingleMoveDn(Fxu_HeapSingle *p, Fxu_Single *pSingle)
Definition: fxuHeapS.c:392
#define FXU_HEAP_SINGLE_WEIGHT(pSingle)
DECLARATIONS ///.
Definition: fxuHeapS.c:28
#define FXU_HEAP_SINGLE_PARENT_EXISTS(p, pSingle)
Definition: fxuHeapS.c:30
#define FXU_HEAP_SINGLE_CHILD1(p, pSingle)
Definition: fxuHeapS.c:34
#define FXU_HEAP_SINGLE_ASSERT(p, pSingle)
Definition: fxuHeapS.c:36
#define FXU_HEAP_SINGLE_CHILD2(p, pSingle)
Definition: fxuHeapS.c:35
void Fxu_ListCubeAddLiteral ( Fxu_Cube pCube,
Fxu_Lit pLink 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 283 of file fxuList.c.

284 {
285  Fxu_ListLit * pList = &(pCube->lLits);
286  if ( pList->pHead == NULL )
287  {
288  pList->pHead = pLink;
289  pList->pTail = pLink;
290  pLink->pHPrev = NULL;
291  pLink->pHNext = NULL;
292  }
293  else
294  {
295  pLink->pHNext = NULL;
296  pList->pTail->pHNext = pLink;
297  pLink->pHPrev = pList->pTail;
298  pList->pTail = pLink;
299  }
300  pList->nItems++;
301 }
Fxu_Lit * pHead
Definition: fxuInt.h:109
Fxu_Lit * pHNext
Definition: fxuInt.h:233
Fxu_ListLit lLits
Definition: fxuInt.h:206
Fxu_Lit * pTail
Definition: fxuInt.h:110
int nItems
Definition: fxuInt.h:111
Fxu_Lit * pHPrev
Definition: fxuInt.h:232
void Fxu_ListCubeDelLiteral ( Fxu_Cube pCube,
Fxu_Lit pLink 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 314 of file fxuList.c.

315 {
316  Fxu_ListLit * pList = &(pCube->lLits);
317  if ( pList->pHead == pLink )
318  pList->pHead = pLink->pHNext;
319  if ( pList->pTail == pLink )
320  pList->pTail = pLink->pHPrev;
321  if ( pLink->pHPrev )
322  pLink->pHPrev->pHNext = pLink->pHNext;
323  if ( pLink->pHNext )
324  pLink->pHNext->pHPrev = pLink->pHPrev;
325  pList->nItems--;
326 }
Fxu_Lit * pHead
Definition: fxuInt.h:109
Fxu_Lit * pHNext
Definition: fxuInt.h:233
Fxu_ListLit lLits
Definition: fxuInt.h:206
Fxu_Lit * pTail
Definition: fxuInt.h:110
int nItems
Definition: fxuInt.h:111
Fxu_Lit * pHPrev
Definition: fxuInt.h:232
void Fxu_ListDoubleAddPairFirst ( Fxu_Double pDiv,
Fxu_Pair pLink 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 433 of file fxuList.c.

434 {
435  Fxu_ListPair * pList = &pDiv->lPairs;
436  if ( pList->pHead == NULL )
437  {
438  pList->pHead = pLink;
439  pList->pTail = pLink;
440  pLink->pDPrev = NULL;
441  pLink->pDNext = NULL;
442  }
443  else
444  {
445  pLink->pDPrev = NULL;
446  pList->pHead->pDPrev = pLink;
447  pLink->pDNext = pList->pHead;
448  pList->pHead = pLink;
449  }
450  pList->nItems++;
451 }
Fxu_Pair * pHead
Definition: fxuInt.h:117
Fxu_ListPair lPairs
Definition: fxuInt.h:260
Fxu_Pair * pDPrev
Definition: fxuInt.h:249
int nItems
Definition: fxuInt.h:119
Fxu_Pair * pDNext
Definition: fxuInt.h:250
Fxu_Pair * pTail
Definition: fxuInt.h:118
void Fxu_ListDoubleAddPairLast ( Fxu_Double pDiv,
Fxu_Pair pLink 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 402 of file fxuList.c.

403 {
404  Fxu_ListPair * pList = &pDiv->lPairs;
405  if ( pList->pHead == NULL )
406  {
407  pList->pHead = pLink;
408  pList->pTail = pLink;
409  pLink->pDPrev = NULL;
410  pLink->pDNext = NULL;
411  }
412  else
413  {
414  pLink->pDNext = NULL;
415  pList->pTail->pDNext = pLink;
416  pLink->pDPrev = pList->pTail;
417  pList->pTail = pLink;
418  }
419  pList->nItems++;
420 }
Fxu_Pair * pHead
Definition: fxuInt.h:117
Fxu_ListPair lPairs
Definition: fxuInt.h:260
Fxu_Pair * pDPrev
Definition: fxuInt.h:249
int nItems
Definition: fxuInt.h:119
Fxu_Pair * pDNext
Definition: fxuInt.h:250
Fxu_Pair * pTail
Definition: fxuInt.h:118
void Fxu_ListDoubleAddPairMiddle ( Fxu_Double pDiv,
Fxu_Pair pSpot,
Fxu_Pair pLink 
)

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

Synopsis [Adds the entry in the middle of the list after the spot.]

Description [Assumes that spot points to the link, after which the given link should be added. Spot cannot be NULL or the tail of the list. Therefore, the head and the tail of the list are not changed.]

SideEffects []

SeeAlso []

Definition at line 466 of file fxuList.c.

467 {
468  Fxu_ListPair * pList = &pDiv->lPairs;
469  assert( pSpot );
470  assert( pSpot != pList->pTail );
471  pLink->pDPrev = pSpot;
472  pLink->pDNext = pSpot->pDNext;
473  pLink->pDPrev->pDNext = pLink;
474  pLink->pDNext->pDPrev = pLink;
475  pList->nItems++;
476 }
Fxu_ListPair lPairs
Definition: fxuInt.h:260
Fxu_Pair * pDPrev
Definition: fxuInt.h:249
int nItems
Definition: fxuInt.h:119
#define assert(ex)
Definition: util_old.h:213
Fxu_Pair * pDNext
Definition: fxuInt.h:250
Fxu_Pair * pTail
Definition: fxuInt.h:118
void Fxu_ListDoubleDelPair ( Fxu_Double pDiv,
Fxu_Pair pLink 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 489 of file fxuList.c.

490 {
491  Fxu_ListPair * pList = &pDiv->lPairs;
492  if ( pList->pHead == pLink )
493  pList->pHead = pLink->pDNext;
494  if ( pList->pTail == pLink )
495  pList->pTail = pLink->pDPrev;
496  if ( pLink->pDPrev )
497  pLink->pDPrev->pDNext = pLink->pDNext;
498  if ( pLink->pDNext )
499  pLink->pDNext->pDPrev = pLink->pDPrev;
500  pList->nItems--;
501 }
Fxu_Pair * pHead
Definition: fxuInt.h:117
Fxu_ListPair lPairs
Definition: fxuInt.h:260
Fxu_Pair * pDPrev
Definition: fxuInt.h:249
int nItems
Definition: fxuInt.h:119
Fxu_Pair * pDNext
Definition: fxuInt.h:250
Fxu_Pair * pTail
Definition: fxuInt.h:118
void Fxu_ListMatrixAddCube ( Fxu_Matrix p,
Fxu_Cube pLink 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 104 of file fxuList.c.

105 {
106  Fxu_ListCube * pList = &p->lCubes;
107  if ( pList->pHead == NULL )
108  {
109  pList->pHead = pLink;
110  pList->pTail = pLink;
111  pLink->pPrev = NULL;
112  pLink->pNext = NULL;
113  }
114  else
115  {
116  pLink->pNext = NULL;
117  pList->pTail->pNext = pLink;
118  pLink->pPrev = pList->pTail;
119  pList->pTail = pLink;
120  }
121  pList->nItems++;
122 }
Fxu_Cube * pPrev
Definition: fxuInt.h:207
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Fxu_Cube * pTail
Definition: fxuInt.h:94
Fxu_Cube * pNext
Definition: fxuInt.h:208
Fxu_Cube * pHead
Definition: fxuInt.h:93
int nItems
Definition: fxuInt.h:95
void Fxu_ListMatrixAddSingle ( Fxu_Matrix p,
Fxu_Single pLink 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 163 of file fxuList.c.

164 {
165  Fxu_ListSingle * pList = &p->lSingles;
166  if ( pList->pHead == NULL )
167  {
168  pList->pHead = pLink;
169  pList->pTail = pLink;
170  pLink->pPrev = NULL;
171  pLink->pNext = NULL;
172  }
173  else
174  {
175  pLink->pNext = NULL;
176  pList->pTail->pNext = pLink;
177  pLink->pPrev = pList->pTail;
178  pList->pTail = pLink;
179  }
180  pList->nItems++;
181 }
Fxu_Single * pTail
Definition: fxuInt.h:134
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Fxu_Single * pHead
Definition: fxuInt.h:133
Fxu_Single * pPrev
Definition: fxuInt.h:274
int nItems
Definition: fxuInt.h:135
Fxu_Single * pNext
Definition: fxuInt.h:275
void Fxu_ListMatrixAddVariable ( Fxu_Matrix p,
Fxu_Var pLink 
)

DECLARATIONS ///.

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

FileName [fxuList.c]

PackageName [MVSIS 2.0: Multi-valued logic synthesis system.]

Synopsis [Operations on lists.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - February 1, 2003.]

Revision [

Id:
fxuList.c,v 1.0 2003/02/01 00:00:00 alanmi Exp

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file fxuList.c.

46 {
47  Fxu_ListVar * pList = &p->lVars;
48  if ( pList->pHead == NULL )
49  {
50  pList->pHead = pLink;
51  pList->pTail = pLink;
52  pLink->pPrev = NULL;
53  pLink->pNext = NULL;
54  }
55  else
56  {
57  pLink->pNext = NULL;
58  pList->pTail->pNext = pLink;
59  pLink->pPrev = pList->pTail;
60  pList->pTail = pLink;
61  }
62  pList->nItems++;
63 }
Fxu_Var * pPrev
Definition: fxuInt.h:220
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Fxu_Var * pHead
Definition: fxuInt.h:101
int nItems
Definition: fxuInt.h:103
Fxu_Var * pTail
Definition: fxuInt.h:102
Fxu_Var * pNext
Definition: fxuInt.h:221
void Fxu_ListMatrixDelCube ( Fxu_Matrix p,
Fxu_Cube pLink 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 135 of file fxuList.c.

136 {
137  Fxu_ListCube * pList = &p->lCubes;
138  if ( pList->pHead == pLink )
139  pList->pHead = pLink->pNext;
140  if ( pList->pTail == pLink )
141  pList->pTail = pLink->pPrev;
142  if ( pLink->pPrev )
143  pLink->pPrev->pNext = pLink->pNext;
144  if ( pLink->pNext )
145  pLink->pNext->pPrev = pLink->pPrev;
146  pList->nItems--;
147 }
Fxu_Cube * pPrev
Definition: fxuInt.h:207
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Fxu_Cube * pTail
Definition: fxuInt.h:94
Fxu_Cube * pNext
Definition: fxuInt.h:208
Fxu_Cube * pHead
Definition: fxuInt.h:93
int nItems
Definition: fxuInt.h:95
void Fxu_ListMatrixDelSingle ( Fxu_Matrix p,
Fxu_Single pLink 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 194 of file fxuList.c.

195 {
196  Fxu_ListSingle * pList = &p->lSingles;
197  if ( pList->pHead == pLink )
198  pList->pHead = pLink->pNext;
199  if ( pList->pTail == pLink )
200  pList->pTail = pLink->pPrev;
201  if ( pLink->pPrev )
202  pLink->pPrev->pNext = pLink->pNext;
203  if ( pLink->pNext )
204  pLink->pNext->pPrev = pLink->pPrev;
205  pList->nItems--;
206 }
Fxu_Single * pTail
Definition: fxuInt.h:134
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Fxu_Single * pHead
Definition: fxuInt.h:133
Fxu_Single * pPrev
Definition: fxuInt.h:274
int nItems
Definition: fxuInt.h:135
Fxu_Single * pNext
Definition: fxuInt.h:275
void Fxu_ListMatrixDelVariable ( Fxu_Matrix p,
Fxu_Var pLink 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 76 of file fxuList.c.

77 {
78  Fxu_ListVar * pList = &p->lVars;
79  if ( pList->pHead == pLink )
80  pList->pHead = pLink->pNext;
81  if ( pList->pTail == pLink )
82  pList->pTail = pLink->pPrev;
83  if ( pLink->pPrev )
84  pLink->pPrev->pNext = pLink->pNext;
85  if ( pLink->pNext )
86  pLink->pNext->pPrev = pLink->pPrev;
87  pList->nItems--;
88 }
Fxu_Var * pPrev
Definition: fxuInt.h:220
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Fxu_Var * pHead
Definition: fxuInt.h:101
int nItems
Definition: fxuInt.h:103
Fxu_Var * pTail
Definition: fxuInt.h:102
Fxu_Var * pNext
Definition: fxuInt.h:221
void Fxu_ListTableAddDivisor ( Fxu_Matrix p,
Fxu_Double pLink 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 222 of file fxuList.c.

223 {
224  Fxu_ListDouble * pList = &(p->pTable[pLink->Key]);
225  if ( pList->pHead == NULL )
226  {
227  pList->pHead = pLink;
228  pList->pTail = pLink;
229  pLink->pPrev = NULL;
230  pLink->pNext = NULL;
231  }
232  else
233  {
234  pLink->pNext = NULL;
235  pList->pTail->pNext = pLink;
236  pLink->pPrev = pList->pTail;
237  pList->pTail = pLink;
238  }
239  pList->nItems++;
240  p->nDivs++;
241 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Fxu_Double * pPrev
Definition: fxuInt.h:261
int nItems
Definition: fxuInt.h:127
Fxu_Double * pHead
Definition: fxuInt.h:125
unsigned Key
Definition: fxuInt.h:259
Fxu_Double * pNext
Definition: fxuInt.h:262
Fxu_Double * pTail
Definition: fxuInt.h:126
void Fxu_ListTableDelDivisor ( Fxu_Matrix p,
Fxu_Double pLink 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 254 of file fxuList.c.

255 {
256  Fxu_ListDouble * pList = &(p->pTable[pLink->Key]);
257  if ( pList->pHead == pLink )
258  pList->pHead = pLink->pNext;
259  if ( pList->pTail == pLink )
260  pList->pTail = pLink->pPrev;
261  if ( pLink->pPrev )
262  pLink->pPrev->pNext = pLink->pNext;
263  if ( pLink->pNext )
264  pLink->pNext->pPrev = pLink->pPrev;
265  pList->nItems--;
266  p->nDivs--;
267 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Fxu_Double * pPrev
Definition: fxuInt.h:261
int nItems
Definition: fxuInt.h:127
Fxu_Double * pHead
Definition: fxuInt.h:125
unsigned Key
Definition: fxuInt.h:259
Fxu_Double * pNext
Definition: fxuInt.h:262
Fxu_Double * pTail
Definition: fxuInt.h:126
void Fxu_ListVarAddLiteral ( Fxu_Var pVar,
Fxu_Lit pLink 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 342 of file fxuList.c.

343 {
344  Fxu_ListLit * pList = &(pVar->lLits);
345  if ( pList->pHead == NULL )
346  {
347  pList->pHead = pLink;
348  pList->pTail = pLink;
349  pLink->pVPrev = NULL;
350  pLink->pVNext = NULL;
351  }
352  else
353  {
354  pLink->pVNext = NULL;
355  pList->pTail->pVNext = pLink;
356  pLink->pVPrev = pList->pTail;
357  pList->pTail = pLink;
358  }
359  pList->nItems++;
360 }
Fxu_ListLit lLits
Definition: fxuInt.h:219
Fxu_Lit * pHead
Definition: fxuInt.h:109
Fxu_Lit * pVNext
Definition: fxuInt.h:235
Fxu_Lit * pVPrev
Definition: fxuInt.h:234
Fxu_Lit * pTail
Definition: fxuInt.h:110
int nItems
Definition: fxuInt.h:111
void Fxu_ListVarDelLiteral ( Fxu_Var pVar,
Fxu_Lit pLink 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 373 of file fxuList.c.

374 {
375  Fxu_ListLit * pList = &(pVar->lLits);
376  if ( pList->pHead == pLink )
377  pList->pHead = pLink->pVNext;
378  if ( pList->pTail == pLink )
379  pList->pTail = pLink->pVPrev;
380  if ( pLink->pVPrev )
381  pLink->pVPrev->pVNext = pLink->pVNext;
382  if ( pLink->pVNext )
383  pLink->pVNext->pVPrev = pLink->pVPrev;
384  pList->nItems--;
385 }
Fxu_ListLit lLits
Definition: fxuInt.h:219
Fxu_Lit * pHead
Definition: fxuInt.h:109
Fxu_Lit * pVNext
Definition: fxuInt.h:235
Fxu_Lit * pVPrev
Definition: fxuInt.h:234
Fxu_Lit * pTail
Definition: fxuInt.h:110
int nItems
Definition: fxuInt.h:111
Fxu_Cube* Fxu_MatrixAddCube ( Fxu_Matrix p,
Fxu_Var pVar,
int  iCube 
)

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

Synopsis [Adds a literal to the matrix.]

Description []

SideEffects []

SeeAlso []

Definition at line 183 of file fxuMatrix.c.

184 {
185  Fxu_Cube * pCube;
186  pCube = MEM_ALLOC_FXU( p, Fxu_Cube, 1 );
187  memset( pCube, 0, sizeof(Fxu_Cube) );
188  pCube->pVar = pVar;
189  pCube->iCube = iCube;
190  Fxu_ListMatrixAddCube( p, pCube );
191  return pCube;
192 }
char * memset()
int iCube
Definition: fxuInt.h:203
void Fxu_ListMatrixAddCube(Fxu_Matrix *p, Fxu_Cube *pCube)
Definition: fxuList.c:104
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define MEM_ALLOC_FXU(Manager, Type, Size)
Definition: fxuInt.h:429
Fxu_Var * pVar
Definition: fxuInt.h:205
void Fxu_MatrixAddDivisor ( Fxu_Matrix p,
Fxu_Cube pCube1,
Fxu_Cube pCube2 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 301 of file fxuMatrix.c.

302 {
303  Fxu_Pair * pPair;
304  Fxu_Double * pDiv;
305  int nBase, nLits1, nLits2;
306  int fFound;
307  unsigned Key;
308 
309  // canonicize the pair
310  Fxu_PairCanonicize( &pCube1, &pCube2 );
311  // compute the hash key
312  Key = Fxu_PairHashKey( p, pCube1, pCube2, &nBase, &nLits1, &nLits2 );
313 
314  // create the cube pair
315  pPair = Fxu_PairAlloc( p, pCube1, pCube2 );
316  pPair->nBase = nBase;
317  pPair->nLits1 = nLits1;
318  pPair->nLits2 = nLits2;
319 
320  // check if the divisor for this pair already exists
321  fFound = 0;
322  Key %= p->nTableSize;
323  Fxu_TableForEachDouble( p, Key, pDiv )
324  {
325  if ( Fxu_PairCompare( pPair, pDiv->lPairs.pTail ) ) // they are equal
326  {
327  fFound = 1;
328  break;
329  }
330  }
331 
332  if ( !fFound )
333  { // create the new divisor
334  pDiv = MEM_ALLOC_FXU( p, Fxu_Double, 1 );
335  memset( pDiv, 0, sizeof(Fxu_Double) );
336  pDiv->Key = Key;
337  // set the number of this divisor
338  pDiv->Num = p->nDivsTotal++; // p->nDivs;
339  // insert the divisor in the table
340  Fxu_ListTableAddDivisor( p, pDiv );
341  // set the initial cost of the divisor
342  pDiv->Weight -= pPair->nLits1 + pPair->nLits2;
343  }
344 
345  // link the pair to the cubes
346  Fxu_PairAdd( pPair );
347  // connect the pair and the divisor
348  pPair->pDiv = pDiv;
349  Fxu_ListDoubleAddPairLast( pDiv, pPair );
350  // update the max number of pairs in a divisor
351 // if ( p->nPairsMax < pDiv->lPairs.nItems )
352 // p->nPairsMax = pDiv->lPairs.nItems;
353  // update the divisor's weight
354  pDiv->Weight += pPair->nLits1 + pPair->nLits2 - 1 + pPair->nBase;
355  if ( fFound ) // update the divisor in the heap
356  Fxu_HeapDoubleUpdate( p->pHeapDouble, pDiv );
357  else // add the new divisor to the heap
358  Fxu_HeapDoubleInsert( p->pHeapDouble, pDiv );
359 }
char * memset()
int Fxu_PairCompare(Fxu_Pair *pPair1, Fxu_Pair *pPair2)
Definition: fxuPair.c:236
void Fxu_PairCanonicize(Fxu_Cube **ppCube1, Fxu_Cube **ppCube2)
FUNCTION DEFINITIONS ///.
Definition: fxuPair.c:75
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Fxu_ListTableAddDivisor(Fxu_Matrix *p, Fxu_Double *pDiv)
Definition: fxuList.c:222
Fxu_ListPair lPairs
Definition: fxuInt.h:260
#define MEM_ALLOC_FXU(Manager, Type, Size)
Definition: fxuInt.h:429
Fxu_Double * pDiv
Definition: fxuInt.h:244
unsigned Fxu_PairHashKey(Fxu_Matrix *p, Fxu_Cube *pCube1, Fxu_Cube *pCube2, int *pnBase, int *pnLits1, int *pnLits2)
Definition: fxuPair.c:164
void Fxu_HeapDoubleUpdate(Fxu_HeapDouble *p, Fxu_Double *pDiv)
Definition: fxuHeapD.c:223
int Num
Definition: fxuInt.h:256
int nBase
Definition: fxuInt.h:243
int nLits2
Definition: fxuInt.h:242
#define Fxu_TableForEachDouble(Matrix, Key, Div)
Definition: fxuInt.h:321
Fxu_Pair * Fxu_PairAlloc(Fxu_Matrix *p, Fxu_Cube *pCube1, Fxu_Cube *pCube2)
Definition: fxuPair.c:519
int Weight
Definition: fxuInt.h:258
void Fxu_PairAdd(Fxu_Pair *pPair)
Definition: fxuPair.c:543
unsigned Key
Definition: fxuInt.h:259
void Fxu_HeapDoubleInsert(Fxu_HeapDouble *p, Fxu_Double *pDiv)
Definition: fxuHeapD.c:201
void Fxu_ListDoubleAddPairLast(Fxu_Double *pDiv, Fxu_Pair *pLink)
Definition: fxuList.c:402
int nLits1
Definition: fxuInt.h:241
Fxu_Pair * pTail
Definition: fxuInt.h:118
void Fxu_MatrixAddLiteral ( Fxu_Matrix p,
Fxu_Cube pCube,
Fxu_Var pVar 
)

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

Synopsis [Adds a literal to the matrix.]

Description []

SideEffects []

SeeAlso []

Definition at line 205 of file fxuMatrix.c.

206 {
207  Fxu_Lit * pLit;
208  pLit = MEM_ALLOC_FXU( p, Fxu_Lit, 1 );
209  memset( pLit, 0, sizeof(Fxu_Lit) );
210  // insert the literal into two linked lists
211  Fxu_ListCubeAddLiteral( pCube, pLit );
212  Fxu_ListVarAddLiteral( pVar, pLit );
213  // set the back pointers
214  pLit->pCube = pCube;
215  pLit->pVar = pVar;
216  pLit->iCube = pCube->iCube;
217  pLit->iVar = pVar->iVar;
218  // increment the literal counter
219  p->nEntries++;
220 }
char * memset()
int iCube
Definition: fxuInt.h:203
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int iVar
Definition: fxuInt.h:215
int iCube
Definition: fxuInt.h:229
void Fxu_ListVarAddLiteral(Fxu_Var *pVar, Fxu_Lit *pLit)
Definition: fxuList.c:342
#define MEM_ALLOC_FXU(Manager, Type, Size)
Definition: fxuInt.h:429
void Fxu_ListCubeAddLiteral(Fxu_Cube *pCube, Fxu_Lit *pLit)
Definition: fxuList.c:283
Fxu_Cube * pCube
Definition: fxuInt.h:230
int iVar
Definition: fxuInt.h:228
Fxu_Var * pVar
Definition: fxuInt.h:231
Definition: fxuInt.h:226
void Fxu_MatrixAddSingle ( Fxu_Matrix p,
Fxu_Var pVar1,
Fxu_Var pVar2,
int  Weight 
)

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

Synopsis [Creates and adds a single cube divisor.]

Description []

SideEffects []

SeeAlso []

Definition at line 274 of file fxuMatrix.c.

275 {
276  Fxu_Single * pSingle;
277  assert( pVar1->iVar < pVar2->iVar );
278  pSingle = MEM_ALLOC_FXU( p, Fxu_Single, 1 );
279  memset( pSingle, 0, sizeof(Fxu_Single) );
280  pSingle->Num = p->lSingles.nItems;
281  pSingle->Weight = Weight;
282  pSingle->HNum = 0;
283  pSingle->pVar1 = pVar1;
284  pSingle->pVar2 = pVar2;
285  Fxu_ListMatrixAddSingle( p, pSingle );
286  // add to the heap
287  Fxu_HeapSingleInsert( p->pHeapSingle, pSingle );
288 }
char * memset()
void Fxu_HeapSingleInsert(Fxu_HeapSingle *p, Fxu_Single *pSingle)
Definition: fxuHeapS.c:204
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int iVar
Definition: fxuInt.h:215
int HNum
Definition: fxuInt.h:270
#define MEM_ALLOC_FXU(Manager, Type, Size)
Definition: fxuInt.h:429
Fxu_Var * pVar2
Definition: fxuInt.h:273
void Fxu_ListMatrixAddSingle(Fxu_Matrix *p, Fxu_Single *pSingle)
Definition: fxuList.c:163
Fxu_Var * pVar1
Definition: fxuInt.h:272
int Weight
Definition: fxuInt.h:271
#define assert(ex)
Definition: util_old.h:213
int Num
Definition: fxuInt.h:269
Fxu_Var* Fxu_MatrixAddVar ( Fxu_Matrix p)

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

Synopsis [Adds a variable to the matrix.]

Description [This procedure always adds variables at the end of the matrix. It assigns the var's node and number. It adds the var to the linked list of all variables and to the table of all nodes.]

SideEffects []

SeeAlso []

Definition at line 161 of file fxuMatrix.c.

162 {
163  Fxu_Var * pVar;
164  pVar = MEM_ALLOC_FXU( p, Fxu_Var, 1 );
165  memset( pVar, 0, sizeof(Fxu_Var) );
166  pVar->iVar = p->lVars.nItems;
167  p->ppVars[pVar->iVar] = pVar;
168  Fxu_ListMatrixAddVariable( p, pVar );
169  return pVar;
170 }
char * memset()
Definition: fxuInt.h:213
void Fxu_ListMatrixAddVariable(Fxu_Matrix *p, Fxu_Var *pVar)
DECLARATIONS ///.
Definition: fxuList.c:45
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int iVar
Definition: fxuInt.h:215
#define MEM_ALLOC_FXU(Manager, Type, Size)
Definition: fxuInt.h:429
Fxu_Matrix* Fxu_MatrixAllocate ( )

DECLARATIONS ///.

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

FileName [fxuMatrix.c]

PackageName [MVSIS 2.0: Multi-valued logic synthesis system.]

Synopsis [Procedures to manipulate the sparse matrix.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - February 1, 2003.]

Revision [

Id:
fxuMatrix.c,v 1.0 2003/02/01 00:00:00 alanmi Exp

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 43 of file fxuMatrix.c.

44 {
45  Fxu_Matrix * p;
46  p = ABC_ALLOC( Fxu_Matrix, 1 );
47  memset( p, 0, sizeof(Fxu_Matrix) );
48  p->nTableSize = Abc_PrimeCudd(10000);
49  p->pTable = ABC_ALLOC( Fxu_ListDouble, p->nTableSize );
50  memset( p->pTable, 0, sizeof(Fxu_ListDouble) * p->nTableSize );
51 #ifndef USE_SYSTEM_MEMORY_MANAGEMENT
52  {
53  // get the largest size in bytes for the following structures:
54  // Fxu_Cube, Fxu_Var, Fxu_Lit, Fxu_Pair, Fxu_Double, Fxu_Single
55  // (currently, Fxu_Var, Fxu_Pair, Fxu_Double take 10 machine words)
56  int nSizeMax, nSizeCur;
57  nSizeMax = -1;
58  nSizeCur = sizeof(Fxu_Cube);
59  if ( nSizeMax < nSizeCur )
60  nSizeMax = nSizeCur;
61  nSizeCur = sizeof(Fxu_Var);
62  if ( nSizeMax < nSizeCur )
63  nSizeMax = nSizeCur;
64  nSizeCur = sizeof(Fxu_Lit);
65  if ( nSizeMax < nSizeCur )
66  nSizeMax = nSizeCur;
67  nSizeCur = sizeof(Fxu_Pair);
68  if ( nSizeMax < nSizeCur )
69  nSizeMax = nSizeCur;
70  nSizeCur = sizeof(Fxu_Double);
71  if ( nSizeMax < nSizeCur )
72  nSizeMax = nSizeCur;
73  nSizeCur = sizeof(Fxu_Single);
74  if ( nSizeMax < nSizeCur )
75  nSizeMax = nSizeCur;
76  p->pMemMan = Extra_MmFixedStart( nSizeMax );
77  }
78 #endif
79  p->pHeapDouble = Fxu_HeapDoubleStart();
80  p->pHeapSingle = Fxu_HeapSingleStart();
81  p->vPairs = Vec_PtrAlloc( 100 );
82  return p;
83 }
char * memset()
Fxu_HeapDouble * Fxu_HeapDoubleStart()
FUNCTION DEFINITIONS ///.
Definition: fxuHeapD.c:58
static int Abc_PrimeCudd(unsigned int p)
Definition: abc_global.h:383
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Fxu_HeapSingle * Fxu_HeapSingleStart()
FUNCTION DEFINITIONS ///.
Definition: fxuHeapS.c:58
struct FxuPair Fxu_Pair
Definition: fxuInt.h:71
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
struct FxuVar Fxu_Var
Definition: fxuInt.h:67
struct FxuCube Fxu_Cube
Definition: fxuInt.h:66
Extra_MmFixed_t * Extra_MmFixedStart(int nEntrySize)
struct FxuSingle Fxu_Single
Definition: fxuInt.h:73
struct FxuLit Fxu_Lit
Definition: fxuInt.h:68
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
struct FxuDouble Fxu_Double
Definition: fxuInt.h:72
typedefABC_NAMESPACE_HEADER_START struct FxuMatrix Fxu_Matrix
INCLUDES ///.
Definition: fxuInt.h:63
void Fxu_MatrixComputeSingles ( Fxu_Matrix p,
int  fUse0,
int  nSingleMax 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Computes and adds all single-cube divisors to storage.]

Description [This procedure should be called once when the matrix is already contructed before the process of logic extraction begins..]

SideEffects []

SeeAlso []

Definition at line 47 of file fxuSingle.c.

48 {
49  Fxu_Var * pVar;
50  Vec_Ptr_t * vSingles;
51  int i, k;
52  // set the weight limit
53  p->nWeightLimit = 1 - fUse0;
54  // iterate through columns in the matrix and collect single-cube divisors
55  vSingles = Vec_PtrAlloc( 10000 );
57  Fxu_MatrixComputeSinglesOneCollect( p, pVar, vSingles );
58  p->nSingleTotal = Vec_PtrSize(vSingles) / 3;
59  // check if divisors should be filtered
60  if ( Vec_PtrSize(vSingles) > nSingleMax )
61  {
62  int * pWeigtCounts, nDivCount, Weight, i, c;;
63  assert( Vec_PtrSize(vSingles) % 3 == 0 );
64  // count how many divisors have the given weight
65  pWeigtCounts = ABC_ALLOC( int, 1000 );
66  memset( pWeigtCounts, 0, sizeof(int) * 1000 );
67  for ( i = 2; i < Vec_PtrSize(vSingles); i += 3 )
68  {
69  Weight = (int)(ABC_PTRUINT_T)Vec_PtrEntry(vSingles, i);
70  if ( Weight >= 999 )
71  pWeigtCounts[999]++;
72  else
73  pWeigtCounts[Weight]++;
74  }
75  // select the bound on the weight (above this bound, singles will be included)
76  nDivCount = 0;
77  for ( c = 999; c >= 0; c-- )
78  {
79  nDivCount += pWeigtCounts[c];
80  if ( nDivCount >= nSingleMax )
81  break;
82  }
83  ABC_FREE( pWeigtCounts );
84  // collect singles with the given costs
85  k = 0;
86  for ( i = 2; i < Vec_PtrSize(vSingles); i += 3 )
87  {
88  Weight = (int)(ABC_PTRUINT_T)Vec_PtrEntry(vSingles, i);
89  if ( Weight < c )
90  continue;
91  Vec_PtrWriteEntry( vSingles, k++, Vec_PtrEntry(vSingles, i-2) );
92  Vec_PtrWriteEntry( vSingles, k++, Vec_PtrEntry(vSingles, i-1) );
93  Vec_PtrWriteEntry( vSingles, k++, Vec_PtrEntry(vSingles, i) );
94  if ( k/3 == nSingleMax )
95  break;
96  }
97  Vec_PtrShrink( vSingles, k );
98  // adjust the weight limit
99  p->nWeightLimit = c;
100  }
101  // collect the selected divisors
102  assert( Vec_PtrSize(vSingles) % 3 == 0 );
103  for ( i = 0; i < Vec_PtrSize(vSingles); i += 3 )
104  {
106  (Fxu_Var *)Vec_PtrEntry(vSingles,i),
107  (Fxu_Var *)Vec_PtrEntry(vSingles,i+1),
108  (int)(ABC_PTRUINT_T)Vec_PtrEntry(vSingles,i+2) );
109  }
110  Vec_PtrFree( vSingles );
111 }
char * memset()
Definition: fxuInt.h:213
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
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
#define Fxu_MatrixForEachVariable(Matrix, Var)
Definition: fxuInt.h:303
static ABC_NAMESPACE_IMPL_START void Fxu_MatrixComputeSinglesOneCollect(Fxu_Matrix *p, Fxu_Var *pVar, Vec_Ptr_t *vSingles)
DECLARATIONS ///.
Definition: fxuSingle.c:124
if(last==0)
Definition: sparse_int.h:34
void Fxu_MatrixAddSingle(Fxu_Matrix *p, Fxu_Var *pVar1, Fxu_Var *pVar2, int Weight)
Definition: fxuMatrix.c:274
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define assert(ex)
Definition: util_old.h:213
static void Vec_PtrShrink(Vec_Ptr_t *p, int nSizeNew)
Definition: vecPtr.h:528
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Fxu_MatrixComputeSinglesOne ( Fxu_Matrix p,
Fxu_Var pVar 
)

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

Synopsis [Adds the single-cube divisors associated with a new column.]

Description []

SideEffects []

SeeAlso []

Definition at line 184 of file fxuSingle.c.

185 {
186  Fxu_Lit * pLitV, * pLitH;
187  Fxu_Var * pVar2;
188  int Coin;
189  int WeightCur;
190 
191  // start collecting the affected vars
193  // go through all the literals of this variable
194  for ( pLitV = pVar->lLits.pHead; pLitV; pLitV = pLitV->pVNext )
195  // for this literal, go through all the horizontal literals
196  for ( pLitH = pLitV->pHPrev; pLitH; pLitH = pLitH->pHPrev )
197  {
198  // get another variable
199  pVar2 = pLitH->pVar;
200  // skip the var if it is already used
201  if ( pVar2->pOrder )
202  continue;
203  // skip the var if it belongs to the same node
204 // if ( pValue2Node[pVar->iVar] == pValue2Node[pVar2->iVar] )
205 // continue;
206  // collect the var
207  Fxu_MatrixRingVarsAdd( p, pVar2 );
208  }
209  // stop collecting the selected vars
211 
212  // iterate through the selected vars
213  Fxu_MatrixForEachVarInRing( p, pVar2 )
214  {
215  // count the coincidence
216  Coin = Fxu_SingleCountCoincidence( p, pVar2, pVar );
217  assert( Coin > 0 );
218  // get the new weight
219  WeightCur = Coin - 2;
220  // peformance fix (August 24, 2007)
221 // if ( WeightCur >= 0 )
222 // Fxu_MatrixAddSingle( p, pVar2, pVar, WeightCur );
223  if ( WeightCur >= p->nWeightLimit )
224  Fxu_MatrixAddSingle( p, pVar2, pVar, WeightCur );
225  }
226  // unmark the vars
228 }
Definition: fxuInt.h:213
Fxu_ListLit lLits
Definition: fxuInt.h:219
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Fxu_Lit * pHead
Definition: fxuInt.h:109
#define Fxu_MatrixForEachVarInRing(Matrix, Var)
Definition: fxuInt.h:407
int Fxu_SingleCountCoincidence(Fxu_Matrix *p, Fxu_Var *pVar1, Fxu_Var *pVar2)
Definition: fxuSingle.c:241
Fxu_Lit * pVNext
Definition: fxuInt.h:235
#define Fxu_MatrixRingVarsStart(Matrix)
Definition: fxuInt.h:386
void Fxu_MatrixRingVarsUnmark(Fxu_Matrix *p)
Definition: fxu.c:206
#define Fxu_MatrixRingVarsAdd(Matrix, Var)
Definition: fxuInt.h:395
void Fxu_MatrixAddSingle(Fxu_Matrix *p, Fxu_Var *pVar1, Fxu_Var *pVar2, int Weight)
Definition: fxuMatrix.c:274
Fxu_Var * pVar
Definition: fxuInt.h:231
Fxu_Var * pOrder
Definition: fxuInt.h:222
#define Fxu_MatrixRingVarsStop(Matrix)
Definition: fxuInt.h:389
#define assert(ex)
Definition: util_old.h:213
Definition: fxuInt.h:226
Fxu_Lit * pHPrev
Definition: fxuInt.h:232
void Fxu_MatrixDelDivisor ( Fxu_Matrix p,
Fxu_Double pDiv 
)

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

Synopsis [Deletes the divisor from the matrix.]

Description []

SideEffects []

SeeAlso []

Definition at line 233 of file fxuMatrix.c.

234 {
235  // delete divisor from the table
236  Fxu_ListTableDelDivisor( p, pDiv );
237  // recycle the divisor
238  MEM_FREE_FXU( p, Fxu_Double, 1, pDiv );
239 }
void Fxu_ListTableDelDivisor(Fxu_Matrix *p, Fxu_Double *pDiv)
Definition: fxuList.c:254
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define MEM_FREE_FXU(Manager, Type, Size, Pointer)
Definition: fxuInt.h:431
void Fxu_MatrixDelete ( Fxu_Matrix p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 96 of file fxuMatrix.c.

97 {
98  Fxu_HeapDoubleCheck( p->pHeapDouble );
99  Fxu_HeapDoubleStop( p->pHeapDouble );
100  Fxu_HeapSingleStop( p->pHeapSingle );
101 
102  // delete other things
103 #ifdef USE_SYSTEM_MEMORY_MANAGEMENT
104  // this code is not needed when the custom memory manager is used
105  {
106  Fxu_Cube * pCube, * pCube2;
107  Fxu_Var * pVar, * pVar2;
108  Fxu_Lit * pLit, * pLit2;
109  Fxu_Double * pDiv, * pDiv2;
110  Fxu_Single * pSingle, * pSingle2;
111  Fxu_Pair * pPair, * pPair2;
112  int i;
113  // delete the divisors
114  Fxu_MatrixForEachDoubleSafe( p, pDiv, pDiv2, i )
115  {
116  Fxu_DoubleForEachPairSafe( pDiv, pPair, pPair2 )
117  MEM_FREE_FXU( p, Fxu_Pair, 1, pPair );
118  MEM_FREE_FXU( p, Fxu_Double, 1, pDiv );
119  }
120  Fxu_MatrixForEachSingleSafe( p, pSingle, pSingle2 )
121  MEM_FREE_FXU( p, Fxu_Single, 1, pSingle );
122  // delete the entries
123  Fxu_MatrixForEachCube( p, pCube )
124  Fxu_CubeForEachLiteralSafe( pCube, pLit, pLit2 )
125  MEM_FREE_FXU( p, Fxu_Lit, 1, pLit );
126  // delete the cubes
127  Fxu_MatrixForEachCubeSafe( p, pCube, pCube2 )
128  MEM_FREE_FXU( p, Fxu_Cube, 1, pCube );
129  // delete the vars
130  Fxu_MatrixForEachVariableSafe( p, pVar, pVar2 )
131  MEM_FREE_FXU( p, Fxu_Var, 1, pVar );
132  }
133 #else
134  Extra_MmFixedStop( p->pMemMan );
135 #endif
136 
137  Vec_PtrFree( p->vPairs );
138  ABC_FREE( p->pppPairs );
139  ABC_FREE( p->ppPairs );
140 // ABC_FREE( p->pPairsTemp );
141  ABC_FREE( p->pTable );
142  ABC_FREE( p->ppVars );
143  ABC_FREE( p );
144 }
Definition: fxuInt.h:213
#define Fxu_MatrixForEachSingleSafe(Matrix, Single, Single2)
Definition: fxuInt.h:316
#define Fxu_MatrixForEachVariableSafe(Matrix, Var, Var2)
Definition: fxuInt.h:307
#define Fxu_MatrixForEachDoubleSafe(Matrix, Div, Div2, Index)
Definition: fxuInt.h:333
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Fxu_HeapDoubleCheck(Fxu_HeapDouble *p)
Definition: fxuHeapD.c:152
void Extra_MmFixedStop(Extra_MmFixed_t *p)
void Fxu_HeapSingleStop(Fxu_HeapSingle *p)
Definition: fxuHeapS.c:99
#define Fxu_CubeForEachLiteralSafe(Cube, Lit, Lit2)
Definition: fxuInt.h:342
void Fxu_HeapDoubleStop(Fxu_HeapDouble *p)
Definition: fxuHeapD.c:99
#define MEM_FREE_FXU(Manager, Type, Size, Pointer)
Definition: fxuInt.h:431
#define Fxu_DoubleForEachPairSafe(Div, Pair, Pair2)
Definition: fxuInt.h:361
#define Fxu_MatrixForEachCube(Matrix, Cube)
Definition: fxuInt.h:294
#define ABC_FREE(obj)
Definition: abc_global.h:232
Definition: fxuInt.h:226
#define Fxu_MatrixForEachCubeSafe(Matrix, Cube, Cube2)
Definition: fxuInt.h:298
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Fxu_MatrixDelLiteral ( Fxu_Matrix p,
Fxu_Lit pLit 
)

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

Synopsis [Deletes the literal fromthe matrix.]

Description []

SideEffects []

SeeAlso []

Definition at line 252 of file fxuMatrix.c.

253 {
254  // delete the literal
255  Fxu_ListCubeDelLiteral( pLit->pCube, pLit );
256  Fxu_ListVarDelLiteral( pLit->pVar, pLit );
257  MEM_FREE_FXU( p, Fxu_Lit, 1, pLit );
258  // increment the literal counter
259  p->nEntries--;
260 }
void Fxu_ListVarDelLiteral(Fxu_Var *pVar, Fxu_Lit *pLit)
Definition: fxuList.c:373
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Fxu_ListCubeDelLiteral(Fxu_Cube *pCube, Fxu_Lit *pLit)
Definition: fxuList.c:314
Fxu_Cube * pCube
Definition: fxuInt.h:230
#define MEM_FREE_FXU(Manager, Type, Size, Pointer)
Definition: fxuInt.h:431
Fxu_Var * pVar
Definition: fxuInt.h:231
Definition: fxuInt.h:226
void Fxu_MatrixPrint ( FILE *  pFile,
Fxu_Matrix p 
)

DECLARATIONS ///.

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

FileName [fxuPrint.c]

PackageName [MVSIS 2.0: Multi-valued logic synthesis system.]

Synopsis [Various printing procedures.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - February 1, 2003.]

Revision [

Id:
fxuPrint.c,v 1.0 2003/02/01 00:00:00 alanmi Exp

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 43 of file fxuPrint.c.

44 {
45  Fxu_Var * pVar;
46  Fxu_Cube * pCube;
47  Fxu_Double * pDiv;
48  Fxu_Single * pSingle;
49  Fxu_Lit * pLit;
50  Fxu_Pair * pPair;
51  int i, LastNum;
52  int fStdout;
53 
54  fStdout = 1;
55  if ( pFile == NULL )
56  {
57  pFile = fopen( "matrix.txt", "w" );
58  fStdout = 0;
59  }
60 
61  fprintf( pFile, "Matrix has %d vars, %d cubes, %d literals, %d divisors.\n",
62  p->lVars.nItems, p->lCubes.nItems, p->nEntries, p->nDivs );
63  fprintf( pFile, "Divisors selected so far: single = %d, double = %d.\n",
64  p->nDivs1, p->nDivs2 );
65  fprintf( pFile, "\n" );
66 
67  // print the numbers on top of the matrix
68  for ( i = 0; i < 12; i++ )
69  fprintf( pFile, " " );
71  fprintf( pFile, "%d", pVar->iVar % 10 );
72  fprintf( pFile, "\n" );
73 
74  // print the rows
75  Fxu_MatrixForEachCube( p, pCube )
76  {
77  fprintf( pFile, "%4d", pCube->iCube );
78  fprintf( pFile, " " );
79  fprintf( pFile, "%4d", pCube->pVar->iVar );
80  fprintf( pFile, " " );
81 
82  // print the literals
83  LastNum = -1;
84  Fxu_CubeForEachLiteral( pCube, pLit )
85  {
86  for ( i = LastNum + 1; i < pLit->pVar->iVar; i++ )
87  fprintf( pFile, "." );
88  fprintf( pFile, "1" );
89  LastNum = i;
90  }
91  for ( i = LastNum + 1; i < p->lVars.nItems; i++ )
92  fprintf( pFile, "." );
93  fprintf( pFile, "\n" );
94  }
95  fprintf( pFile, "\n" );
96 
97  // print the double-cube divisors
98  fprintf( pFile, "The double divisors are:\n" );
99  Fxu_MatrixForEachDouble( p, pDiv, i )
100  {
101  fprintf( pFile, "Divisor #%3d (lit=%d,%d) (w=%2d): ",
102  pDiv->Num, pDiv->lPairs.pHead->nLits1,
103  pDiv->lPairs.pHead->nLits2, pDiv->Weight );
104  Fxu_DoubleForEachPair( pDiv, pPair )
105  fprintf( pFile, " <%d, %d> (b=%d)",
106  pPair->pCube1->iCube, pPair->pCube2->iCube, pPair->nBase );
107  fprintf( pFile, "\n" );
108  }
109  fprintf( pFile, "\n" );
110 
111  // print the divisors associated with each cube
112  fprintf( pFile, "The cubes are:\n" );
113  Fxu_MatrixForEachCube( p, pCube )
114  {
115  fprintf( pFile, "Cube #%3d: ", pCube->iCube );
116  if ( pCube->pVar->ppPairs )
117  {
118  Fxu_CubeForEachPair( pCube, pPair, i )
119  fprintf( pFile, " <%d %d> (d=%d) (b=%d)",
120  pPair->iCube1, pPair->iCube2, pPair->pDiv->Num, pPair->nBase );
121  }
122  fprintf( pFile, "\n" );
123  }
124  fprintf( pFile, "\n" );
125 
126  // print the single-cube divisors
127  fprintf( pFile, "The single divisors are:\n" );
128  Fxu_MatrixForEachSingle( p, pSingle )
129  {
130  fprintf( pFile, "Single-cube divisor #%5d: Var1 = %4d. Var2 = %4d. Weight = %2d\n",
131  pSingle->Num, pSingle->pVar1->iVar, pSingle->pVar2->iVar, pSingle->Weight );
132  }
133  fprintf( pFile, "\n" );
134 
135 /*
136  {
137  int Index;
138  fprintf( pFile, "Distribution of divisors in the hash table:\n" );
139  for ( Index = 0; Index < p->nTableSize; Index++ )
140  fprintf( pFile, " %d", p->pTable[Index].nItems );
141  fprintf( pFile, "\n" );
142  }
143 */
144  if ( !fStdout )
145  fclose( pFile );
146 }
Definition: fxuInt.h:213
Fxu_Pair * pHead
Definition: fxuInt.h:117
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int iVar
Definition: fxuInt.h:215
Fxu_ListPair lPairs
Definition: fxuInt.h:260
#define Fxu_MatrixForEachSingle(Matrix, Single)
Definition: fxuInt.h:312
#define Fxu_MatrixForEachVariable(Matrix, Var)
Definition: fxuInt.h:303
#define Fxu_DoubleForEachPair(Div, Pair)
Definition: fxuInt.h:357
int Num
Definition: fxuInt.h:256
#define Fxu_CubeForEachLiteral(Cube, Lit)
Definition: fxuInt.h:338
int nLits2
Definition: fxuInt.h:242
int Weight
Definition: fxuInt.h:258
#define Fxu_MatrixForEachCube(Matrix, Cube)
Definition: fxuInt.h:294
Fxu_Var * pVar
Definition: fxuInt.h:231
int nLits1
Definition: fxuInt.h:241
Definition: fxuInt.h:226
#define Fxu_MatrixForEachDouble(Matrix, Div, Index)
Definition: fxuInt.h:330
#define Fxu_CubeForEachPair(pCube, pPair, i)
Definition: fxuInt.h:368
void Fxu_MatrixPrintDivisorProfile ( FILE *  pFile,
Fxu_Matrix p 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 159 of file fxuPrint.c.

160 {
161  Fxu_Double * pDiv;
162  int WeightMax;
163  int * pProfile;
164  int Counter1; // the number of -1 weight
165  int CounterL; // the number of less than -1 weight
166  int i;
167 
168  WeightMax = Fxu_HeapDoubleReadMaxWeight( p->pHeapDouble );
169  pProfile = ABC_ALLOC( int, (WeightMax + 1) );
170  memset( pProfile, 0, sizeof(int) * (WeightMax + 1) );
171 
172  Counter1 = 0;
173  CounterL = 0;
174  Fxu_MatrixForEachDouble( p, pDiv, i )
175  {
176  assert( pDiv->Weight <= WeightMax );
177  if ( pDiv->Weight == -1 )
178  Counter1++;
179  else if ( pDiv->Weight < 0 )
180  CounterL++;
181  else
182  pProfile[ pDiv->Weight ]++;
183  }
184 
185  fprintf( pFile, "The double divisors profile:\n" );
186  fprintf( pFile, "Weight < -1 divisors = %6d\n", CounterL );
187  fprintf( pFile, "Weight -1 divisors = %6d\n", Counter1 );
188  for ( i = 0; i <= WeightMax; i++ )
189  if ( pProfile[i] )
190  fprintf( pFile, "Weight %3d divisors = %6d\n", i, pProfile[i] );
191  fprintf( pFile, "End of divisor profile printout\n" );
192  ABC_FREE( pProfile );
193 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
int Fxu_HeapDoubleReadMaxWeight(Fxu_HeapDouble *p)
Definition: fxuHeapD.c:319
int Weight
Definition: fxuInt.h:258
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define assert(ex)
Definition: util_old.h:213
#define Fxu_MatrixForEachDouble(Matrix, Div, Index)
Definition: fxuInt.h:330
void Fxu_MatrixRingCubesUnmark ( Fxu_Matrix p)

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

Synopsis [Unmarks the cubes in the ring.]

Description []

SideEffects []

SeeAlso []

Definition at line 185 of file fxu.c.

186 {
187  Fxu_Cube * pCube, * pCube2;
188  // unmark the cubes
189  Fxu_MatrixForEachCubeInRingSafe( p, pCube, pCube2 )
190  pCube->pOrder = NULL;
192 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Fxu_MatrixForEachCubeInRingSafe(Matrix, Cube, Cube2)
Definition: fxuInt.h:402
#define Fxu_MatrixRingCubesReset(Matrix)
Definition: fxuInt.h:391
void Fxu_MatrixRingVarsUnmark ( Fxu_Matrix p)

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

Synopsis [Unmarks the vars in the ring.]

Description []

SideEffects []

SeeAlso []

Definition at line 206 of file fxu.c.

207 {
208  Fxu_Var * pVar, * pVar2;
209  // unmark the vars
210  Fxu_MatrixForEachVarInRingSafe( p, pVar, pVar2 )
211  pVar->pOrder = NULL;
213 }
Definition: fxuInt.h:213
#define Fxu_MatrixForEachVarInRingSafe(Matrix, Var, Var2)
Definition: fxuInt.h:412
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Fxu_MatrixRingVarsReset(Matrix)
Definition: fxuInt.h:392
char* Fxu_MemFetch ( Fxu_Matrix p,
int  nBytes 
)

FUNCTION DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 227 of file fxu.c.

228 {
229  s_MemoryTotal += nBytes;
230  if ( s_MemoryPeak < s_MemoryTotal )
232 // return ABC_ALLOC( char, nBytes );
233  return Extra_MmFixedEntryFetch( p->pMemMan );
234 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int s_MemoryPeak
Definition: fxu.c:34
char * Extra_MmFixedEntryFetch(Extra_MmFixed_t *p)
static int s_MemoryTotal
Definition: fxu.c:33
void Fxu_MemRecycle ( Fxu_Matrix p,
char *  pItem,
int  nBytes 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 247 of file fxu.c.

248 {
249  s_MemoryTotal -= nBytes;
250 // ABC_FREE( pItem );
251  Extra_MmFixedEntryRecycle( p->pMemMan, pItem );
252 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Extra_MmFixedEntryRecycle(Extra_MmFixed_t *p, char *pEntry)
static int s_MemoryTotal
Definition: fxu.c:33
void Fxu_PairAdd ( Fxu_Pair pPair)

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

Synopsis [Adds the pair to storage.]

Description []

SideEffects []

SeeAlso []

Definition at line 543 of file fxuPair.c.

544 {
545  Fxu_Var * pVar;
546 
547  pVar = pPair->pCube1->pVar;
548  assert( pVar == pPair->pCube2->pVar );
549 
550  pVar->ppPairs[pPair->iCube1][pPair->iCube2] = pPair;
551  pVar->ppPairs[pPair->iCube2][pPair->iCube1] = pPair;
552 }
Definition: fxuInt.h:213
int iCube1
Definition: fxuInt.h:247
Fxu_Cube * pCube1
Definition: fxuInt.h:245
Fxu_Var * pVar
Definition: fxuInt.h:205
Fxu_Cube * pCube2
Definition: fxuInt.h:246
Fxu_Pair *** ppPairs
Definition: fxuInt.h:218
#define assert(ex)
Definition: util_old.h:213
int iCube2
Definition: fxuInt.h:248
Fxu_Pair* Fxu_PairAlloc ( Fxu_Matrix p,
Fxu_Cube pCube1,
Fxu_Cube pCube2 
)

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

Synopsis [Adds the pair to storage.]

Description []

SideEffects []

SeeAlso []

Definition at line 519 of file fxuPair.c.

520 {
521  Fxu_Pair * pPair;
522  assert( pCube1->pVar == pCube2->pVar );
523  pPair = MEM_ALLOC_FXU( p, Fxu_Pair, 1 );
524  memset( pPair, 0, sizeof(Fxu_Pair) );
525  pPair->pCube1 = pCube1;
526  pPair->pCube2 = pCube2;
527  pPair->iCube1 = pCube1->iCube;
528  pPair->iCube2 = pCube2->iCube;
529  return pPair;
530 }
char * memset()
int iCube
Definition: fxuInt.h:203
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int iCube1
Definition: fxuInt.h:247
#define MEM_ALLOC_FXU(Manager, Type, Size)
Definition: fxuInt.h:429
Fxu_Cube * pCube1
Definition: fxuInt.h:245
Fxu_Var * pVar
Definition: fxuInt.h:205
Fxu_Cube * pCube2
Definition: fxuInt.h:246
#define assert(ex)
Definition: util_old.h:213
int iCube2
Definition: fxuInt.h:248
void Fxu_PairAllocStorage ( Fxu_Var pVar,
int  nCubes 
)

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

Synopsis [Allocates the storage for cubes pairs.]

Description []

SideEffects []

SeeAlso []

Definition at line 452 of file fxuPair.c.

453 {
454  int k;
455 // assert( pVar->nCubes == 0 );
456  pVar->nCubes = nCubes;
457  // allocate memory for all the pairs
458  pVar->ppPairs = ABC_ALLOC( Fxu_Pair **, nCubes );
459  pVar->ppPairs[0] = ABC_ALLOC( Fxu_Pair *, nCubes * nCubes );
460  memset( pVar->ppPairs[0], 0, sizeof(Fxu_Pair *) * nCubes * nCubes );
461  for ( k = 1; k < nCubes; k++ )
462  pVar->ppPairs[k] = pVar->ppPairs[k-1] + nCubes;
463 }
char * memset()
int nCubes
Definition: fxuInt.h:216
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Fxu_Pair *** ppPairs
Definition: fxuInt.h:218
void Fxu_PairCanonicize ( Fxu_Cube **  ppCube1,
Fxu_Cube **  ppCube2 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Find the canonical permutation of two cubes in the pair.]

Description []

SideEffects []

SeeAlso []

Definition at line 75 of file fxuPair.c.

76 {
77  Fxu_Lit * pLit1, * pLit2;
78  Fxu_Cube * pCubeTemp;
79 
80  // walk through the cubes to determine
81  // the one that has higher first variable
82  pLit1 = (*ppCube1)->lLits.pHead;
83  pLit2 = (*ppCube2)->lLits.pHead;
84  while ( 1 )
85  {
86  if ( pLit1->iVar == pLit2->iVar )
87  {
88  pLit1 = pLit1->pHNext;
89  pLit2 = pLit2->pHNext;
90  continue;
91  }
92  assert( pLit1 && pLit2 ); // this is true if the covers are SCC-free
93  if ( pLit1->iVar > pLit2->iVar )
94  { // swap the cubes
95  pCubeTemp = *ppCube1;
96  *ppCube1 = *ppCube2;
97  *ppCube2 = pCubeTemp;
98  }
99  break;
100  }
101 }
Fxu_Lit * pHNext
Definition: fxuInt.h:233
int iVar
Definition: fxuInt.h:228
#define assert(ex)
Definition: util_old.h:213
Definition: fxuInt.h:226
void Fxu_PairClearStorage ( Fxu_Cube pCube)

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

Synopsis [Clears all pairs associated with this cube.]

Description []

SideEffects []

SeeAlso []

Definition at line 476 of file fxuPair.c.

477 {
478  Fxu_Var * pVar;
479  int i;
480  pVar = pCube->pVar;
481  for ( i = 0; i < pVar->nCubes; i++ )
482  {
483  pVar->ppPairs[pCube->iCube][i] = NULL;
484  pVar->ppPairs[i][pCube->iCube] = NULL;
485  }
486 }
int nCubes
Definition: fxuInt.h:216
Definition: fxuInt.h:213
int iCube
Definition: fxuInt.h:203
Fxu_Var * pVar
Definition: fxuInt.h:205
Fxu_Pair *** ppPairs
Definition: fxuInt.h:218
int Fxu_PairCompare ( Fxu_Pair pPair1,
Fxu_Pair pPair2 
)

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

Synopsis [Compares the two pairs.]

Description [Returns 1 if the divisors represented by these pairs are equal.]

SideEffects []

SeeAlso []

Definition at line 236 of file fxuPair.c.

237 {
238  Fxu_Lit * pD1C1, * pD1C2;
239  Fxu_Lit * pD2C1, * pD2C2;
240  int TopVar1, TopVar2;
241  int Code;
242 
243  if ( pPair1->nLits1 != pPair2->nLits1 )
244  return 0;
245  if ( pPair1->nLits2 != pPair2->nLits2 )
246  return 0;
247 
248  pD1C1 = pPair1->pCube1->lLits.pHead;
249  pD1C2 = pPair1->pCube2->lLits.pHead;
250 
251  pD2C1 = pPair2->pCube1->lLits.pHead;
252  pD2C2 = pPair2->pCube2->lLits.pHead;
253 
254  Code = pD1C1? 8: 0;
255  Code |= pD1C2? 4: 0;
256  Code |= pD2C1? 2: 0;
257  Code |= pD2C2? 1: 0;
258  assert( Code == 15 );
259 
260  while ( 1 )
261  {
262  switch ( Code )
263  {
264  case 0: // -- -- NULL NULL NULL NULL
265  return 1;
266  case 1: // -- -1 NULL NULL NULL pD2C2
267  return 0;
268  case 2: // -- 1- NULL NULL pD2C1 NULL
269  return 0;
270  case 3: // -- 11 NULL NULL pD2C1 pD2C2
271  if ( pD2C1->iVar != pD2C2->iVar )
272  return 0;
273  pD2C1 = pD2C1->pHNext;
274  pD2C2 = pD2C2->pHNext;
275  break;
276  case 4: // -1 -- NULL pD1C2 NULL NULL
277  return 0;
278  case 5: // -1 -1 NULL pD1C2 NULL pD2C2
279  if ( pD1C2->iVar != pD2C2->iVar )
280  return 0;
281  pD1C2 = pD1C2->pHNext;
282  pD2C2 = pD2C2->pHNext;
283  break;
284  case 6: // -1 1- NULL pD1C2 pD2C1 NULL
285  return 0;
286  case 7: // -1 11 NULL pD1C2 pD2C1 pD2C2
287  TopVar2 = Fxu_Min( pD2C1->iVar, pD2C2->iVar );
288  if ( TopVar2 == pD1C2->iVar )
289  {
290  if ( pD2C1->iVar <= pD2C2->iVar )
291  return 0;
292  pD1C2 = pD1C2->pHNext;
293  pD2C2 = pD2C2->pHNext;
294  }
295  else if ( TopVar2 < pD1C2->iVar )
296  {
297  if ( pD2C1->iVar != pD2C2->iVar )
298  return 0;
299  pD2C1 = pD2C1->pHNext;
300  pD2C2 = pD2C2->pHNext;
301  }
302  else
303  return 0;
304  break;
305  case 8: // 1- -- pD1C1 NULL NULL NULL
306  return 0;
307  case 9: // 1- -1 pD1C1 NULL NULL pD2C2
308  return 0;
309  case 10: // 1- 1- pD1C1 NULL pD2C1 NULL
310  if ( pD1C1->iVar != pD2C1->iVar )
311  return 0;
312  pD1C1 = pD1C1->pHNext;
313  pD2C1 = pD2C1->pHNext;
314  break;
315  case 11: // 1- 11 pD1C1 NULL pD2C1 pD2C2
316  TopVar2 = Fxu_Min( pD2C1->iVar, pD2C2->iVar );
317  if ( TopVar2 == pD1C1->iVar )
318  {
319  if ( pD2C1->iVar >= pD2C2->iVar )
320  return 0;
321  pD1C1 = pD1C1->pHNext;
322  pD2C1 = pD2C1->pHNext;
323  }
324  else if ( TopVar2 < pD1C1->iVar )
325  {
326  if ( pD2C1->iVar != pD2C2->iVar )
327  return 0;
328  pD2C1 = pD2C1->pHNext;
329  pD2C2 = pD2C2->pHNext;
330  }
331  else
332  return 0;
333  break;
334  case 12: // 11 -- pD1C1 pD1C2 NULL NULL
335  if ( pD1C1->iVar != pD1C2->iVar )
336  return 0;
337  pD1C1 = pD1C1->pHNext;
338  pD1C2 = pD1C2->pHNext;
339  break;
340  case 13: // 11 -1 pD1C1 pD1C2 NULL pD2C2
341  TopVar1 = Fxu_Min( pD1C1->iVar, pD1C2->iVar );
342  if ( TopVar1 == pD2C2->iVar )
343  {
344  if ( pD1C1->iVar <= pD1C2->iVar )
345  return 0;
346  pD1C2 = pD1C2->pHNext;
347  pD2C2 = pD2C2->pHNext;
348  }
349  else if ( TopVar1 < pD2C2->iVar )
350  {
351  if ( pD1C1->iVar != pD1C2->iVar )
352  return 0;
353  pD1C1 = pD1C1->pHNext;
354  pD1C2 = pD1C2->pHNext;
355  }
356  else
357  return 0;
358  break;
359  case 14: // 11 1- pD1C1 pD1C2 pD2C1 NULL
360  TopVar1 = Fxu_Min( pD1C1->iVar, pD1C2->iVar );
361  if ( TopVar1 == pD2C1->iVar )
362  {
363  if ( pD1C1->iVar >= pD1C2->iVar )
364  return 0;
365  pD1C1 = pD1C1->pHNext;
366  pD2C1 = pD2C1->pHNext;
367  }
368  else if ( TopVar1 < pD2C1->iVar )
369  {
370  if ( pD1C1->iVar != pD1C2->iVar )
371  return 0;
372  pD1C1 = pD1C1->pHNext;
373  pD1C2 = pD1C2->pHNext;
374  }
375  else
376  return 0;
377  break;
378  case 15: // 11 11 pD1C1 pD1C2 pD2C1 pD2C2
379  TopVar1 = Fxu_Min( pD1C1->iVar, pD1C2->iVar );
380  TopVar2 = Fxu_Min( pD2C1->iVar, pD2C2->iVar );
381  if ( TopVar1 == TopVar2 )
382  {
383  if ( pD1C1->iVar == pD1C2->iVar )
384  {
385  if ( pD2C1->iVar != pD2C2->iVar )
386  return 0;
387  pD1C1 = pD1C1->pHNext;
388  pD1C2 = pD1C2->pHNext;
389  pD2C1 = pD2C1->pHNext;
390  pD2C2 = pD2C2->pHNext;
391  }
392  else
393  {
394  if ( pD2C1->iVar == pD2C2->iVar )
395  return 0;
396  if ( pD1C1->iVar < pD1C2->iVar )
397  {
398  if ( pD2C1->iVar > pD2C2->iVar )
399  return 0;
400  pD1C1 = pD1C1->pHNext;
401  pD2C1 = pD2C1->pHNext;
402  }
403  else
404  {
405  if ( pD2C1->iVar < pD2C2->iVar )
406  return 0;
407  pD1C2 = pD1C2->pHNext;
408  pD2C2 = pD2C2->pHNext;
409  }
410  }
411  }
412  else if ( TopVar1 < TopVar2 )
413  {
414  if ( pD1C1->iVar != pD1C2->iVar )
415  return 0;
416  pD1C1 = pD1C1->pHNext;
417  pD1C2 = pD1C2->pHNext;
418  }
419  else
420  {
421  if ( pD2C1->iVar != pD2C2->iVar )
422  return 0;
423  pD2C1 = pD2C1->pHNext;
424  pD2C2 = pD2C2->pHNext;
425  }
426  break;
427  default:
428  assert( 0 );
429  break;
430  }
431 
432  Code = pD1C1? 8: 0;
433  Code |= pD1C2? 4: 0;
434  Code |= pD2C1? 2: 0;
435  Code |= pD2C2? 1: 0;
436  }
437  return 1;
438 }
Fxu_Lit * pHead
Definition: fxuInt.h:109
Fxu_Lit * pHNext
Definition: fxuInt.h:233
Fxu_Cube * pCube1
Definition: fxuInt.h:245
#define Code
Definition: deflate.h:76
Fxu_ListLit lLits
Definition: fxuInt.h:206
int nLits2
Definition: fxuInt.h:242
int iVar
Definition: fxuInt.h:228
Fxu_Cube * pCube2
Definition: fxuInt.h:246
#define Fxu_Min(a, b)
MACRO DEFINITIONS ///.
Definition: fxuInt.h:283
#define assert(ex)
Definition: util_old.h:213
int nLits1
Definition: fxuInt.h:241
Definition: fxuInt.h:226
void Fxu_PairFreeStorage ( Fxu_Var pVar)

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

Synopsis [Clears all pairs associated with this cube.]

Description []

SideEffects []

SeeAlso []

Definition at line 499 of file fxuPair.c.

500 {
501  if ( pVar->ppPairs )
502  {
503  ABC_FREE( pVar->ppPairs[0] );
504  ABC_FREE( pVar->ppPairs );
505  }
506 }
#define ABC_FREE(obj)
Definition: abc_global.h:232
Fxu_Pair *** ppPairs
Definition: fxuInt.h:218
unsigned Fxu_PairHashKey ( Fxu_Matrix p,
Fxu_Cube pCube1,
Fxu_Cube pCube2,
int *  pnBase,
int *  pnLits1,
int *  pnLits2 
)

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

Synopsis [Computes the hash key of the divisor represented by the pair of cubes.]

Description [Goes through the variables in both cubes. Skips the identical ones (this corresponds to making the cubes cube-free). Computes the hash value of the cubes. Assigns the number of literals in the base and in the cubes without base.]

SideEffects []

SeeAlso []

Definition at line 164 of file fxuPair.c.

166 {
167  int Offset1 = 100, Offset2 = 200;
168  int nBase, nLits1, nLits2;
169  Fxu_Lit * pLit1, * pLit2;
170  unsigned Key;
171 
172  // compute the hash key
173  Key = 0;
174  nLits1 = 0;
175  nLits2 = 0;
176  nBase = 0;
177  pLit1 = pCube1->lLits.pHead;
178  pLit2 = pCube2->lLits.pHead;
179  while ( 1 )
180  {
181  if ( pLit1 && pLit2 )
182  {
183  if ( pLit1->iVar == pLit2->iVar )
184  { // ensure cube-free
185  pLit1 = pLit1->pHNext;
186  pLit2 = pLit2->pHNext;
187  // add this literal to the base
188  nBase++;
189  }
190  else if ( pLit1->iVar < pLit2->iVar )
191  {
192  Key ^= s_Primes[Offset1+nLits1] * pLit1->iVar;
193  pLit1 = pLit1->pHNext;
194  nLits1++;
195  }
196  else
197  {
198  Key ^= s_Primes[Offset2+nLits2] * pLit2->iVar;
199  pLit2 = pLit2->pHNext;
200  nLits2++;
201  }
202  }
203  else if ( pLit1 && !pLit2 )
204  {
205  Key ^= s_Primes[Offset1+nLits1] * pLit1->iVar;
206  pLit1 = pLit1->pHNext;
207  nLits1++;
208  }
209  else if ( !pLit1 && pLit2 )
210  {
211  Key ^= s_Primes[Offset2+nLits2] * pLit2->iVar;
212  pLit2 = pLit2->pHNext;
213  nLits2++;
214  }
215  else
216  break;
217  }
218  *pnBase = nBase;
219  *pnLits1 = nLits1;
220  *pnLits2 = nLits2;
221  return Key;
222 }
Fxu_Lit * pHead
Definition: fxuInt.h:109
Fxu_Lit * pHNext
Definition: fxuInt.h:233
static int s_Primes[MAX_PRIMES]
Definition: fxuPair.c:30
Fxu_ListLit lLits
Definition: fxuInt.h:206
int iVar
Definition: fxuInt.h:228
Definition: fxuInt.h:226
unsigned Fxu_PairHashKeyArray ( Fxu_Matrix p,
int  piVarsC1[],
int  piVarsC2[],
int  nVarsC1,
int  nVarsC2 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 137 of file fxuPair.c.

138 {
139  int Offset1 = 100, Offset2 = 200, i;
140  unsigned Key;
141  // compute the hash key
142  Key = 0;
143  for ( i = 0; i < nVarsC1; i++ )
144  Key ^= s_Primes[Offset1+i] * piVarsC1[i];
145  for ( i = 0; i < nVarsC2; i++ )
146  Key ^= s_Primes[Offset2+i] * piVarsC2[i];
147  return Key;
148 }
static int s_Primes[MAX_PRIMES]
Definition: fxuPair.c:30
unsigned Fxu_PairHashKeyMv ( Fxu_Matrix p,
Fxu_Cube pCube1,
Fxu_Cube pCube2,
int *  pnBase,
int *  pnLits1,
int *  pnLits2 
)
int Fxu_Select ( Fxu_Matrix p,
Fxu_Single **  ppSingle,
Fxu_Double **  ppDouble 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Selects the best pair (Single,Double) and returns their weight.]

Description []

SideEffects []

SeeAlso []

Definition at line 57 of file fxuSelect.c.

58 {
59  // the top entries
60  Fxu_Single * pSingles[MAX_SIZE_LOOKAHEAD] = {0};
61  Fxu_Double * pDoubles[MAX_SIZE_LOOKAHEAD] = {0};
62  // the complements
63  Fxu_Double * pSCompl[MAX_SIZE_LOOKAHEAD] = {0};
64  Fxu_Single * pDComplS[MAX_SIZE_LOOKAHEAD] = {0};
65  Fxu_Double * pDComplD[MAX_SIZE_LOOKAHEAD] = {0};
66  Fxu_Pair * pPair;
67  int nSingles;
68  int nDoubles;
69  int i;
70  int WeightBest;
71  int WeightCur;
72  int iNum, fBestS;
73 
74  // collect the top entries from the queues
75  for ( nSingles = 0; nSingles < MAX_SIZE_LOOKAHEAD; nSingles++ )
76  {
77  pSingles[nSingles] = Fxu_HeapSingleGetMax( p->pHeapSingle );
78  if ( pSingles[nSingles] == NULL )
79  break;
80  }
81  // put them back into the queue
82  for ( i = 0; i < nSingles; i++ )
83  if ( pSingles[i] )
84  Fxu_HeapSingleInsert( p->pHeapSingle, pSingles[i] );
85 
86  // the same for doubles
87  // collect the top entries from the queues
88  for ( nDoubles = 0; nDoubles < MAX_SIZE_LOOKAHEAD; nDoubles++ )
89  {
90  pDoubles[nDoubles] = Fxu_HeapDoubleGetMax( p->pHeapDouble );
91  if ( pDoubles[nDoubles] == NULL )
92  break;
93  }
94  // put them back into the queue
95  for ( i = 0; i < nDoubles; i++ )
96  if ( pDoubles[i] )
97  Fxu_HeapDoubleInsert( p->pHeapDouble, pDoubles[i] );
98 
99  // for each single, find the complement double (if any)
100  for ( i = 0; i < nSingles; i++ )
101  if ( pSingles[i] )
102  pSCompl[i] = Fxu_MatrixFindComplementSingle( p, pSingles[i] );
103 
104  // for each double, find the complement single or double (if any)
105  for ( i = 0; i < nDoubles; i++ )
106  if ( pDoubles[i] )
107  {
108  pPair = pDoubles[i]->lPairs.pHead;
109  if ( pPair->nLits1 == 1 && pPair->nLits2 == 1 )
110  {
111  pDComplS[i] = Fxu_MatrixFindComplementDouble2( p, pDoubles[i] );
112  pDComplD[i] = NULL;
113  }
114 // else if ( pPair->nLits1 == 2 && pPair->nLits2 == 2 )
115 // {
116 // pDComplS[i] = NULL;
117 // pDComplD[i] = Fxu_MatrixFindComplementDouble4( p, pDoubles[i] );
118 // }
119  else
120  {
121  pDComplS[i] = NULL;
122  pDComplD[i] = NULL;
123  }
124  }
125 
126  // select the best pair
127  WeightBest = -1;
128  for ( i = 0; i < nSingles; i++ )
129  {
130  WeightCur = pSingles[i]->Weight;
131  if ( pSCompl[i] )
132  {
133  // add the weight of the double
134  WeightCur += pSCompl[i]->Weight;
135  // there is no need to implement this double, so...
136  pPair = pSCompl[i]->lPairs.pHead;
137  WeightCur += pPair->nLits1 + pPair->nLits2;
138  }
139  if ( WeightBest < WeightCur )
140  {
141  WeightBest = WeightCur;
142  *ppSingle = pSingles[i];
143  *ppDouble = pSCompl[i];
144  fBestS = 1;
145  iNum = i;
146  }
147  }
148  for ( i = 0; i < nDoubles; i++ )
149  {
150  WeightCur = pDoubles[i]->Weight;
151  if ( pDComplS[i] )
152  {
153  // add the weight of the single
154  WeightCur += pDComplS[i]->Weight;
155  // there is no need to implement this double, so...
156  pPair = pDoubles[i]->lPairs.pHead;
157  WeightCur += pPair->nLits1 + pPair->nLits2;
158  }
159  if ( WeightBest < WeightCur )
160  {
161  WeightBest = WeightCur;
162  *ppSingle = pDComplS[i];
163  *ppDouble = pDoubles[i];
164  fBestS = 0;
165  iNum = i;
166  }
167  }
168 /*
169  // print the statistics
170  printf( "\n" );
171  for ( i = 0; i < nSingles; i++ )
172  {
173  printf( "Single #%d: Weight = %3d. ", i, pSingles[i]->Weight );
174  printf( "Compl: " );
175  if ( pSCompl[i] == NULL )
176  printf( "None." );
177  else
178  printf( "D Weight = %3d Sum = %3d",
179  pSCompl[i]->Weight, pSCompl[i]->Weight + pSingles[i]->Weight );
180  printf( "\n" );
181  }
182  printf( "\n" );
183  for ( i = 0; i < nDoubles; i++ )
184  {
185  printf( "Double #%d: Weight = %3d. ", i, pDoubles[i]->Weight );
186  printf( "Compl: " );
187  if ( pDComplS[i] == NULL && pDComplD[i] == NULL )
188  printf( "None." );
189  else if ( pDComplS[i] )
190  printf( "S Weight = %3d Sum = %3d",
191  pDComplS[i]->Weight, pDComplS[i]->Weight + pDoubles[i]->Weight );
192  else if ( pDComplD[i] )
193  printf( "D Weight = %3d Sum = %3d",
194  pDComplD[i]->Weight, pDComplD[i]->Weight + pDoubles[i]->Weight );
195  printf( "\n" );
196  }
197  if ( WeightBest == -1 )
198  printf( "Selected NONE\n" );
199  else
200  {
201  printf( "Selected = %s. ", fBestS? "S": "D" );
202  printf( "Number = %d. ", iNum );
203  printf( "Weight = %d.\n", WeightBest );
204  }
205  printf( "\n" );
206 */
207  return WeightBest;
208 }
void Fxu_HeapSingleInsert(Fxu_HeapSingle *p, Fxu_Single *pSingle)
Definition: fxuHeapS.c:204
Fxu_Pair * pHead
Definition: fxuInt.h:117
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Fxu_Single * Fxu_HeapSingleGetMax(Fxu_HeapSingle *p)
Definition: fxuHeapS.c:293
Fxu_ListPair lPairs
Definition: fxuInt.h:260
Fxu_Double * Fxu_HeapDoubleGetMax(Fxu_HeapDouble *p)
Definition: fxuHeapD.c:291
static Fxu_Single * Fxu_MatrixFindComplementDouble2(Fxu_Matrix *p, Fxu_Double *pDouble)
Definition: fxuSelect.c:249
#define MAX_SIZE_LOOKAHEAD
DECLARATIONS ///.
Definition: fxuSelect.c:28
int nLits2
Definition: fxuInt.h:242
static Fxu_Double * Fxu_MatrixFindComplementSingle(Fxu_Matrix *p, Fxu_Single *pSingle)
Definition: fxuSelect.c:222
int Weight
Definition: fxuInt.h:258
int Weight
Definition: fxuInt.h:271
void Fxu_HeapDoubleInsert(Fxu_HeapDouble *p, Fxu_Double *pDiv)
Definition: fxuHeapD.c:201
int nLits1
Definition: fxuInt.h:241
int Fxu_SelectSCD ( Fxu_Matrix p,
int  WeightLimit,
Fxu_Var **  ppVar1,
Fxu_Var **  ppVar2 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 525 of file fxuSelect.c.

526 {
527 // int * pValue2Node = p->pValue2Node;
528  Fxu_Var * pVar1;
529  Fxu_Var * pVar2, * pVarTemp;
530  Fxu_Lit * pLitV, * pLitH;
531  int Coin;
532  int CounterAll;
533  int CounterTest;
534  int WeightCur;
535  int WeightBest;
536 
537  CounterAll = 0;
538  CounterTest = 0;
539 
540  WeightBest = -10;
541 
542  // iterate through the columns in the matrix
543  Fxu_MatrixForEachVariable( p, pVar1 )
544  {
545  // start collecting the affected vars
547 
548  // go through all the literals of this variable
549  for ( pLitV = pVar1->lLits.pHead; pLitV; pLitV = pLitV->pVNext )
550  {
551  // for this literal, go through all the horizontal literals
552  for ( pLitH = pLitV->pHNext; pLitH; pLitH = pLitH->pHNext )
553  {
554  // get another variable
555  pVar2 = pLitH->pVar;
556  CounterAll++;
557  // skip the var if it is already used
558  if ( pVar2->pOrder )
559  continue;
560  // skip the var if it belongs to the same node
561 // if ( pValue2Node[pVar1->iVar] == pValue2Node[pVar2->iVar] )
562 // continue;
563  // collect the var
564  Fxu_MatrixRingVarsAdd( p, pVar2 );
565  }
566  }
567  // stop collecting the selected vars
569 
570  // iterate through the selected vars
571  Fxu_MatrixForEachVarInRing( p, pVar2 )
572  {
573  CounterTest++;
574 
575  // count the coincidence
576  Coin = Fxu_SingleCountCoincidence( p, pVar1, pVar2 );
577  assert( Coin > 0 );
578 
579  // get the new weight
580  WeightCur = Coin - 2;
581 
582  // compare the weights
583  if ( WeightBest < WeightCur )
584  {
585  WeightBest = WeightCur;
586  *ppVar1 = pVar1;
587  *ppVar2 = pVar2;
588  }
589  }
590  // unmark the vars
591  Fxu_MatrixForEachVarInRingSafe( p, pVar2, pVarTemp )
592  pVar2->pOrder = NULL;
594  }
595 
596 // if ( WeightBest == WeightLimit )
597 // return -1;
598  return WeightBest;
599 }
Definition: fxuInt.h:213
Fxu_ListLit lLits
Definition: fxuInt.h:219
#define Fxu_MatrixForEachVarInRingSafe(Matrix, Var, Var2)
Definition: fxuInt.h:412
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Fxu_MatrixRingVarsReset(Matrix)
Definition: fxuInt.h:392
Fxu_Lit * pHead
Definition: fxuInt.h:109
#define Fxu_MatrixForEachVarInRing(Matrix, Var)
Definition: fxuInt.h:407
Fxu_Lit * pHNext
Definition: fxuInt.h:233
Fxu_Lit * pVNext
Definition: fxuInt.h:235
#define Fxu_MatrixForEachVariable(Matrix, Var)
Definition: fxuInt.h:303
#define Fxu_MatrixRingVarsStart(Matrix)
Definition: fxuInt.h:386
#define Fxu_MatrixRingVarsAdd(Matrix, Var)
Definition: fxuInt.h:395
int Fxu_SingleCountCoincidence(Fxu_Matrix *p, Fxu_Var *pVar1, Fxu_Var *pVar2)
Definition: fxuSingle.c:241
Fxu_Var * pVar
Definition: fxuInt.h:231
Fxu_Var * pOrder
Definition: fxuInt.h:222
#define Fxu_MatrixRingVarsStop(Matrix)
Definition: fxuInt.h:389
#define assert(ex)
Definition: util_old.h:213
Definition: fxuInt.h:226
int Fxu_SingleCountCoincidence ( Fxu_Matrix p,
Fxu_Var pVar1,
Fxu_Var pVar2 
)

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

Synopsis [Computes the coincidence count of two columns.]

Description []

SideEffects []

SeeAlso []

Definition at line 241 of file fxuSingle.c.

242 {
243  Fxu_Lit * pLit1, * pLit2;
244  int Result;
245 
246  // compute the coincidence count
247  Result = 0;
248  pLit1 = pVar1->lLits.pHead;
249  pLit2 = pVar2->lLits.pHead;
250  while ( 1 )
251  {
252  if ( pLit1 && pLit2 )
253  {
254  if ( pLit1->pCube->pVar->iVar == pLit2->pCube->pVar->iVar )
255  { // the variables are the same
256  if ( pLit1->iCube == pLit2->iCube )
257  { // the literals are the same
258  pLit1 = pLit1->pVNext;
259  pLit2 = pLit2->pVNext;
260  // add this literal to the coincidence
261  Result++;
262  }
263  else if ( pLit1->iCube < pLit2->iCube )
264  pLit1 = pLit1->pVNext;
265  else
266  pLit2 = pLit2->pVNext;
267  }
268  else if ( pLit1->pCube->pVar->iVar < pLit2->pCube->pVar->iVar )
269  pLit1 = pLit1->pVNext;
270  else
271  pLit2 = pLit2->pVNext;
272  }
273  else if ( pLit1 && !pLit2 )
274  pLit1 = pLit1->pVNext;
275  else if ( !pLit1 && pLit2 )
276  pLit2 = pLit2->pVNext;
277  else
278  break;
279  }
280  return Result;
281 }
Fxu_ListLit lLits
Definition: fxuInt.h:219
int iVar
Definition: fxuInt.h:215
Fxu_Lit * pHead
Definition: fxuInt.h:109
int iCube
Definition: fxuInt.h:229
Fxu_Lit * pVNext
Definition: fxuInt.h:235
Fxu_Var * pVar
Definition: fxuInt.h:205
Fxu_Cube * pCube
Definition: fxuInt.h:230
Definition: fxuInt.h:226
void Fxu_Update ( Fxu_Matrix p,
Fxu_Single pSingle,
Fxu_Double pDouble 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Updates the matrix after selecting two divisors.]

Description []

SideEffects []

SeeAlso []

Definition at line 57 of file fxuUpdate.c.

58 {
59  Fxu_Cube * pCube, * pCubeNew;
60  Fxu_Var * pVarC, * pVarD;
61  Fxu_Var * pVar1, * pVar2;
62 
63  // consider trivial cases
64  if ( pSingle == NULL )
65  {
66  assert( pDouble->Weight == Fxu_HeapDoubleReadMaxWeight( p->pHeapDouble ) );
68  return;
69  }
70  if ( pDouble == NULL )
71  {
72  assert( pSingle->Weight == Fxu_HeapSingleReadMaxWeight( p->pHeapSingle ) );
74  return;
75  }
76 
77  // get the variables of the single
78  pVar1 = pSingle->pVar1;
79  pVar2 = pSingle->pVar2;
80 
81  // remove the best double from the heap
82  Fxu_HeapDoubleDelete( p->pHeapDouble, pDouble );
83  // remove the best divisor from the table
84  Fxu_ListTableDelDivisor( p, pDouble );
85 
86  // create two new columns (vars)
87  Fxu_UpdateCreateNewVars( p, &pVarC, &pVarD, 1 );
88  // create one new row (cube)
89  pCubeNew = Fxu_MatrixAddCube( p, pVarD, 0 );
90  pCubeNew->pFirst = pCubeNew;
91  // set the first cube of the positive var
92  pVarD->pFirst = pCubeNew;
93 
94  // start collecting the affected vars and cubes
97  // add the vars
98  Fxu_MatrixRingVarsAdd( p, pVar1 );
99  Fxu_MatrixRingVarsAdd( p, pVar2 );
100  // remove the literals and collect the affected cubes
101  // remove the divisors associated with this cube
102  // add to the affected cube the literal corresponding to the new column
103  Fxu_UpdateMatrixSingleClean( p, pVar1, pVar2, pVarD );
104  // replace each two cubes of the pair by one new cube
105  // the new cube contains the base and the new literal
106  Fxu_UpdateDoublePairs( p, pDouble, pVarC );
107  // stop collecting the affected vars and cubes
110 
111  // add the literals to the new cube
112  assert( pVar1->iVar < pVar2->iVar );
113  assert( Fxu_SingleCountCoincidence( p, pVar1, pVar2 ) == 0 );
114  Fxu_MatrixAddLiteral( p, pCubeNew, pVar1 );
115  Fxu_MatrixAddLiteral( p, pCubeNew, pVar2 );
116 
117  // create new doubles; we cannot add them in the same loop
118  // because we first have to create *all* new cubes for each node
120  Fxu_UpdateAddNewDoubles( p, pCube );
121  // update the singles after removing some literals
123 
124  // undo the temporary rings with cubes and vars
127  // we should undo the rings before creating new singles
128 
129  // create new singles
130  Fxu_UpdateAddNewSingles( p, pVarC );
131  Fxu_UpdateAddNewSingles( p, pVarD );
132 
133  // recycle the divisor
134  MEM_FREE_FXU( p, Fxu_Double, 1, pDouble );
135  p->nDivs3++;
136 }
Definition: fxuInt.h:213
void Fxu_UpdateSingle(Fxu_Matrix *p)
Definition: fxuUpdate.c:149
static void Fxu_UpdateCleanOldSingles(Fxu_Matrix *p)
Definition: fxuUpdate.c:759
static void Fxu_UpdateAddNewSingles(Fxu_Matrix *p, Fxu_Var *pVar)
Definition: fxuUpdate.c:800
static void Fxu_UpdateCreateNewVars(Fxu_Matrix *p, Fxu_Var **ppVarC, Fxu_Var **ppVarD, int nCubes)
Definition: fxuUpdate.c:638
void Fxu_ListTableDelDivisor(Fxu_Matrix *p, Fxu_Double *pDiv)
Definition: fxuList.c:254
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int iVar
Definition: fxuInt.h:215
void Fxu_HeapDoubleDelete(Fxu_HeapDouble *p, Fxu_Double *pDiv)
Definition: fxuHeapD.c:250
Fxu_Var * pVar2
Definition: fxuInt.h:273
void Fxu_UpdateDouble(Fxu_Matrix *p)
Definition: fxuUpdate.c:219
static void Fxu_UpdateMatrixSingleClean(Fxu_Matrix *p, Fxu_Var *pVar1, Fxu_Var *pVar2, Fxu_Var *pVarNew)
Definition: fxuUpdate.c:494
int Fxu_HeapDoubleReadMaxWeight(Fxu_HeapDouble *p)
Definition: fxuHeapD.c:319
void Fxu_MatrixAddLiteral(Fxu_Matrix *p, Fxu_Cube *pCube, Fxu_Var *pVar)
Definition: fxuMatrix.c:205
#define Fxu_MatrixRingVarsStart(Matrix)
Definition: fxuInt.h:386
#define Fxu_MatrixRingCubesStop(Matrix)
Definition: fxuInt.h:388
#define Fxu_MatrixRingCubesStart(Matrix)
Definition: fxuInt.h:385
Fxu_Cube * Fxu_MatrixAddCube(Fxu_Matrix *p, Fxu_Var *pVar, int iCube)
Definition: fxuMatrix.c:183
Fxu_Cube * pFirst
Definition: fxuInt.h:217
void Fxu_MatrixRingVarsUnmark(Fxu_Matrix *p)
Definition: fxu.c:206
#define Fxu_MatrixRingVarsAdd(Matrix, Var)
Definition: fxuInt.h:395
#define Fxu_MatrixForEachCubeInRing(Matrix, Cube)
Definition: fxuInt.h:397
Fxu_Cube * pFirst
Definition: fxuInt.h:204
#define MEM_FREE_FXU(Manager, Type, Size, Pointer)
Definition: fxuInt.h:431
int Fxu_SingleCountCoincidence(Fxu_Matrix *p, Fxu_Var *pVar1, Fxu_Var *pVar2)
Definition: fxuSingle.c:241
static ABC_NAMESPACE_IMPL_START void Fxu_UpdateDoublePairs(Fxu_Matrix *p, Fxu_Double *pDouble, Fxu_Var *pVar)
DECLARATIONS ///.
Definition: fxuUpdate.c:285
Fxu_Var * pVar1
Definition: fxuInt.h:272
int Weight
Definition: fxuInt.h:258
int Weight
Definition: fxuInt.h:271
int Fxu_HeapSingleReadMaxWeight(Fxu_HeapSingle *p)
Definition: fxuHeapS.c:321
static void Fxu_UpdateAddNewDoubles(Fxu_Matrix *p, Fxu_Cube *pCube)
Definition: fxuUpdate.c:724
#define Fxu_MatrixRingVarsStop(Matrix)
Definition: fxuInt.h:389
#define assert(ex)
Definition: util_old.h:213
void Fxu_MatrixRingCubesUnmark(Fxu_Matrix *p)
Definition: fxu.c:185
void Fxu_UpdateDouble ( Fxu_Matrix p)

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

Synopsis [Updates the matrix after accepting a double cube divisor.]

Description []

SideEffects []

SeeAlso []

Definition at line 219 of file fxuUpdate.c.

220 {
221  Fxu_Double * pDiv;
222  Fxu_Cube * pCube, * pCubeNew1, * pCubeNew2;
223  Fxu_Var * pVarC, * pVarD;
224 
225  // remove the best divisor from the heap
226  pDiv = Fxu_HeapDoubleGetMax( p->pHeapDouble );
227  // remove the best divisor from the table
228  Fxu_ListTableDelDivisor( p, pDiv );
229 
230  // create two new columns (vars)
231  Fxu_UpdateCreateNewVars( p, &pVarC, &pVarD, 2 );
232  // create two new rows (cubes)
233  pCubeNew1 = Fxu_MatrixAddCube( p, pVarD, 0 );
234  pCubeNew1->pFirst = pCubeNew1;
235  pCubeNew2 = Fxu_MatrixAddCube( p, pVarD, 1 );
236  pCubeNew2->pFirst = pCubeNew1;
237  // set the first cube
238  pVarD->pFirst = pCubeNew1;
239 
240  // add the literals to the new cubes
241  Fxu_UpdateMatrixDoubleCreateCubes( p, pCubeNew1, pCubeNew2, pDiv );
242 
243  // start collecting the affected cubes and vars
246  // replace each two cubes of the pair by one new cube
247  // the new cube contains the base and the new literal
248  Fxu_UpdateDoublePairs( p, pDiv, pVarD );
249  // stop collecting the affected cubes and vars
252 
253  // create new doubles; we cannot add them in the same loop
254  // because we first have to create *all* new cubes for each node
256  Fxu_UpdateAddNewDoubles( p, pCube );
257  // update the singles after removing some literals
259 
260  // undo the temporary rings with cubes and vars
263  // we should undo the rings before creating new singles
264 
265  // create new singles
266  Fxu_UpdateAddNewSingles( p, pVarC );
267  Fxu_UpdateAddNewSingles( p, pVarD );
268 
269  // recycle the divisor
270  MEM_FREE_FXU( p, Fxu_Double, 1, pDiv );
271  p->nDivs2++;
272 }
Definition: fxuInt.h:213
static void Fxu_UpdateCleanOldSingles(Fxu_Matrix *p)
Definition: fxuUpdate.c:759
static void Fxu_UpdateAddNewSingles(Fxu_Matrix *p, Fxu_Var *pVar)
Definition: fxuUpdate.c:800
static void Fxu_UpdateCreateNewVars(Fxu_Matrix *p, Fxu_Var **ppVarC, Fxu_Var **ppVarD, int nCubes)
Definition: fxuUpdate.c:638
void Fxu_ListTableDelDivisor(Fxu_Matrix *p, Fxu_Double *pDiv)
Definition: fxuList.c:254
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Fxu_Double * Fxu_HeapDoubleGetMax(Fxu_HeapDouble *p)
Definition: fxuHeapD.c:291
static void Fxu_UpdateMatrixDoubleCreateCubes(Fxu_Matrix *p, Fxu_Cube *pCube1, Fxu_Cube *pCube2, Fxu_Double *pDiv)
Definition: fxuUpdate.c:334
#define Fxu_MatrixRingVarsStart(Matrix)
Definition: fxuInt.h:386
#define Fxu_MatrixRingCubesStop(Matrix)
Definition: fxuInt.h:388
#define Fxu_MatrixRingCubesStart(Matrix)
Definition: fxuInt.h:385
Fxu_Cube * Fxu_MatrixAddCube(Fxu_Matrix *p, Fxu_Var *pVar, int iCube)
Definition: fxuMatrix.c:183
Fxu_Cube * pFirst
Definition: fxuInt.h:217
void Fxu_MatrixRingVarsUnmark(Fxu_Matrix *p)
Definition: fxu.c:206
#define Fxu_MatrixForEachCubeInRing(Matrix, Cube)
Definition: fxuInt.h:397
Fxu_Cube * pFirst
Definition: fxuInt.h:204
#define MEM_FREE_FXU(Manager, Type, Size, Pointer)
Definition: fxuInt.h:431
static ABC_NAMESPACE_IMPL_START void Fxu_UpdateDoublePairs(Fxu_Matrix *p, Fxu_Double *pDouble, Fxu_Var *pVar)
DECLARATIONS ///.
Definition: fxuUpdate.c:285
static void Fxu_UpdateAddNewDoubles(Fxu_Matrix *p, Fxu_Cube *pCube)
Definition: fxuUpdate.c:724
#define Fxu_MatrixRingVarsStop(Matrix)
Definition: fxuInt.h:389
void Fxu_MatrixRingCubesUnmark(Fxu_Matrix *p)
Definition: fxu.c:185
void Fxu_UpdateSingle ( Fxu_Matrix p)

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

Synopsis [Updates after accepting single cube divisor.]

Description []

SideEffects []

SeeAlso []

Definition at line 149 of file fxuUpdate.c.

150 {
151  Fxu_Single * pSingle;
152  Fxu_Cube * pCube, * pCubeNew;
153  Fxu_Var * pVarC, * pVarD;
154  Fxu_Var * pVar1, * pVar2;
155 
156  // read the best divisor from the heap
157  pSingle = Fxu_HeapSingleReadMax( p->pHeapSingle );
158  // get the variables of this single-cube divisor
159  pVar1 = pSingle->pVar1;
160  pVar2 = pSingle->pVar2;
161 
162  // create two new columns (vars)
163  Fxu_UpdateCreateNewVars( p, &pVarC, &pVarD, 1 );
164  // create one new row (cube)
165  pCubeNew = Fxu_MatrixAddCube( p, pVarD, 0 );
166  pCubeNew->pFirst = pCubeNew;
167  // set the first cube
168  pVarD->pFirst = pCubeNew;
169 
170  // start collecting the affected vars and cubes
173  // add the vars
174  Fxu_MatrixRingVarsAdd( p, pVar1 );
175  Fxu_MatrixRingVarsAdd( p, pVar2 );
176  // remove the literals and collect the affected cubes
177  // remove the divisors associated with this cube
178  // add to the affected cube the literal corresponding to the new column
179  Fxu_UpdateMatrixSingleClean( p, pVar1, pVar2, pVarD );
180  // stop collecting the affected vars and cubes
183 
184  // add the literals to the new cube
185  assert( pVar1->iVar < pVar2->iVar );
186  assert( Fxu_SingleCountCoincidence( p, pVar1, pVar2 ) == 0 );
187  Fxu_MatrixAddLiteral( p, pCubeNew, pVar1 );
188  Fxu_MatrixAddLiteral( p, pCubeNew, pVar2 );
189 
190  // create new doubles; we cannot add them in the same loop
191  // because we first have to create *all* new cubes for each node
193  Fxu_UpdateAddNewDoubles( p, pCube );
194  // update the singles after removing some literals
196  // we should undo the rings before creating new singles
197 
198  // unmark the cubes
201 
202  // create new singles
203  Fxu_UpdateAddNewSingles( p, pVarC );
204  Fxu_UpdateAddNewSingles( p, pVarD );
205  p->nDivs1++;
206 }
Definition: fxuInt.h:213
static void Fxu_UpdateCleanOldSingles(Fxu_Matrix *p)
Definition: fxuUpdate.c:759
static void Fxu_UpdateAddNewSingles(Fxu_Matrix *p, Fxu_Var *pVar)
Definition: fxuUpdate.c:800
static void Fxu_UpdateCreateNewVars(Fxu_Matrix *p, Fxu_Var **ppVarC, Fxu_Var **ppVarD, int nCubes)
Definition: fxuUpdate.c:638
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int iVar
Definition: fxuInt.h:215
Fxu_Var * pVar2
Definition: fxuInt.h:273
static void Fxu_UpdateMatrixSingleClean(Fxu_Matrix *p, Fxu_Var *pVar1, Fxu_Var *pVar2, Fxu_Var *pVarNew)
Definition: fxuUpdate.c:494
void Fxu_MatrixAddLiteral(Fxu_Matrix *p, Fxu_Cube *pCube, Fxu_Var *pVar)
Definition: fxuMatrix.c:205
#define Fxu_MatrixRingVarsStart(Matrix)
Definition: fxuInt.h:386
#define Fxu_MatrixRingCubesStop(Matrix)
Definition: fxuInt.h:388
#define Fxu_MatrixRingCubesStart(Matrix)
Definition: fxuInt.h:385
Fxu_Cube * Fxu_MatrixAddCube(Fxu_Matrix *p, Fxu_Var *pVar, int iCube)
Definition: fxuMatrix.c:183
Fxu_Cube * pFirst
Definition: fxuInt.h:217
void Fxu_MatrixRingVarsUnmark(Fxu_Matrix *p)
Definition: fxu.c:206
#define Fxu_MatrixRingVarsAdd(Matrix, Var)
Definition: fxuInt.h:395
#define Fxu_MatrixForEachCubeInRing(Matrix, Cube)
Definition: fxuInt.h:397
Fxu_Cube * pFirst
Definition: fxuInt.h:204
int Fxu_SingleCountCoincidence(Fxu_Matrix *p, Fxu_Var *pVar1, Fxu_Var *pVar2)
Definition: fxuSingle.c:241
Fxu_Var * pVar1
Definition: fxuInt.h:272
Fxu_Single * Fxu_HeapSingleReadMax(Fxu_HeapSingle *p)
Definition: fxuHeapS.c:275
static void Fxu_UpdateAddNewDoubles(Fxu_Matrix *p, Fxu_Cube *pCube)
Definition: fxuUpdate.c:724
#define Fxu_MatrixRingVarsStop(Matrix)
Definition: fxuInt.h:389
#define assert(ex)
Definition: util_old.h:213
void Fxu_MatrixRingCubesUnmark(Fxu_Matrix *p)
Definition: fxu.c:185