ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
mvcUtils.c File Reference
#include "mvc.h"
Include dependency graph for mvcUtils.c:

Go to the source code of this file.

Functions

void Mvc_CoverSupport (Mvc_Cover_t *pCover, Mvc_Cube_t *pSupp)
 FUNCTION DEFINITIONS ///.
 
void Mvc_CoverSupportAnd (Mvc_Cover_t *pCover, Mvc_Cube_t *pSupp)
 
int Mvc_CoverSupportSizeBinary (Mvc_Cover_t *pCover)
 
int Mvc_CoverSupportVarBelongs (Mvc_Cover_t *pCover, int iVar)
 
void Mvc_CoverCommonCube (Mvc_Cover_t *pCover, Mvc_Cube_t *pComCube)
 
int Mvc_CoverIsCubeFree (Mvc_Cover_t *pCover)
 
void Mvc_CoverMakeCubeFree (Mvc_Cover_t *pCover)
 
Mvc_Cover_tMvc_CoverCommonCubeCover (Mvc_Cover_t *pCover)
 
int Mvc_CoverCheckSuppContainment (Mvc_Cover_t *pCover1, Mvc_Cover_t *pCover2)
 
int Mvc_CoverSetCubeSizes (Mvc_Cover_t *pCover)
 
int Mvc_CoverCountCubePairDiffs (Mvc_Cover_t *pCover, unsigned char pDiffs[])
 
Mvc_Cover_tMvc_CoverRemap (Mvc_Cover_t *p, int *pVarsRem, int nVarsRem)
 
void Mvc_CoverInverse (Mvc_Cover_t *pCover)
 
Mvc_Cover_tMvc_CoverRemoveDontCareLits (Mvc_Cover_t *pCover)
 
Mvc_Cover_tMvc_CoverCofactor (Mvc_Cover_t *p, int iValue, int iValueOther)
 
Mvc_Cover_tMvc_CoverFlipVar (Mvc_Cover_t *p, int iValue0, int iValue1)
 
Mvc_Cover_tMvc_CoverUnivQuantify (Mvc_Cover_t *p, int iValueA0, int iValueA1, int iValueB0, int iValueB1)
 
Mvc_Cover_tMvc_CoverTranspose (Mvc_Cover_t *pCover)
 
int Mvc_UtilsCheckUnusedZeros (Mvc_Cover_t *pCover)
 

Function Documentation

◆ Mvc_CoverCheckSuppContainment()

int Mvc_CoverCheckSuppContainment ( Mvc_Cover_t * pCover1,
Mvc_Cover_t * pCover2 )

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

Synopsis [Returns 1 if the support of cover2 is contained in the support of cover1.]

Description []

SideEffects []

SeeAlso []

Definition at line 247 of file mvcUtils.c.

248{
249 int Result;
250 assert( pCover1->nBits == pCover2->nBits );
251 // set the supports
252 Mvc_CoverAllocateMask( pCover1 );
253 Mvc_CoverSupport( pCover1, pCover1->pMask );
254 Mvc_CoverAllocateMask( pCover2 );
255 Mvc_CoverSupport( pCover2, pCover2->pMask );
256 // check the containment
257 Mvc_CubeBitNotImpl( Result, pCover2->pMask, pCover1->pMask );
258 return !Result;
259}
void Mvc_CoverSupport(Mvc_Cover_t *pCover, Mvc_Cube_t *pSupp)
FUNCTION DEFINITIONS ///.
Definition mvcUtils.c:58
#define Mvc_CubeBitNotImpl(Res, Cube1, Cube2)
Definition mvc.h:429
void Mvc_CoverAllocateMask(Mvc_Cover_t *pCover)
Definition mvcCover.c:168
int nBits
Definition mvc.h:87
Mvc_Cube_t * pMask
Definition mvc.h:92
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Mvc_CoverCofactor()

Mvc_Cover_t * Mvc_CoverCofactor ( Mvc_Cover_t * p,
int iValue,
int iValueOther )

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

