abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
mvcOpBool.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [mvcProc.c]
4 
5  PackageName [MVSIS 2.0: Multi-valued logic synthesis system.]
6 
7  Synopsis [Various boolean procedures working with covers.]
8 
9  Author [MVSIS Group]
10 
11  Affiliation [UC Berkeley]
12 
13  Date [Ver. 1.0. Started - February 1, 2003.]
14 
15  Revision [$Id: mvcOpBool.c,v 1.4 2003/04/16 01:55:37 alanmi Exp $]
16 
17 ***********************************************************************/
18 
19 #include "mvc.h"
20 
22 
23 
24 ////////////////////////////////////////////////////////////////////////
25 /// DECLARATIONS ///
26 ////////////////////////////////////////////////////////////////////////
27 
28 ////////////////////////////////////////////////////////////////////////
29 /// FUNCTION DEFINITIONS ///
30 ////////////////////////////////////////////////////////////////////////
31 
32 /**Function*************************************************************
33 
34  Synopsis []
35 
36  Description []
37 
38  SideEffects []
39 
40  SeeAlso []
41 
42 ***********************************************************************/
44 {
45  Mvc_Cover_t * pCover;
46  Mvc_Cube_t * pCube, * pCubeCopy;
47  // make sure the covers are compatible
48  assert( pCover1->nBits == pCover2->nBits );
49  // clone the cover
50  pCover = Mvc_CoverClone( pCover1 );
51  // create the cubes by making pair-wise products
52  // of cubes in pCover1 and pCover2
53  Mvc_CoverForEachCube( pCover1, pCube )
54  {
55  pCubeCopy = Mvc_CubeDup( pCover, pCube );
56  Mvc_CoverAddCubeTail( pCover, pCubeCopy );
57  }
58  Mvc_CoverForEachCube( pCover2, pCube )
59  {
60  pCubeCopy = Mvc_CubeDup( pCover, pCube );
61  Mvc_CoverAddCubeTail( pCover, pCubeCopy );
62  }
63  return pCover;
64 }
65 
66 #if 0
67 
68 /**Function*************************************************************
69 
70  Synopsis []
71 
72  Description []
73 
74  SideEffects []
75 
76  SeeAlso []
77 
78 ***********************************************************************/
80 {
81  Mvc_Cover_t * pCover;
82  Mvc_Cube_t * pCube1, * pCube2, * pCubeCopy;
83  // make sure the covers are compatible
84  assert( pCover1->nBits == pCover2->nBits );
85  // clone the cover
86  pCover = Mvc_CoverClone( pCover1 );
87  // create the cubes by making pair-wise products
88  // of cubes in pCover1 and pCover2
89  Mvc_CoverForEachCube( pCover1, pCube1 )
90  {
91  Mvc_CoverForEachCube( pCover2, pCube2 )
92  {
93  if ( Mvc_CoverDist0Cubes( p, pCube1, pCube2 ) )
94  {
95  pCubeCopy = Mvc_CubeAlloc( pCover );
96  Mvc_CubeBitAnd( pCubeCopy, pCube1, pCube2 );
97  Mvc_CoverAddCubeTail( pCover, pCubeCopy );
98  }
99  }
100  // if the number of cubes in the new cover is too large
101  // try compressing them
102  if ( Mvc_CoverReadCubeNum( pCover ) > 500 )
103  Mvc_CoverContain( pCover );
104  }
105  return pCover;
106 }
107 
108 /**Function*************************************************************
109 
110  Synopsis [Returns 1 if the two covers are equal.]
111 
112  Description []
113 
114  SideEffects []
115 
116  SeeAlso []
117 
118 ***********************************************************************/
119 int Mvc_CoverBooleanEqual( Mvc_Data_t * p, Mvc_Cover_t * pCover1, Mvc_Cover_t * pCover2 )
120 {
121  Mvc_Cover_t * pSharp;
122 
123  pSharp = Mvc_CoverSharp( p, pCover1, pCover2 );
124  if ( Mvc_CoverReadCubeNum( pSharp ) )
125  {
126 Mvc_CoverContain( pSharp );
127 printf( "Sharp \n" );
128 Mvc_CoverPrint( pSharp );
129  Mvc_CoverFree( pSharp );
130  return 0;
131  }
132  Mvc_CoverFree( pSharp );
133 
134  pSharp = Mvc_CoverSharp( p, pCover2, pCover1 );
135  if ( Mvc_CoverReadCubeNum( pSharp ) )
136  {
137 Mvc_CoverContain( pSharp );
138 printf( "Sharp \n" );
139 Mvc_CoverPrint( pSharp );
140  Mvc_CoverFree( pSharp );
141  return 0;
142  }
143  Mvc_CoverFree( pSharp );
144 
145  return 1;
146 }
147 
148 #endif
149 
150 ////////////////////////////////////////////////////////////////////////
151 /// END OF FILE ///
152 ////////////////////////////////////////////////////////////////////////
153 
154 
156 
#define Mvc_CoverAddCubeTail(pCover, pCube)
Definition: mvc.h:501
int Mvc_CoverContain(Mvc_Cover_t *pCover)
FUNCTION DEFINITIONS ///.
Definition: mvcContain.c:47
void Mvc_CoverFree(Mvc_Cover_t *pCover)
Definition: mvcCover.c:138
Mvc_Cube_t * Mvc_CubeDup(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition: mvcCube.c:94
Mvc_Cover_t * Mvc_CoverBooleanAnd(Mvc_Data_t *p, Mvc_Cover_t *pCover1, Mvc_Cover_t *pCover2)
int Mvc_CoverDist0Cubes(Mvc_Data_t *pData, Mvc_Cube_t *pA, Mvc_Cube_t *pB)
void Mvc_CoverPrint(Mvc_Cover_t *pCover)
FUNCTION DEFINITIONS ///.
Definition: mvcPrint.c:47
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Mvc_Cube_t * Mvc_CubeAlloc(Mvc_Cover_t *pCover)
DECLARATIONS ///.
Definition: mvcCube.c:43
#define Mvc_CubeBitAnd(CubeR, Cube1, Cube2)
Definition: mvc.h:405
int Mvc_CoverReadCubeNum(Mvc_Cover_t *pCover)
Definition: mvcApi.c:45
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
Mvc_Cover_t * Mvc_CoverClone(Mvc_Cover_t *pCover)
Definition: mvcCover.c:79
Mvc_Cover_t * Mvc_CoverSharp(Mvc_Data_t *p, Mvc_Cover_t *pA, Mvc_Cover_t *pB)
ABC_NAMESPACE_IMPL_START Mvc_Cover_t * Mvc_CoverBooleanOr(Mvc_Cover_t *pCover1, Mvc_Cover_t *pCover2)
DECLARATIONS ///.
Definition: mvcOpBool.c:43
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
int nBits
Definition: mvc.h:87
int Mvc_CoverBooleanEqual(Mvc_Data_t *p, Mvc_Cover_t *pCover1, Mvc_Cover_t *pCover2)
#define assert(ex)
Definition: util_old.h:213