abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
mvcPrint.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [mvcPrint.c]
4 
5  PackageName [MVSIS 2.0: Multi-valued logic synthesis system.]
6 
7  Synopsis [Printing cubes and 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: mvcPrint.c,v 1.6 2003/04/09 18:02:06 alanmi Exp $]
16 
17 ***********************************************************************/
18 
19 #include "mvc.h"
20 //#include "vm.h"
21 //#include "vmInt.h"
22 
24 
25 
26 ////////////////////////////////////////////////////////////////////////
27 /// DECLARATIONS ///
28 ////////////////////////////////////////////////////////////////////////
29 
30 static void Mvc_CubePrintBinary( Mvc_Cover_t * pCover, Mvc_Cube_t * pCube );
31 
32 ////////////////////////////////////////////////////////////////////////
33 /// FUNCTION DEFINITIONS ///
34 ////////////////////////////////////////////////////////////////////////
35 
36 /**Function*************************************************************
37 
38  Synopsis []
39 
40  Description []
41 
42  SideEffects []
43 
44  SeeAlso []
45 
46 ***********************************************************************/
47 void Mvc_CoverPrint( Mvc_Cover_t * pCover )
48 {
49  Mvc_Cube_t * pCube;
50  int i;
51  // print general statistics
52  printf( "The cover contains %d cubes (%d bits and %d words)\n",
53  pCover->lCubes.nItems, pCover->nBits, pCover->nWords );
54  // iterate through the cubes
55  Mvc_CoverForEachCube( pCover, pCube )
56  Mvc_CubePrint( pCover, pCube );
57 
58  if ( pCover->pLits )
59  {
60  for ( i = 0; i < pCover->nBits; i++ )
61  printf( " %d", pCover->pLits[i] );
62  printf( "\n" );
63  }
64  printf( "End of cover printout\n" );
65 }
66 
67 
68 /**Function*************************************************************
69 
70  Synopsis []
71 
72  Description []
73 
74  SideEffects []
75 
76  SeeAlso []
77 
78 ***********************************************************************/
79 void Mvc_CubePrint( Mvc_Cover_t * pCover, Mvc_Cube_t * pCube )
80 {
81  int iBit, Value;
82  // iterate through the literals
83 // printf( "Size = %2d ", Mvc_CubeReadSize(pCube) );
84  Mvc_CubeForEachBit( pCover, pCube, iBit, Value )
85  printf( "%c", '0' + Value );
86  printf( "\n" );
87 }
88 
89 
90 /**Function*************************************************************
91 
92  Synopsis []
93 
94  Description []
95 
96  SideEffects []
97 
98  SeeAlso []
99 
100 ***********************************************************************/
102 {
103  Mvc_Cube_t * pCube;
104  int i;
105  // print general statistics
106  printf( "The cover contains %d cubes (%d bits and %d words)\n",
107  pCover->lCubes.nItems, pCover->nBits, pCover->nWords );
108  // iterate through the cubes
109  Mvc_CoverForEachCube( pCover, pCube )
110  Mvc_CubePrintBinary( pCover, pCube );
111 
112  if ( pCover->pLits )
113  {
114  for ( i = 0; i < pCover->nBits; i++ )
115  printf( " %d", pCover->pLits[i] );
116  printf( "\n" );
117  }
118  printf( "End of cover printout\n" );
119 }
120 
121 
122 /**Function*************************************************************
123 
124  Synopsis []
125 
126  Description []
127 
128  SideEffects []
129 
130  SeeAlso []
131 
132 ***********************************************************************/
133 void Mvc_CubePrintBinary( Mvc_Cover_t * pCover, Mvc_Cube_t * pCube )
134 {
135  int iVar, Value;
136  // iterate through the literals
137 // printf( "Size = %2d ", Mvc_CubeReadSize(pCube) );
138  Mvc_CubeForEachVarValue( pCover, pCube, iVar, Value )
139  {
140  assert( Value != 0 );
141  if ( Value == 3 )
142  printf( "-" );
143  else if ( Value == 1 )
144  printf( "0" );
145  else
146  printf( "1" );
147  }
148  printf( "\n" );
149 }
150 
151 #if 0
152 
153 /**Function*************************************************************
154 
155  Synopsis []
156 
157  Description []
158 
159  SideEffects []
160 
161  SeeAlso []
162 
163 ***********************************************************************/
164 void Mvc_CoverPrintMv( Mvc_Data_t * pData, Mvc_Cover_t * pCover )
165 {
166  Mvc_Cube_t * pCube;
167  int i;
168  // print general statistics
169  printf( "The cover contains %d cubes (%d bits and %d words)\n",
170  pCover->lCubes.nItems, pCover->nBits, pCover->nWords );
171  // iterate through the cubes
172  Mvc_CoverForEachCube( pCover, pCube )
173  Mvc_CubePrintMv( pData, pCover, pCube );
174 
175  if ( pCover->pLits )
176  {
177  for ( i = 0; i < pCover->nBits; i++ )
178  printf( " %d", pCover->pLits[i] );
179  printf( "\n" );
180  }
181  printf( "End of cover printout\n" );
182 }
183 
184 
185 /**Function*************************************************************
186 
187  Synopsis []
188 
189  Description []
190 
191  SideEffects []
192 
193  SeeAlso []
194 
195 ***********************************************************************/
196 void Mvc_CubePrintMv( Mvc_Data_t * pData, Mvc_Cover_t * pCover, Mvc_Cube_t * pCube )
197 {
198  int iLit, iVar;
199  // iterate through the literals
200  printf( "Size = %2d ", Mvc_CubeReadSize(pCube) );
201  iVar = 0;
202  for ( iLit = 0; iLit < pData->pVm->nValuesIn; iLit++ )
203  {
204  if ( iLit == pData->pVm->pValuesFirst[iVar+1] )
205  {
206  printf( " " );
207  iVar++;
208  }
209  if ( Mvc_CubeBitValue( pCube, iLit ) )
210  printf( "%c", '0' + iLit - pData->pVm->pValuesFirst[iVar] );
211  else
212  printf( "-" );
213  }
214  printf( "\n" );
215 }
216 
217 #endif
218 
219 ////////////////////////////////////////////////////////////////////////
220 /// END OF FILE ///
221 ////////////////////////////////////////////////////////////////////////
222 
223 
225 
void Mvc_CubePrint(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
Definition: mvcPrint.c:79
int nWords
Definition: mvc.h:85
static ABC_NAMESPACE_IMPL_START void Mvc_CubePrintBinary(Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)
DECLARATIONS ///.
Definition: mvcPrint.c:133
int nItems
Definition: mvc.h:79
int * pLits
Definition: mvc.h:91
void Mvc_CoverPrint(Mvc_Cover_t *pCover)
FUNCTION DEFINITIONS ///.
Definition: mvcPrint.c:47
Mvc_List_t lCubes
Definition: mvc.h:88
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
if(last==0)
Definition: sparse_int.h:34
void Mvc_CoverPrintMv(Mvc_Data_t *pData, Mvc_Cover_t *pCover)
#define Mvc_CubeForEachBit(Cover, Cube, iBit, Value)
Definition: mvc.h:553
#define Mvc_CoverForEachCube(Cover, Cube)
Definition: mvc.h:528
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
#define Mvc_CubeForEachVarValue(Cover, Cube, iVar, Value)
Definition: mvc.h:558
void Mvc_CoverPrintBinary(Mvc_Cover_t *pCover)
Definition: mvcPrint.c:101
#define Mvc_CubeBitValue(Cube, Bit)
Definition: mvc.h:138
int nBits
Definition: mvc.h:87
#define assert(ex)
Definition: util_old.h:213
#define Mvc_CubeReadSize(Cube)
Definition: mvc.h:124
void Mvc_CubePrintMv(Mvc_Data_t *pData, Mvc_Cover_t *pCover, Mvc_Cube_t *pCube)