ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
mvcOpAlg.c
Go to the documentation of this file.
1
18
19#include "mvc.h"
20
22
23
27
31
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}
75
76
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}
122
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}
160
161
165
166
168
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
Mvc_Cover_t * Mvc_CoverAlgebraicSubtract(Mvc_Cover_t *pCover1, Mvc_Cover_t *pCover2)
Definition mvcOpAlg.c:88
ABC_NAMESPACE_IMPL_START Mvc_Cover_t * Mvc_CoverAlgebraicMultiply(Mvc_Cover_t *pCover1, Mvc_Cover_t *pCover2)
DECLARATIONS ///.
Definition mvcOpAlg.c:43
int Mvc_CoverAlgebraicEqual(Mvc_Cover_t *pCover1, Mvc_Cover_t *pCover2)
Definition mvcOpAlg.c:134
#define Mvc_CubeBitOr(CubeR, Cube1, Cube2)
Definition mvc.h:397
#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
void Mvc_CoverAllocateMask(Mvc_Cover_t *pCover)
Definition mvcCover.c:168
#define Mvc_CoverForEachCube(Cover, Cube)
Definition mvc.h:528
Mvc_Cube_t * Mvc_CubeAlloc(Mvc_Cover_t *pCover)
DECLARATIONS ///.
Definition mvcCube.c:43
struct MvcCoverStruct Mvc_Cover_t
Definition mvc.h:58
#define Mvc_CubeBitEqual(Res, Cube1, Cube2)
Definition mvc.h:417
void Mvc_CoverSupport(Mvc_Cover_t *pCover, Mvc_Cube_t *pSupp)
FUNCTION DEFINITIONS ///.
Definition mvcUtils.c:58
Mvc_Cube_t * Mvc_CubeDup(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition mvcCube.c:94
#define Mvc_CubeBitDisjoint(Res, Cube1, Cube2)
Definition mvc.h:433
int nBits
Definition mvc.h:87
Mvc_Cube_t * pMask
Definition mvc.h:92
#define assert(ex)
Definition util_old.h:213