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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START
Mvc_Cube_t
Mvc_CubeAlloc (Mvc_Cover_t *pCover)
 DECLARATIONS ///. More...
 
Mvc_Cube_tMvc_CubeDup (Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
 
void Mvc_CubeFree (Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
 
void Mvc_CubeBitRemoveDcs (Mvc_Cube_t *pCube)
 

Function Documentation

ABC_NAMESPACE_IMPL_START Mvc_Cube_t* Mvc_CubeAlloc ( Mvc_Cover_t pCover)

DECLARATIONS ///.

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

FileName [mvcCube.c]

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

Synopsis [Manipulating unate cubes.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

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

Revision [

Id:
mvcCube.c,v 1.4 2003/04/03 06:31:49 alanmi Exp

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 43 of file mvcCube.c.

44 {
45  Mvc_Cube_t * pCube;
46 
47  assert( pCover->nWords >= 0 );
48  // allocate the cube
49 #ifdef USE_SYSTEM_MEMORY_MANAGEMENT
50  if ( pCover->nWords == 0 )
51  pCube = (Mvc_Cube_t *)ABC_ALLOC( char, sizeof(Mvc_Cube_t) );
52  else
53  pCube = (Mvc_Cube_t *)ABC_ALLOC( char, sizeof(Mvc_Cube_t) + sizeof(Mvc_CubeWord_t) * (pCover->nWords - 1) );
54 #else
55  switch( pCover->nWords )
56  {
57  case 0:
58  case 1:
59  pCube = (Mvc_Cube_t *)Extra_MmFixedEntryFetch( pCover->pMem->pMan1 );
60  break;
61  case 2:
62  pCube = (Mvc_Cube_t *)Extra_MmFixedEntryFetch( pCover->pMem->pMan2 );
63  break;
64  case 3:
65  case 4:
66  pCube = (Mvc_Cube_t *)Extra_MmFixedEntryFetch( pCover->pMem->pMan4 );
67  break;
68  default:
69  pCube = (Mvc_Cube_t *)ABC_ALLOC( char, sizeof(Mvc_Cube_t) + sizeof(Mvc_CubeWord_t) * (pCover->nWords - 1) );
70  break;
71  }
72 #endif
73  // set the parameters charactering this cube
74  if ( pCover->nWords == 0 )
75  pCube->iLast = pCover->nWords;
76  else
77  pCube->iLast = pCover->nWords - 1;
78  pCube->nUnused = pCover->nUnused;
79  return pCube;
80 }
int nWords
Definition: mvc.h:85
unsigned int Mvc_CubeWord_t
STRUCTURE DEFINITIONS ///.
Definition: mvc.h:55
Extra_MmFixed_t * pMan1
Definition: mvc.h:111
Extra_MmFixed_t * pMan4
Definition: mvc.h:113
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
char * Extra_MmFixedEntryFetch(Extra_MmFixed_t *p)
int nUnused
Definition: mvc.h:86
unsigned iLast
Definition: mvc.h:66
unsigned nUnused
Definition: mvc.h:67
Extra_MmFixed_t * pMan2
Definition: mvc.h:112
#define assert(ex)
Definition: util_old.h:213
Mvc_Manager_t * pMem
Definition: mvc.h:93
void Mvc_CubeBitRemoveDcs ( Mvc_Cube_t pCube)

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

Synopsis [Removes the don't-care variable from the cube.]

Description []

SideEffects []

SeeAlso []

Definition at line 159 of file mvcCube.c.

160 {
161  unsigned Mask;
162  int i;
163  for ( i = Mvc_CubeReadLast(pCube); i >= 0; i-- )
164  {
165  // detect those variables that are different (not DCs)
166  Mask = (pCube->pData[i] ^ (pCube->pData[i] >> 1)) & BITS_DISJOINT;
167  // create the mask of all that are different
168  Mask |= (Mask << 1);
169  // remove other bits from the set
170  pCube->pData[i] &= Mask;
171  }
172 }
Mvc_CubeWord_t pData[1]
Definition: mvc.h:71
#define BITS_DISJOINT
Definition: mvc.h:44
#define Mvc_CubeReadLast(Cube)
Definition: mvc.h:123
Mvc_Cube_t* Mvc_CubeDup ( Mvc_Cover_t pCover,
Mvc_Cube_t pCube 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 94 of file mvcCube.c.

95 {
96  Mvc_Cube_t * pCubeCopy;
97  pCubeCopy = Mvc_CubeAlloc( pCover );
98  Mvc_CubeBitCopy( pCubeCopy, pCube );
99  return pCubeCopy;
100 }
ABC_NAMESPACE_IMPL_START Mvc_Cube_t * Mvc_CubeAlloc(Mvc_Cover_t *pCover)
DECLARATIONS ///.
Definition: mvcCube.c:43
#define Mvc_CubeBitCopy(Cube1, Cube2)
Definition: mvc.h:393
void Mvc_CubeFree ( Mvc_Cover_t pCover,
Mvc_Cube_t pCube 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 114 of file mvcCube.c.

115 {
116  if ( pCube == NULL )
117  return;
118 
119  // verify the parameters charactering this cube
120  assert( pCube->iLast == 0 || ((int)pCube->iLast) == pCover->nWords - 1 );
121  assert( ((int)pCube->nUnused) == pCover->nUnused );
122 
123  // deallocate the cube
124 #ifdef USE_SYSTEM_MEMORY_MANAGEMENT
125  ABC_FREE( pCube );
126 #else
127  switch( pCover->nWords )
128  {
129  case 0:
130  case 1:
131  Extra_MmFixedEntryRecycle( pCover->pMem->pMan1, (char *)pCube );
132  break;
133  case 2:
134  Extra_MmFixedEntryRecycle( pCover->pMem->pMan2, (char *)pCube );
135  break;
136  case 3:
137  case 4:
138  Extra_MmFixedEntryRecycle( pCover->pMem->pMan4, (char *)pCube );
139  break;
140  default:
141  ABC_FREE( pCube );
142  break;
143  }
144 #endif
145 }
int nWords
Definition: mvc.h:85
Extra_MmFixed_t * pMan1
Definition: mvc.h:111
Extra_MmFixed_t * pMan4
Definition: mvc.h:113
int nUnused
Definition: mvc.h:86
unsigned iLast
Definition: mvc.h:66
unsigned nUnused
Definition: mvc.h:67
Extra_MmFixed_t * pMan2
Definition: mvc.h:112
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define assert(ex)
Definition: util_old.h:213
void Extra_MmFixedEntryRecycle(Extra_MmFixed_t *p, char *pEntry)
Mvc_Manager_t * pMem
Definition: mvc.h:93