21 #define ABC__misc__espresso__espresso_h
22 #define print_time(t) util_print_time(t)
58 #ifndef ABC__misc__espresso__espresso_h
73 typedef unsigned int *
pset;
87 #define WHICH_WORD(element) (((element) >> LOGBPI) + 1)
88 #define WHICH_BIT(element) ((element) & (BPI-1))
92 #define SET_SIZE(size) ((size) <= BPI ? 2 : (WHICH_WORD((size)-1) + 1))
94 #define SET_SIZE(size) ((size) <= BPI ? 3 : (WHICH_WORD((size)-1) + 2))
104 #define LOOP(set) (set[0] & 0x03ff)
105 #define PUTLOOP(set, i) (set[0] &= ~0x03ff, set[0] |= (i))
107 #define LOOPCOPY(set) LOOP(set)
108 #define SIZE(set) (set[0] >> 16)
109 #define PUTSIZE(set, size) (set[0] &= 0xffff, set[0] |= ((size) << 16))
111 #define LOOPCOPY(set) (LOOP(set) + 1)
112 #define SIZE(set) (set[LOOP(set)+1])
113 #define PUTSIZE(set, size) ((set[LOOP(set)+1]) = (size))
116 #define NELEM(set) (BPI * LOOP(set))
117 #define LOOPINIT(size) ((size <= BPI) ? 1 : WHICH_WORD((size)-1))
122 #define SET(set, flag) (set[0] |= (flag))
123 #define RESET(set, flag) (set[0] &= ~ (flag))
124 #define TESTP(set, flag) (set[0] & (flag))
128 #define NONESSEN 0x4000
129 #define ACTIVE 0x2000
130 #define REDUND 0x1000
131 #define COVERED 0x0800
132 #define RELESSEN 0x0400
135 #define foreach_set(R, last, p)\
136 for(p=R->data,last=p+R->count*R->wsize;p<last;p+=R->wsize)
137 #define foreach_remaining_set(R, last, pfirst, p)\
138 for(p=pfirst+R->wsize,last=R->data+R->count*R->wsize;p<last;p+=R->wsize)
139 #define foreach_active_set(R, last, p)\
140 foreach_set(R,last,p) if (TESTP(p, ACTIVE))
143 #define foreachi_set(R, i, p)\
144 for(p=R->data,i=0;i<R->count;p+=R->wsize,i++)
145 #define foreachi_active_set(R, i, p)\
146 foreachi_set(R,i,p) if (TESTP(p, ACTIVE))
155 #define foreach_set_element(p, i, val, base) \
156 for(i = LOOP(p); i > 0; ) \
157 for(val = p[i], base = --i << LOGBPI; val != 0; base++, val >>= 1) \
161 #define GETSET(family, index) ((family)->data + (family)->wsize * (index))
164 #define set_new(size) set_clear(ALLOC(unsigned int, SET_SIZE(size)), size)
165 #define set_full(size) set_fill(ALLOC(unsigned int, SET_SIZE(size)), size)
166 #define set_save(r) set_copy(ALLOC(unsigned int, SET_SIZE(NELEM(r))), r)
167 #define set_free(r) FREE(r)
170 #define is_in_set(set, e) (set[WHICH_WORD(e)] & (1 << WHICH_BIT(e)))
171 #define set_remove(set, e) (set[WHICH_WORD(e)] &= ~ (1 << WHICH_BIT(e)))
172 #define set_insert(set, e) (set[WHICH_WORD(e)] |= 1 << WHICH_BIT(e))
176 #define INLINEset_copy(r, a) (void) set_copy(r,a)
177 #define INLINEset_clear(r, size) (void) set_clear(r, size)
178 #define INLINEset_fill(r, size) (void) set_fill(r, size)
179 #define INLINEset_and(r, a, b) (void) set_and(r, a, b)
180 #define INLINEset_or(r, a, b) (void) set_or(r, a, b)
181 #define INLINEset_diff(r, a, b) (void) set_diff(r, a, b)
182 #define INLINEset_ndiff(r, a, b, f) (void) set_ndiff(r, a, b, f)
183 #define INLINEset_xor(r, a, b) (void) set_xor(r, a, b)
184 #define INLINEset_xnor(r, a, b, f) (void) set_xnor(r, a, b, f)
185 #define INLINEset_merge(r, a, b, mask) (void) set_merge(r, a, b, mask)
186 #define INLINEsetp_implies(a, b, when_false) \
187 if (! setp_implies(a,b)) when_false
188 #define INLINEsetp_disjoint(a, b, when_false) \
189 if (! setp_disjoint(a,b)) when_false
190 #define INLINEsetp_equal(a, b, when_false) \
191 if (! setp_equal(a,b)) when_false
195 #define INLINEset_copy(r, a)\
196 {register int i_=LOOPCOPY(a); do r[i_]=a[i_]; while (--i_>=0);}
197 #define INLINEset_clear(r, size)\
198 {register int i_=LOOPINIT(size); *r=i_; do r[i_] = 0; while (--i_ > 0);}
199 #define INLINEset_fill(r, size)\
200 {register int i_=LOOPINIT(size); *r=i_; \
201 r[i_]=((unsigned int)(~0))>>(i_*BPI-size); while(--i_>0) r[i_]=~0;}
202 #define INLINEset_and(r, a, b)\
203 {register int i_=LOOP(a); PUTLOOP(r,i_);\
204 do r[i_] = a[i_] & b[i_]; while (--i_>0);}
205 #define INLINEset_or(r, a, b)\
206 {register int i_=LOOP(a); PUTLOOP(r,i_);\
207 do r[i_] = a[i_] | b[i_]; while (--i_>0);}
208 #define INLINEset_diff(r, a, b)\
209 {register int i_=LOOP(a); PUTLOOP(r,i_);\
210 do r[i_] = a[i_] & ~ b[i_]; while (--i_>0);}
211 #define INLINEset_ndiff(r, a, b, fullset)\
212 {register int i_=LOOP(a); PUTLOOP(r,i_);\
213 do r[i_] = fullset[i_] & (a[i_] | ~ b[i_]); while (--i_>0);}
215 #define INLINEset_xor(r, a, b) (void) set_xor(r, a, b)
216 #define INLINEset_xnor(r, a, b, f) (void) set_xnor(r, a, b, f)
218 #define INLINEset_xor(r, a, b)\
219 {register int i_=LOOP(a); PUTLOOP(r,i_);\
220 do r[i_] = a[i_] ^ b[i_]; while (--i_>0);}
221 #define INLINEset_xnor(r, a, b, fullset)\
222 {register int i_=LOOP(a); PUTLOOP(r,i_);\
223 do r[i_] = fullset[i_] & ~ (a[i_] ^ b[i_]); while (--i_>0);}
225 #define INLINEset_merge(r, a, b, mask)\
226 {register int i_=LOOP(a); PUTLOOP(r,i_);\
227 do r[i_] = (a[i_]&mask[i_]) | (b[i_]&~mask[i_]); while (--i_>0);}
228 #define INLINEsetp_implies(a, b, when_false)\
229 {register int i_=LOOP(a); do if (a[i_]&~b[i_]) break; while (--i_>0);\
230 if (i_ != 0) when_false;}
231 #define INLINEsetp_disjoint(a, b, when_false)\
232 {register int i_=LOOP(a); do if (a[i_]&b[i_]) break; while (--i_>0);\
233 if (i_ != 0) when_false;}
234 #define INLINEsetp_equal(a, b, when_false)\
235 {register int i_=LOOP(a); do if (a[i_]!=b[i_]) break; while (--i_>0);\
236 if (i_ != 0) when_false;}
241 #define count_ones(v)\
242 (bit_count[v & 255] + bit_count[(v >> 8) & 255]\
243 + bit_count[(v >> 16) & 255] + bit_count[(v >> 24) & 255])
245 #define count_ones(v) (bit_count[v & 255] + bit_count[(v >> 8) & 255])
258 #define print_bool(x) ((x) == 0 ? "FALSE" : ((x) == 1 ? "TRUE" : "MAYBE"))
262 #define new_cube() set_new(cube.size)
263 #define free_cube(r) set_free(r)
264 #define pcover pset_family
265 #define new_cover(i) sf_new(i, cube.size)
266 #define free_cover(r) sf_free(r)
267 #define free_cubelist(T) FREE(T[0]); FREE(T);
326 #define equal(a,b) (strcmp(a,b) == 0)
329 #define CUBELISTSIZE(T) (((pcube *) T[1] - T) - 3)
340 #define PLEASURE_type 8
341 #define EQNTOTT_type 16
342 #define KISS_type 128
343 #define CONSTRAINTS_type 256
344 #define SYMBOLIC_CONSTRAINTS_type 512
345 #define FD_type (F_type | D_type)
346 #define FR_type (F_type | R_type)
347 #define DR_type (D_type | R_type)
348 #define FDR_type (F_type | D_type | R_type)
353 #define EXPAND 0x0004
354 #define EXPAND1 0x0008
357 #define REDUCE 0x0040
358 #define REDUCE1 0x0080
359 #define SPARSE 0x0100
362 #define MINCOV 0x0800
363 #define MINCOV1 0x1000
365 #define IRRED1 0x4000
368 "UC Berkeley, Espresso Version #2.3, Release date 01/31/88"
371 #define TIME_COUNT 16
376 #define EXPAND_TIME 4
378 #define REDUCE_TIME 6
379 #define GEXPAND_TIME 7
380 #define GIRRED_TIME 8
381 #define GREDUCE_TIME 9
382 #define PRIMES_TIME 10
383 #define MINCOV_TIME 11
384 #define MV_REDUCE_TIME 12
385 #define RAISE_IN_TIME 13
386 #define VERIFY_TIME 14
387 #define WRITE_TIME 15
391 #define NUMINPUTS cube.num_binary_vars
392 #define NUMOUTPUTS cube.part_size[cube.num_vars - 1]
394 #define POSITIVE_PHASE(pos)\
395 (is_in_set(PLA->phase, cube.first_part[cube.output]+pos) != 0)
397 #define INLABEL(var) PLA->label[cube.first_part[var] + 1]
398 #define OUTLABEL(pos) PLA->label[cube.first_part[cube.output] + pos]
400 #define GETINPUT(c, pos)\
401 ((c[WHICH_WORD(2*pos)] >> WHICH_BIT(2*pos)) & 3)
402 #define GETOUTPUT(c, pos)\
403 (is_in_set(c, cube.first_part[cube.output] + pos) != 0)
405 #define PUTINPUT(c, pos, value)\
406 c[WHICH_WORD(2*pos)] = (c[WHICH_WORD(2*pos)] & ~(3 << WHICH_BIT(2*pos)))\
407 | (value << WHICH_BIT(2*pos))
408 #define PUTOUTPUT(c, pos, value)\
409 c[WHICH_WORD(pos)] = (c[WHICH_WORD(pos)] & ~(1 << WHICH_BIT(pos)))\
410 | (value << WHICH_BIT(pos))
418 #define EXEC(fct, name, S)\
419 {long t=ptime();fct;if(trace)print_trace(S,name,ptime()-t);}
420 #define EXEC_S(fct, name, S)\
421 {long t=ptime();fct;if(summary)print_trace(S,name,ptime()-t);}
422 #define EXECUTE(fct,i,S,cost)\
423 {long t=ptime();fct;totals(t,i,S,&(cost));}
429 extern unsigned int debug;
509 #define DISJOINT 0x5555
512 #define DISJOINT 0x55555555
514 #define DISJOINT 0x5555
733 extern pset_family
sf_new();
pcover primes_consensus()
pcover cb_consensus_dist0()
struct symbolic_label_struct * next
pset_family sf_ind_contain()
bool debug_exact_minimization
void repeated_phase_assignment()
symbolic_label_t * symbolic_label
bool taut_special_cases()
pset_family form_cover_table()
void map_output_symbolic()
ABC_NAMESPACE_HEADER_END int binate_split_select()
pcover map_symbolic_cover()
pset_family exact_minimum_cover()
long total_time[TIME_COUNT]
pset_family find_covers()
symbolic_list_t * symbolic_list
sm_matrix * irred_derive_table()
void output_symbolic_constraints()
pcover minimize_exact_literals()
void generate_all_pairs()
pset_family sf_compress()
struct pla_types_struct pla_types[]
bool sccc_special_cases()
int ** find_pairing_cost()
struct cost_struct cost_t
char * total_name[TIME_COUNT]
void restore_cube_struct()
struct cdata_struct cdata temp_cdata_save
struct symbolic_list_struct * next
pset_family sf_ind_unlist()
int total_calls[TIME_COUNT]
int symbolic_label_length
struct symbolic_list_struct symbolic_list_t
void find_optimal_pairing()
struct set_family set_family_t
pset_family unate_compl()
pset_family unate_intersect()
void find_equiv_outputs()
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
bool echo_unknown_commands
int * sf_count_restricted()
#define ABC_NAMESPACE_HEADER_END
pset do_sm_minimum_cover()
pcover map_unate_to_cover()
void foreach_output_function()
pcover find_all_minimal_covers_petrick()
struct cube_struct cube temp_cube_save
struct symbolic_label_struct symbolic_label_t
char * fmt_expanded_cube()
struct set_family * pset_family
struct cost_struct * pcost
struct pair_struct pair_t
pcover map_cover_to_unate()
struct pair_struct * ppair
void symbolic_hack_labels()
struct symbolic_struct symbolic_t
symbolic_t * symbolic_output
pset_family sf_copy_col()
void output_phase_setup()
int so_both_do_espresso()
pset_family sf_transpose()
pset_family unate_complement()
pset_family sf_rev_contain()
pset_family sf_inactive()
void print_expanded_cube()
struct symbolic_struct * next