abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
map.c
Go to the documentation of this file.
1 /*
2  * Revision Control Information
3  *
4  * $Source$
5  * $Author$
6  * $Revision$
7  * $Date$
8  *
9  */
10 #include "espresso.h"
11 
13 
14 
15 static pcube Gcube;
16 static pset Gminterm;
17 
19 pcover T;
20 {
21  int size, var;
22  register pcube last;
23 
24  size = 1;
25  for(var = 0; var < cube.num_vars; var++)
26  size *= cube.part_size[var];
27  Gminterm = set_new(size);
28 
29  foreach_set(T, last, Gcube)
30  explode(cube.num_vars-1, 0);
31 
32  return Gminterm;
33 }
34 
35 
36 void explode(var, z)
37 int var, z;
38 {
39  int i, last = cube.last_part[var];
40  for(i=cube.first_part[var], z *= cube.part_size[var]; i<=last; i++, z++)
41  if (is_in_set(Gcube, i))
42  {
43  if (var == 0)
44  set_insert(Gminterm, z);
45  else
46  explode(var-1, z);
47  }
48 }
49 
50 
51 static int mapindex[16][16] = {
52  { 0, 1, 3, 2, 16, 17, 19, 18, 80, 81, 83, 82, 64, 65, 67, 66},
53  { 4, 5, 7, 6, 20, 21, 23, 22, 84, 85, 87, 86, 68, 69, 71, 70},
54  { 12, 13, 15, 14, 28, 29, 31, 30, 92, 93, 95, 94, 76, 77, 79, 78},
55  { 8, 9, 11, 10, 24, 25, 27, 26, 88, 89, 91, 90, 72, 73, 75, 74},
56 
57  { 32, 33, 35, 34, 48, 49, 51, 50, 112,113,115,114, 96, 97, 99, 98},
58  { 36, 37, 39, 38, 52, 53, 55, 54, 116,117,119,118, 100,101,103,102},
59  { 44, 45, 47, 46, 60, 61, 63, 62, 124,125,127,126, 108,109,111,110},
60  { 40, 41, 43, 42, 56, 57, 59, 58, 120,121,123,122, 104,105,107,106},
61 
62 
63  {160,161,163,162, 176,177,179,178, 240,241,243,242, 224,225,227,226},
64  {164,165,167,166, 180,181,183,182, 244,245,247,246, 228,229,231,230},
65  {172,173,175,174, 188,189,191,190, 252,253,255,254, 236,237,239,238},
66  {168,169,171,170, 184,185,187,186, 248,249,251,250, 232,233,235,234},
67 
68  {128,129,131,130, 144,145,147,146, 208,209,211,210, 192,193,195,194},
69  {132,133,135,134, 148,149,151,150, 212,213,215,214, 196,197,199,198},
70  {140,141,143,142, 156,157,159,158, 220,221,223,222, 204,205,207,206},
71  {136,137,139,138, 152,153,155,154, 216,217,219,218, 200,201,203,202}
72 };
73 
74 #define POWER2(n) (1 << n)
75 void map(T)
76 pcover T;
77 {
78  int j, k, l, other_input_offset, output_offset, outnum, ind;
79  int largest_input_ind, numout;
80  char c;
81  pset m;
82  bool some_output;
83 
84  m = minterms(T);
85  largest_input_ind = POWER2(cube.num_binary_vars);
86  numout = cube.part_size[cube.num_vars-1];
87 
88  for(outnum = 0; outnum < numout; outnum++) {
89  output_offset = outnum * largest_input_ind;
90  printf("\n\nOutput space # %d\n", outnum);
91  for(l = 0; l <= MAX(cube.num_binary_vars - 8, 0); l++) {
92  other_input_offset = l * 256;
93  for(k = 0; k < 16; k++) {
94  some_output = FALSE;
95  for(j = 0; j < 16; j++) {
96  ind = mapindex[k][j] + other_input_offset;
97  if (ind < largest_input_ind) {
98  c = is_in_set(m, ind+output_offset) ? '1' : '.';
99  putchar(c);
100  some_output = TRUE;
101  }
102  if ((j+1)%4 == 0)
103  putchar(' ');
104  if ((j+1)%8 == 0)
105  printf(" ");
106  }
107  if (some_output)
108  putchar('\n');
109  if ((k+1)%4 == 0) {
110  if (k != 15 && mapindex[k+1][0] >= largest_input_ind)
111  break;
112  putchar('\n');
113  }
114  if ((k+1)%8 == 0)
115  putchar('\n');
116  }
117  }
118  }
119  set_free(m);
120 }
122 
#define set_free(r)
Definition: espresso.h:167
#define FALSE
Definition: cudd.h:91
#define pcover
Definition: espresso.h:264
int var(Lit p)
Definition: SolverTypes.h:62
#define foreach_set(R, last, p)
Definition: espresso.h:135
static pset Gminterm
Definition: map.c:16
static int mapindex[16][16]
Definition: map.c:51
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
void map(pcover T)
Definition: map.c:75
#define is_in_set(set, e)
Definition: espresso.h:170
static int size
Definition: cuddSign.c:86
unsigned int * pset
Definition: espresso.h:73
#define POWER2(n)
Definition: map.c:74
#define MAX(a, b)
Definition: avl.h:23
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
#define set_new(size)
Definition: espresso.h:164
pset minterms(pcover T)
Definition: map.c:18
#define TRUE
Definition: cudd.h:88
#define set_insert(set, e)
Definition: espresso.h:172
void explode(int var, int z)
Definition: map.c:36
static ABC_NAMESPACE_IMPL_START pcube Gcube
Definition: map.c:15
#define pcube
Definition: espresso.h:261