Synopsis [Returns the cofactor w.r.t. to a binary var.]

Description []

SideEffects []

SeeAlso []

Definition at line 522 of file mvcUtils.c.

523{
524 Mvc_Cover_t * pCover;
525 Mvc_Cube_t * pCube, * pCubeCopy;
526 // clone the cover
527 pCover = Mvc_CoverClone( p );
528 // copy the cube list
529 Mvc_CoverForEachCube( p, pCube )
530 if ( Mvc_CubeBitValue( pCube, iValue ) )
531 {
532 pCubeCopy = Mvc_CubeDup( pCover, pCube );
533 Mvc_CoverAddCubeTail( pCover, pCubeCopy );
534 Mvc_CubeBitInsert( pCubeCopy, iValueOther );
535 }
536 return pCover;
537}
Cube * p
Definition exorList.c:222
#define Mvc_CoverAddCubeTail(pCover, pCube)
Definition mvc.h:501
Mvc_Cover_t * Mvc_CoverClone(Mvc_Cover_t *pCover)
Definition mvcCover.c:79
struct MvcCubeStruct Mvc_Cube_t
Definition mvc.h:56
#define Mvc_CubeBitValue(Cube, Bit)
Definition mvc.h:138
#define Mvc_CoverForEachCube(Cover, Cube)
Definition mvc.h:528
struct MvcCoverStruct Mvc_Cover_t
Definition mvc.h:58
#define Mvc_CubeBitInsert(Cube, Bit)
Definition mvc.h:139
Mvc_Cube_t * Mvc_CubeDup(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition mvcCube.c:94
Here is the call graph for this function:

◆ Mvc_CoverCommonCube()

void Mvc_CoverCommonCube ( Mvc_Cover_t * pCover,
Mvc_Cube_t * pComCube )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 155 of file mvcUtils.c.

156{
157 Mvc_Cube_t * pCube;
158 // clean the support
159 Mvc_CubeBitFill( pComCube );
160 // collect the support
161 Mvc_CoverForEachCube( pCover, pCube )
162 Mvc_CubeBitAnd( pComCube, pComCube, pCube );
163}
#define Mvc_CubeBitAnd(CubeR, Cube1, Cube2)
Definition mvc.h:405
#define Mvc_CubeBitFill(Cube)
Definition mvc.h:385
Here is the caller graph for this function:

◆ Mvc_CoverCommonCubeCover()

Mvc_Cover_t * Mvc_CoverCommonCubeCover ( Mvc_Cover_t * pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 220 of file mvcUtils.c.

221{
222 Mvc_Cover_t * pRes;
223 Mvc_Cube_t * pCube;
224 // create the new cover
225 pRes = Mvc_CoverClone( pCover );
226 // get the new cube
227 pCube = Mvc_CubeAlloc( pRes );
228 // get the common cube
229 Mvc_CoverCommonCube( pCover, pCube );
230 // add the cube to the cover
231 Mvc_CoverAddCubeTail( pRes, pCube );
232 return pRes;
233}
void Mvc_CoverCommonCube(Mvc_Cover_t *pCover, Mvc_Cube_t *pComCube)
Definition mvcUtils.c:155
Mvc_Cube_t * Mvc_CubeAlloc(Mvc_Cover_t *pCover)
DECLARATIONS ///.
Definition mvcCube.c:43
Here is the call graph for this function:

◆ Mvc_CoverCountCubePairDiffs()

int Mvc_CoverCountCubePairDiffs ( Mvc_Cover_t * pCover,
unsigned char pDiffs[] )

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

Synopsis [Counts the cube sizes.]

Description [This procedure works incorrectly on big-endian machines.]

SideEffects []

SeeAlso [] Function*************************************************************

Synopsis [Counts the differences in each cube pair in the cover.]

Description [Takes the cover (pCover) and the array where the diff counters go (pDiffs). The array pDiffs should have as many entries as there are different pairs of cubes in the cover: n(n-1)/2. Fills out the array pDiffs with the following info: For each cube pair, included in the array is the number of literals in both cubes after they are made cube ABC_FREE.]

SideEffects []

SeeAlso []

Definition at line 345 of file mvcUtils.c.

346{
347 Mvc_Cube_t * pCube1;
348 Mvc_Cube_t * pCube2;
349 Mvc_Cube_t * pMask;
350 unsigned char * pByte, * pByteStart, * pByteStop;
351 int nBytes, nOnes;
352 int nCubePairs;
353
354 // allocate a temporary mask
355 pMask = Mvc_CubeAlloc( pCover );
356 // get the number of unsigned chars in the cube's bit strings
357// nBytes = pCover->nBits / (8 * sizeof(unsigned char)) + (int)(pCover->nBits % (8 * sizeof(unsigned char)) > 0);
358 nBytes = sizeof(Mvc_CubeWord_t) * pCover->nWords; // big-endian issue
359 // iterate through the cubes
360 nCubePairs = 0;
361 Mvc_CoverForEachCube( pCover, pCube1 )
362 {
364 {
365 // find the bit-wise exor of cubes
366 Mvc_CubeBitExor( pMask, pCube1, pCube2 );
367 // set the starting and stopping positions
368 pByteStart = (unsigned char *)pMask->pData;
369 pByteStop = pByteStart + nBytes;
370 // clean the counter of ones
371 nOnes = 0;
372 // iterate through the positions
373 for ( pByte = pByteStart; pByte < pByteStop; pByte++ )
374 nOnes += bit_count[*pByte];
375 // set the nOnes
376 pDiffs[nCubePairs++] = nOnes;
377 }
378 }
379 // deallocate the mask
380 Mvc_CubeFree( pCover, pMask );
381 return 1;
382}
#define Mvc_CubeBitExor(CubeR, Cube1, Cube2)
Definition mvc.h:401
#define Mvc_CubeReadNext(Cube)
MACRO DEFINITIONS ///.
Definition mvc.h:121
unsigned int Mvc_CubeWord_t
STRUCTURE DEFINITIONS ///.
Definition mvc.h:55
void Mvc_CubeFree(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition mvcCube.c:114
#define Mvc_CoverForEachCubeStart(Start, Cube)
Definition mvc.h:542
int nWords
Definition mvc.h:85
Here is the call graph for this function:

◆ Mvc_CoverFlipVar()

Mvc_Cover_t * Mvc_CoverFlipVar ( Mvc_Cover_t * p,
int iValue0,
int iValue1 )

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

Synopsis [Returns the cover, in which the binary var is complemented.]

Description []

SideEffects []

SeeAlso []

Definition at line 550 of file mvcUtils.c.

551{
552 Mvc_Cover_t * pCover;
553 Mvc_Cube_t * pCube, * pCubeCopy;
554 int Value0, Value1, Temp;
555
556 assert( iValue0 + 1 == iValue1 ); // should be adjacent
557
558 // clone the cover
559 pCover = Mvc_CoverClone( p );
560 // copy the cube list
561 Mvc_CoverForEachCube( p, pCube )
562 {
563 pCubeCopy = Mvc_CubeDup( pCover, pCube );
564 Mvc_CoverAddCubeTail( pCover, pCubeCopy );
565
566 // get the bits
567 Value0 = Mvc_CubeBitValue( pCubeCopy, iValue0 );
568 Value1 = Mvc_CubeBitValue( pCubeCopy, iValue1 );
569
570 // if both bits are one, nothing to swap
571 if ( Value0 && Value1 )
572 continue;
573 // cannot be both zero because they belong to the same var
574 assert( Value0 || Value1 );
575
576 // swap the bits
577 Temp = Value0;
578 Value0 = Value1;
579 Value1 = Temp;
580
581 // set the bits after the swap
582 if ( Value0 )
583 Mvc_CubeBitInsert( pCubeCopy, iValue0 );
584 else
585 Mvc_CubeBitRemove( pCubeCopy, iValue0 );
586
587 if ( Value1 )
588 Mvc_CubeBitInsert( pCubeCopy, iValue1 );
589 else
590 Mvc_CubeBitRemove( pCubeCopy, iValue1 );
591 }
592 return pCover;
593}
#define Mvc_CubeBitRemove(Cube, Bit)
Definition mvc.h:140
Here is the call graph for this function:

◆ Mvc_CoverInverse()

void Mvc_CoverInverse ( Mvc_Cover_t * pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 481 of file mvcUtils.c.

482{
483 Mvc_Cube_t * pCube;
484 // complement the cubes
485 Mvc_CoverForEachCube( pCover, pCube )
486 Mvc_CubeBitNot( pCube );
487}
#define Mvc_CubeBitNot(Cube)
Definition mvc.h:389
Here is the caller graph for this function:

◆ Mvc_CoverIsCubeFree()

int Mvc_CoverIsCubeFree ( Mvc_Cover_t * pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 176 of file mvcUtils.c.

177{
178 int Result;
179 // get the common cube
180 Mvc_CoverAllocateMask( pCover );
181 Mvc_CoverCommonCube( pCover, pCover->pMask );
182 // check whether the common cube is empty
183 Mvc_CubeBitEmpty( Result, pCover->pMask );
184 return Result;
185}
#define Mvc_CubeBitEmpty(Res, Cube)
Definition mvc.h:413
Here is the call graph for this function:

◆ Mvc_CoverMakeCubeFree()

void Mvc_CoverMakeCubeFree ( Mvc_Cover_t * pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 198 of file mvcUtils.c.

199{
200 Mvc_Cube_t * pCube;
201 // get the common cube
202 Mvc_CoverAllocateMask( pCover );
203 Mvc_CoverCommonCube( pCover, pCover->pMask );
204 // remove this cube from the cubes in the cover
205 Mvc_CoverForEachCube( pCover, pCube )
206 Mvc_CubeBitSharp( pCube, pCube, pCover->pMask );
207}
#define Mvc_CubeBitSharp(CubeR, Cube1, Cube2)
Definition mvc.h:409
Here is the call graph for this function:

◆ Mvc_CoverRemap()

Mvc_Cover_t * Mvc_CoverRemap ( Mvc_Cover_t * p,
int * pVarsRem,
int nVarsRem )

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

Synopsis [Creates a new cover containing some literals of the old cover.]

Description [Creates the new cover containing the given number (nVarsRem) literals of the old cover. All the bits of the new cover are initialized to "1". The selected bits from the old cover are copied on top. The numbers of the selected bits to copy are given in the array pVarsRem. The i-set entry in this array is the index of the bit in the old cover which goes to the i-th place in the new cover. If the i-th entry in pVarsRem is -1, it means that the i-th bit does not change (remains composed of all 1's). This is a useful feature to speed up remapping covers, which are known to depend only on a subset of input variables.]

SideEffects []

SeeAlso []

Definition at line 404 of file mvcUtils.c.

405{
406 Mvc_Cover_t * pCover;
407 Mvc_Cube_t * pCube, * pCubeCopy;
408 int i;
409 // clone the cover
410 pCover = Mvc_CoverAlloc( p->pMem, nVarsRem );
411 // copy the cube list
412 Mvc_CoverForEachCube( p, pCube )
413 {
414 pCubeCopy = Mvc_CubeAlloc( pCover );
415 //Mvc_CubeBitClean( pCubeCopy ); //changed by wjiang
416 Mvc_CubeBitFill( pCubeCopy ); //changed by wjiang
417 Mvc_CoverAddCubeTail( pCover, pCubeCopy );
418 }
419 // copy the corresponding columns
420 for ( i = 0; i < nVarsRem; i++ )
421 {
422 if (pVarsRem[i] < 0)
423 continue; //added by wjiang
424 assert( pVarsRem[i] >= 0 && pVarsRem[i] < p->nBits );
425 Mvc_CoverCopyColumn( p, pCover, pVarsRem[i], i );
426 }
427 return pCover;
428}
Mvc_Cover_t * Mvc_CoverAlloc(Mvc_Manager_t *pMem, int nBits)
DECLARATIONS ///.
Definition mvcCover.c:43
Here is the call graph for this function:

◆ Mvc_CoverRemoveDontCareLits()

Mvc_Cover_t * Mvc_CoverRemoveDontCareLits ( Mvc_Cover_t * pCover)

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

Synopsis [This function dups the cover and removes DC literals from cubes.]

Description []

SideEffects []

SeeAlso []

Definition at line 500 of file mvcUtils.c.

501{
502 Mvc_Cover_t * pCoverNew;
503 Mvc_Cube_t * pCube;
504
505 pCoverNew = Mvc_CoverDup( pCover );
506 Mvc_CoverForEachCube( pCoverNew, pCube )
507 Mvc_CubeBitRemoveDcs( pCube );
508 return pCoverNew;
509}
Mvc_Cover_t * Mvc_CoverDup(Mvc_Cover_t *pCover)
Definition mvcCover.c:112
void Mvc_CubeBitRemoveDcs(Mvc_Cube_t *pCube)
Definition mvcCube.c:159
Here is the call graph for this function:

◆ Mvc_CoverSetCubeSizes()

int Mvc_CoverSetCubeSizes ( Mvc_Cover_t * pCover)

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

Synopsis [Counts the cube sizes.]

Description []

SideEffects []

SeeAlso []

Definition at line 272 of file mvcUtils.c.

273{
274 Mvc_Cube_t * pCube;
275 unsigned char * pByte, * pByteStart, * pByteStop;
276 int nBytes, nOnes;
277
278 // get the number of unsigned chars in the cube's bit strings
279// nBytes = pCover->nBits / (8 * sizeof(unsigned char)) + (int)(pCover->nBits % (8 * sizeof(unsigned char)) > 0);
280 nBytes = sizeof(Mvc_CubeWord_t) * pCover->nWords; // big-endian issue
281 // iterate through the cubes
282 Mvc_CoverForEachCube( pCover, pCube )
283 {
284 // clean the counter of ones
285 nOnes = 0;
286 // set the starting and stopping positions
287 pByteStart = (unsigned char *)pCube->pData;
288 pByteStop = pByteStart + nBytes;
289 // iterate through the positions
290 for ( pByte = pByteStart; pByte < pByteStop; pByte++ )
291 nOnes += bit_count[*pByte];
292 // set the nOnes
293 Mvc_CubeSetSize( pCube, nOnes );
294 }
295 return 1;
296}
#define Mvc_CubeSetSize(Cube, Size)
Definition mvc.h:128
Here is the caller graph for this function:

◆ Mvc_CoverSupport()

void Mvc_CoverSupport ( Mvc_Cover_t * pCover,
Mvc_Cube_t * pSupp )

FUNCTION DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 58 of file mvcUtils.c.

59{
60 Mvc_Cube_t * pCube;
61 // clean the support
62 Mvc_CubeBitClean( pSupp );
63 // collect the support
64 Mvc_CoverForEachCube( pCover, pCube )
65 Mvc_CubeBitOr( pSupp, pSupp, pCube );
66}
#define Mvc_CubeBitOr(CubeR, Cube1, Cube2)
Definition mvc.h:397
#define Mvc_CubeBitClean(Cube)
Definition mvc.h:381
Here is the caller graph for this function:

◆ Mvc_CoverSupportAnd()

void Mvc_CoverSupportAnd ( Mvc_Cover_t * pCover,
Mvc_Cube_t * pSupp )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 79 of file mvcUtils.c.

80{
81 Mvc_Cube_t * pCube;
82 // clean the support
83 Mvc_CubeBitFill( pSupp );
84 // collect the support
85 Mvc_CoverForEachCube( pCover, pCube )
86 Mvc_CubeBitAnd( pSupp, pSupp, pCube );
87}
Here is the caller graph for this function:

◆ Mvc_CoverSupportSizeBinary()

int Mvc_CoverSupportSizeBinary ( Mvc_Cover_t * pCover)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 100 of file mvcUtils.c.

101{
102 Mvc_Cube_t * pSupp;
103 int Counter, i, v0, v1;
104 // compute the support
105 pSupp = Mvc_CubeAlloc( pCover );
106 Mvc_CoverSupportAnd( pCover, pSupp );
107 Counter = pCover->nBits/2;
108 for ( i = 0; i < pCover->nBits/2; i++ )
109 {
110 v0 = Mvc_CubeBitValue( pSupp, 2*i );
111 v1 = Mvc_CubeBitValue( pSupp, 2*i+1 );
112 if ( v0 && v1 )
113 Counter--;
114 }
115 Mvc_CubeFree( pCover, pSupp );
116 return Counter;
117}
void Mvc_CoverSupportAnd(Mvc_Cover_t *pCover, Mvc_Cube_t *pSupp)
Definition mvcUtils.c:79
Here is the call graph for this function:

◆ Mvc_CoverSupportVarBelongs()

int Mvc_CoverSupportVarBelongs ( Mvc_Cover_t * pCover,
int iVar )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 130 of file mvcUtils.c.

131{
132 Mvc_Cube_t * pSupp;
133 int RetValue, v0, v1;
134 // compute the support
135 pSupp = Mvc_CubeAlloc( pCover );
136 Mvc_CoverSupportAnd( pCover, pSupp );
137 v0 = Mvc_CubeBitValue( pSupp, 2*iVar );
138 v1 = Mvc_CubeBitValue( pSupp, 2*iVar+1 );
139 RetValue = (int)( !v0 || !v1 );
140 Mvc_CubeFree( pCover, pSupp );
141 return RetValue;
142}
Here is the call graph for this function:

◆ Mvc_CoverTranspose()

Mvc_Cover_t * Mvc_CoverTranspose ( Mvc_Cover_t * pCover)

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

Synopsis [Transposes the cube cover.]

Description [Returns the cube cover that looks like a transposed matrix, compared to the matrix derived from the original cover.]

SideEffects []

SeeAlso []

Definition at line 808 of file mvcUtils.c.

809{
810 Mvc_Cover_t * pRes;
811 Mvc_Cube_t * pCubeRes, * pCube;
812 int nWord, nBit, i, iCube;
813
814 pRes = Mvc_CoverAlloc( pCover->pMem, Mvc_CoverReadCubeNum(pCover) );
815 for ( i = 0; i < pCover->nBits; i++ )
816 {
817 // get the word and bit of this literal
818 nWord = Mvc_CubeWhichWord(i);
819 nBit = Mvc_CubeWhichBit(i);
820 // get the transposed cube
821 pCubeRes = Mvc_CubeAlloc( pRes );
822 Mvc_CubeBitClean( pCubeRes );
823 iCube = 0;
824 Mvc_CoverForEachCube( pCover, pCube )
825 {
826 if ( pCube->pData[nWord] & (1<<nBit) )
827 Mvc_CubeBitInsert( pCubeRes, iCube );
828 iCube++;
829 }
830 Mvc_CoverAddCubeTail( pRes, pCubeRes );
831 }
832 return pRes;
833}
#define Mvc_CubeWhichWord(Bit)
Definition mvc.h:135
#define Mvc_CubeWhichBit(Bit)
Definition mvc.h:136
int Mvc_CoverReadCubeNum(Mvc_Cover_t *pCover)
Definition mvcApi.c:45
Mvc_Manager_t * pMem
Definition mvc.h:93
Mvc_CubeWord_t pData[1]
Definition mvc.h:71
Here is the call graph for this function:

◆ Mvc_CoverUnivQuantify()

Mvc_Cover_t * Mvc_CoverUnivQuantify ( Mvc_Cover_t * p,
int iValueA0,
int iValueA1,
int iValueB0,
int iValueB1 )

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

Synopsis [Returns the cover derived by universal quantification.]

Description [Returns the cover computed by universal quantification as follows: CoverNew = Univ(B) [Cover & (A==B)]. Removes the second binary var from the support (given by values iValueB0 and iValueB1). Leaves the first binary variable (given by values iValueA0 and iValueA1) in the support.]

SideEffects []

SeeAlso []

Definition at line 610 of file mvcUtils.c.

612{
613 Mvc_Cover_t * pCover;
614 Mvc_Cube_t * pCube, * pCubeCopy;
615 int ValueA0, ValueA1, ValueB0, ValueB1;
616
617 // clone the cover
618 pCover = Mvc_CoverClone( p );
619 // copy the cube list
620 Mvc_CoverForEachCube( p, pCube )
621 {
622 // get the bits
623 ValueA0 = Mvc_CubeBitValue( pCube, iValueA0 );
624 ValueA1 = Mvc_CubeBitValue( pCube, iValueA1 );
625 ValueB0 = Mvc_CubeBitValue( pCube, iValueB0 );
626 ValueB1 = Mvc_CubeBitValue( pCube, iValueB1 );
627
628 // cannot be both zero because they belong to the same var
629 assert( ValueA0 || ValueA1 );
630 assert( ValueB0 || ValueB1 );
631
632 // if the values of this var are different, do not add the cube
633 if ( ValueA0 != ValueB0 && ValueA1 != ValueB1 )
634 continue;
635
636 // create the cube
637 pCubeCopy = Mvc_CubeDup( pCover, pCube );
638 Mvc_CoverAddCubeTail( pCover, pCubeCopy );
639
640 // insert 1's into for the first var, if both have this value
641 if ( ValueA0 && ValueB0 )
642 Mvc_CubeBitInsert( pCubeCopy, iValueA0 );
643 else
644 Mvc_CubeBitRemove( pCubeCopy, iValueA0 );
645
646 if ( ValueA1 && ValueB1 )
647 Mvc_CubeBitInsert( pCubeCopy, iValueA1 );
648 else
649 Mvc_CubeBitRemove( pCubeCopy, iValueA1 );
650
651 // insert 1's into for the second var (the cover does not depend on it)
652 Mvc_CubeBitInsert( pCubeCopy, iValueB0 );
653 Mvc_CubeBitInsert( pCubeCopy, iValueB1 );
654 }
655 return pCover;
656}
Here is the call graph for this function:

◆ Mvc_UtilsCheckUnusedZeros()

int Mvc_UtilsCheckUnusedZeros ( Mvc_Cover_t * pCover)

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

Synopsis [Checks that the cubes of the cover have 0's in unused bits.]

Description []

SideEffects []

SeeAlso []

Definition at line 846 of file mvcUtils.c.

847{
848 unsigned Unsigned;
849 Mvc_Cube_t * pCube;
850 int nCubes;
851
852 nCubes = 0;
853 Mvc_CoverForEachCube( pCover, pCube )
854 {
855 if ( pCube->nUnused == 0 )
856 continue;
857
858 Unsigned = ( pCube->pData[pCube->iLast] &
859 (BITS_FULL << (32-pCube->nUnused)) );
860 if( Unsigned )
861 {
862 printf( "Cube %2d out of %2d contains dirty bits.\n", nCubes,
863 Mvc_CoverReadCubeNum(pCover) );
864 }
865 nCubes++;
866 }
867 return 1;
868}
#define BITS_FULL
Definition mvc.h:45
unsigned iLast
Definition mvc.h:66
unsigned nUnused
Definition mvc.h:67
Here is the call graph for this function: