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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START
Mvc_Cover_t
Mvc_CoverAlloc (Mvc_Manager_t *pMem, int nBits)
 DECLARATIONS ///. More...
 
Mvc_Cover_tMvc_CoverClone (Mvc_Cover_t *p)
 
Mvc_Cover_tMvc_CoverDup (Mvc_Cover_t *p)
 
void Mvc_CoverFree (Mvc_Cover_t *p)
 
void Mvc_CoverAllocateMask (Mvc_Cover_t *pCover)
 
void Mvc_CoverAllocateArrayLits (Mvc_Cover_t *pCover)
 
void Mvc_CoverAllocateArrayCubes (Mvc_Cover_t *pCover)
 
void Mvc_CoverDeallocateMask (Mvc_Cover_t *pCover)
 
void Mvc_CoverDeallocateArrayLits (Mvc_Cover_t *pCover)
 

Function Documentation

ABC_NAMESPACE_IMPL_START Mvc_Cover_t* Mvc_CoverAlloc ( Mvc_Manager_t pMem,
int  nBits 
)

DECLARATIONS ///.

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

FileName [mvcCover.c]

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

Synopsis [Basic procedures to manipulate unate cube covers.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

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

Revision [

Id:
mvcCover.c,v 1.5 2003/04/09 18:02:05 alanmi Exp

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 43 of file mvcCover.c.

44 {
45  Mvc_Cover_t * p;
46  int nBitsInUnsigned;
47 
48  nBitsInUnsigned = 8 * sizeof(Mvc_CubeWord_t);
49 #ifdef USE_SYSTEM_MEMORY_MANAGEMENT
50  p = (Mvc_Cover_t *)ABC_ALLOC( char, sizeof(Mvc_Cover_t) );
51 #else
53 #endif
54  p->pMem = pMem;
55  p->nBits = nBits;
56  p->nWords = nBits / nBitsInUnsigned + (int)(nBits % nBitsInUnsigned > 0);
57  p->nUnused = p->nWords * nBitsInUnsigned - p->nBits;
58  p->lCubes.nItems = 0;
59  p->lCubes.pHead = NULL;
60  p->lCubes.pTail = NULL;
61  p->nCubesAlloc = 0;
62  p->pCubes = NULL;
63  p->pMask = NULL;
64  p->pLits = NULL;
65  return p;
66 }
Mvc_Cube_t ** pCubes
Definition: mvc.h:89
int nWords
Definition: mvc.h:85
unsigned int Mvc_CubeWord_t
STRUCTURE DEFINITIONS ///.
Definition: mvc.h:55
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nItems
Definition: mvc.h:79
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
char * Extra_MmFixedEntryFetch(Extra_MmFixed_t *p)
int * pLits
Definition: mvc.h:91
int nUnused
Definition: mvc.h:86
Mvc_Cube_t * pMask
Definition: mvc.h:92
Mvc_List_t lCubes
Definition: mvc.h:88
Mvc_Cube_t * pTail
Definition: mvc.h:78
Mvc_Cube_t * pHead
Definition: mvc.h:77
int nCubesAlloc
Definition: mvc.h:90
int nBits
Definition: mvc.h:87
Extra_MmFixed_t * pManC
Definition: mvc.h:110
Mvc_Manager_t * pMem
Definition: mvc.h:93
void Mvc_CoverAllocateArrayCubes ( Mvc_Cover_t pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 202 of file mvcCover.c.

203 {
204  if ( pCover->nCubesAlloc < pCover->lCubes.nItems )
205  {
206  if ( pCover->nCubesAlloc > 0 )
207  MEM_FREE( pCover->pMem, Mvc_Cube_t *, pCover->nCubesAlloc, pCover->pCubes );
208  pCover->nCubesAlloc = pCover->lCubes.nItems;
209  pCover->pCubes = MEM_ALLOC( pCover->pMem, Mvc_Cube_t *, pCover->nCubesAlloc );
210  }
211 }
Mvc_Cube_t ** pCubes
Definition: mvc.h:89
int nItems
Definition: mvc.h:79
#define MEM_FREE(Manager, Type, Size, Pointer)
Definition: mvc.h:568
Mvc_List_t lCubes
Definition: mvc.h:88
#define MEM_ALLOC(Manager, Type, Size)
Definition: mvc.h:567
int nCubesAlloc
Definition: mvc.h:90
Mvc_Manager_t * pMem
Definition: mvc.h:93
void Mvc_CoverAllocateArrayLits ( Mvc_Cover_t pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 185 of file mvcCover.c.

186 {
187  if ( pCover->pLits == NULL )
188  pCover->pLits = MEM_ALLOC( pCover->pMem, int, pCover->nBits );
189 }
int * pLits
Definition: mvc.h:91
#define MEM_ALLOC(Manager, Type, Size)
Definition: mvc.h:567
int nBits
Definition: mvc.h:87
Mvc_Manager_t * pMem
Definition: mvc.h:93
void Mvc_CoverAllocateMask ( Mvc_Cover_t pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 168 of file mvcCover.c.

169 {
170  if ( pCover->pMask == NULL )
171  pCover->pMask = Mvc_CubeAlloc( pCover );
172 }
Mvc_Cube_t * Mvc_CubeAlloc(Mvc_Cover_t *pCover)
DECLARATIONS ///.
Definition: mvcCube.c:43
Mvc_Cube_t * pMask
Definition: mvc.h:92
Mvc_Cover_t* Mvc_CoverClone ( Mvc_Cover_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 79 of file mvcCover.c.

80 {
81  Mvc_Cover_t * pCover;
82 #ifdef USE_SYSTEM_MEMORY_MANAGEMENT
83  pCover = (Mvc_Cover_t *)ABC_ALLOC( char, sizeof(Mvc_Cover_t) );
84 #else
85  pCover = (Mvc_Cover_t *)Extra_MmFixedEntryFetch( p->pMem->pManC );
86 #endif
87  pCover->pMem = p->pMem;
88  pCover->nBits = p->nBits;
89  pCover->nWords = p->nWords;
90  pCover->nUnused = p->nUnused;
91  pCover->lCubes.nItems = 0;
92  pCover->lCubes.pHead = NULL;
93  pCover->lCubes.pTail = NULL;
94  pCover->nCubesAlloc = 0;
95  pCover->pCubes = NULL;
96  pCover->pMask = NULL;
97  pCover->pLits = NULL;
98  return pCover;
99 }
Mvc_Cube_t ** pCubes
Definition: mvc.h:89
int nWords
Definition: mvc.h:85
int nItems
Definition: mvc.h:79
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
char * Extra_MmFixedEntryFetch(Extra_MmFixed_t *p)
int * pLits
Definition: mvc.h:91
int nUnused
Definition: mvc.h:86
Mvc_Cube_t * pMask
Definition: mvc.h:92
Mvc_List_t lCubes
Definition: mvc.h:88
Mvc_Cube_t * pTail
Definition: mvc.h:78
Mvc_Cube_t * pHead
Definition: mvc.h:77
int nCubesAlloc
Definition: mvc.h:90
int nBits
Definition: mvc.h:87
Extra_MmFixed_t * pManC
Definition: mvc.h:110
Mvc_Manager_t * pMem
Definition: mvc.h:93
void Mvc_CoverDeallocateArrayLits ( Mvc_Cover_t pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 241 of file mvcCover.c.

242 {
243  if ( pCover->pLits )
244  {
245  MEM_FREE( pCover->pMem, int, pCover->nBits, pCover->pLits );
246  pCover->pLits = NULL;
247  }
248 }
int * pLits
Definition: mvc.h:91
#define MEM_FREE(Manager, Type, Size, Pointer)
Definition: mvc.h:568
int nBits
Definition: mvc.h:87
Mvc_Manager_t * pMem
Definition: mvc.h:93
void Mvc_CoverDeallocateMask ( Mvc_Cover_t pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 224 of file mvcCover.c.

225 {
226  Mvc_CubeFree( pCover, pCover->pMask );
227  pCover->pMask = NULL;
228 }
Mvc_Cube_t * pMask
Definition: mvc.h:92
void Mvc_CubeFree(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition: mvcCube.c:114
Mvc_Cover_t* Mvc_CoverDup ( Mvc_Cover_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 112 of file mvcCover.c.

113 {
114  Mvc_Cover_t * pCover;
115  Mvc_Cube_t * pCube, * pCubeCopy;
116  // clone the cover
117  pCover = Mvc_CoverClone( p );
118  // copy the cube list
119  Mvc_CoverForEachCube( p, pCube )
120  {
121  pCubeCopy = Mvc_CubeDup( p, pCube );
122  Mvc_CoverAddCubeTail( pCover, pCubeCopy );
123  }
124  return pCover;
125 }
#define Mvc_CoverAddCubeTail(pCover, pCube)
Definition: mvc.h:501
Mvc_Cube_t * Mvc_CubeDup(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition: mvcCube.c:94
Mvc_Cover_t * Mvc_CoverClone(Mvc_Cover_t *p)
Definition: mvcCover.c:79
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
void Mvc_CoverFree ( Mvc_Cover_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 138 of file mvcCover.c.

139 {
140  Mvc_Cube_t * pCube, * pCube2;
141  // recycle cube list
142  Mvc_CoverForEachCubeSafe( p, pCube, pCube2 )
143  Mvc_CubeFree( p, pCube );
144  // recycle other pointers
145  Mvc_CubeFree( p, p->pMask );
146  MEM_FREE( p->pMem, Mvc_Cube_t *, p->nCubesAlloc, p->pCubes );
147  MEM_FREE( p->pMem, int, p->nBits, p->pLits );
148 
149 #ifdef USE_SYSTEM_MEMORY_MANAGEMENT
150  ABC_FREE( p );
151 #else
152  Extra_MmFixedEntryRecycle( p->pMem->pManC, (char *)p );
153 #endif
154 }
#define MEM_FREE(Manager, Type, Size, Pointer)
Definition: mvc.h:568
#define Mvc_CoverForEachCubeSafe(Cover, Cube, Cube2)
Definition: mvc.h:536
#define ABC_FREE(obj)
Definition: abc_global.h:232
void Extra_MmFixedEntryRecycle(Extra_MmFixed_t *p, char *pEntry)
void Mvc_CubeFree(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition: mvcCube.c:114