ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
mvcCube.c
Go to the documentation of this file.
1
18
19#include "mvc.h"
20
22
23
27
31
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}
81
82
95{
96 Mvc_Cube_t * pCubeCopy;
97 pCubeCopy = Mvc_CubeAlloc( pCover );
98 Mvc_CubeBitCopy( pCubeCopy, pCube );
99 return pCubeCopy;
100}
101
102
114void Mvc_CubeFree( Mvc_Cover_t * pCover, Mvc_Cube_t * pCube )
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}
146
147
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}
173
177
178
180
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_FREE(obj)
Definition abc_global.h:267
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
char * Extra_MmFixedEntryFetch(Extra_MmFixed_t *p)
void Extra_MmFixedEntryRecycle(Extra_MmFixed_t *p, char *pEntry)
void Mvc_CubeBitRemoveDcs(Mvc_Cube_t *pCube)
Definition mvcCube.c:159
ABC_NAMESPACE_IMPL_START Mvc_Cube_t * Mvc_CubeAlloc(Mvc_Cover_t *pCover)
DECLARATIONS ///.
Definition mvcCube.c:43
void Mvc_CubeFree(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition mvcCube.c:114
Mvc_Cube_t * Mvc_CubeDup(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition mvcCube.c:94
#define Mvc_CubeReadLast(Cube)
Definition mvc.h:123
#define BITS_DISJOINT
Definition mvc.h:44
struct MvcCubeStruct Mvc_Cube_t
Definition mvc.h:56
unsigned int Mvc_CubeWord_t
STRUCTURE DEFINITIONS ///.
Definition mvc.h:55
struct MvcCoverStruct Mvc_Cover_t
Definition mvc.h:58
#define Mvc_CubeBitCopy(Cube1, Cube2)
Definition mvc.h:393
int nWords
Definition mvc.h:85
Mvc_Manager_t * pMem
Definition mvc.h:93
int nUnused
Definition mvc.h:86
Mvc_CubeWord_t pData[1]
Definition mvc.h:71
unsigned iLast
Definition mvc.h:66
unsigned nUnused
Definition mvc.h:67
Extra_MmFixed_t * pMan1
Definition mvc.h:111
Extra_MmFixed_t * pMan4
Definition mvc.h:113
Extra_MmFixed_t * pMan2
Definition mvc.h:112
#define assert(ex)
Definition util_old.h:213