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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START
Mvc_Cover_t
Mvc_CoverAlgebraicMultiply (Mvc_Cover_t *pCover1, Mvc_Cover_t *pCover2)
 DECLARATIONS ///. More...
 
Mvc_Cover_tMvc_CoverAlgebraicSubtract (Mvc_Cover_t *pCover1, Mvc_Cover_t *pCover2)
 
int Mvc_CoverAlgebraicEqual (Mvc_Cover_t *pCover1, Mvc_Cover_t *pCover2)
 

Function Documentation

int Mvc_CoverAlgebraicEqual ( Mvc_Cover_t pCover1,
Mvc_Cover_t pCover2 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 134 of file mvcOpAlg.c.

135 {
136  Mvc_Cube_t * pCube1, * pCube2;
137  int fFound;
138  int CompResult;
139 
140  // covers should be the same base
141  assert( pCover1->nBits == pCover2->nBits );
142  // iterate through the cubes
143  Mvc_CoverForEachCube( pCover1, pCube1 )
144  {
145  fFound = 0;
146  Mvc_CoverForEachCube( pCover2, pCube2 )
147  {
148  Mvc_CubeBitEqual( CompResult, pCube1, pCube2 );
149  if ( CompResult )
150  {
151  fFound = 1;
152  break;
153  }
154  }
155  if ( !fFound )
156  return 0;
157  }
158  return 1;
159 }
#define Mvc_CubeBitEqual(Res, Cube1, Cube2)
Definition: mvc.h:417
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
int nBits
Definition: mvc.h:87
#define assert(ex)
Definition: util_old.h:213
ABC_NAMESPACE_IMPL_START Mvc_Cover_t* Mvc_CoverAlgebraicMultiply ( Mvc_Cover_t pCover1,
Mvc_Cover_t pCover2 
)

DECLARATIONS ///.

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

FileName [mvcOperAlg.c]

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

Synopsis [Miscellaneous operations on covers.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

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

Revision [

Id:
mvcOpAlg.c,v 1.4 2003/04/26 20:41:36 alanmi Exp

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

Synopsis [Multiplies two disjoint-support covers.]

Description []

SideEffects []

SeeAlso []

Definition at line 43 of file mvcOpAlg.c.

44 {
45  Mvc_Cover_t * pCover;
46  Mvc_Cube_t * pCube1, * pCube2, * pCube;
47  int CompResult;
48 
49  // covers should be the same base
50  assert( pCover1->nBits == pCover2->nBits );
51  // make sure that supports do not overlap
52  Mvc_CoverAllocateMask( pCover1 );
53  Mvc_CoverAllocateMask( pCover2 );
54  Mvc_CoverSupport( pCover1, pCover1->pMask );
55  Mvc_CoverSupport( pCover2, pCover2->pMask );
56  // check if the cubes are bit-wise disjoint
57  Mvc_CubeBitDisjoint( CompResult, pCover1->pMask, pCover2->pMask );
58  if ( !CompResult )
59  printf( "Mvc_CoverMultiply(): Cover supports are not disjoint!\n" );
60 
61  // iterate through the cubes
62  pCover = Mvc_CoverClone( pCover1 );
63  Mvc_CoverForEachCube( pCover1, pCube1 )
64  Mvc_CoverForEachCube( pCover2, pCube2 )
65  {
66  // create the product cube
67  pCube = Mvc_CubeAlloc( pCover );
68  // set the product cube equal to the product of the two cubes
69  Mvc_CubeBitOr( pCube, pCube1, pCube2 );
70  // add the cube to the cover
71  Mvc_CoverAddCubeTail( pCover, pCube );
72  }
73  return pCover;
74 }
#define Mvc_CoverAddCubeTail(pCover, pCube)
Definition: mvc.h:501
#define Mvc_CubeBitDisjoint(Res, Cube1, Cube2)
Definition: mvc.h:433
#define Mvc_CubeBitOr(CubeR, Cube1, Cube2)
Definition: mvc.h:397
void Mvc_CoverSupport(Mvc_Cover_t *pCover, Mvc_Cube_t *pSupp)
FUNCTION DEFINITIONS ///.
Definition: mvcUtils.c:58
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 *pCover)
Definition: mvcCover.c:79
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
int nBits
Definition: mvc.h:87
#define assert(ex)
Definition: util_old.h:213
void Mvc_CoverAllocateMask(Mvc_Cover_t *pCover)
Definition: mvcCover.c:168
Mvc_Cover_t* Mvc_CoverAlgebraicSubtract ( Mvc_Cover_t pCover1,
Mvc_Cover_t pCover2 
)

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

Synopsis [Subtracts the second cover from the first.]

Description []

SideEffects []

SeeAlso []

Definition at line 88 of file mvcOpAlg.c.

89 {
90  Mvc_Cover_t * pCover;
91  Mvc_Cube_t * pCube1, * pCube2, * pCube;
92  int fFound;
93  int CompResult;
94 
95  // covers should be the same base
96  assert( pCover1->nBits == pCover2->nBits );
97 
98  // iterate through the cubes
99  pCover = Mvc_CoverClone( pCover1 );
100  Mvc_CoverForEachCube( pCover1, pCube1 )
101  {
102  fFound = 0;
103  Mvc_CoverForEachCube( pCover2, pCube2 )
104  {
105  Mvc_CubeBitEqual( CompResult, pCube1, pCube2 );
106  if ( CompResult )
107  {
108  fFound = 1;
109  break;
110  }
111  }
112  if ( !fFound )
113  {
114  // create the copy of the cube
115  pCube = Mvc_CubeDup( pCover, pCube1 );
116  // add the cube copy to the cover
117  Mvc_CoverAddCubeTail( pCover, pCube );
118  }
119  }
120  return pCover;
121 }
#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
#define Mvc_CubeBitEqual(Res, Cube1, Cube2)
Definition: mvc.h:417
Mvc_Cover_t * Mvc_CoverClone(Mvc_Cover_t *pCover)
Definition: mvcCover.c:79
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
int nBits
Definition: mvc.h:87
#define assert(ex)
Definition: util_old.h:213