📄 espresso.h
字号:
typedef struct cost_struct { int cubes; /* number of cubes in the cover */ int in; /* transistor count, binary-valued variables */ int out; /* transistor count, output part */ int mv; /* transistor count, multiple-valued vars */ int total; /* total number of transistors */ int primes; /* number of prime cubes */} cost_t, *pcost;/* pair_t describes bit-paired variables */typedef struct pair_struct { int cnt; int *var1; int *var2;} pair_t, *ppair;/* symbolic_list_t describes a single ".symbolic" line */typedef struct symbolic_list_struct { int variable; int pos; struct symbolic_list_struct *next;} symbolic_list_t;/* symbolic_list_t describes a single ".symbolic" line */typedef struct symbolic_label_struct { char *label; struct symbolic_label_struct *next;} symbolic_label_t;/* symbolic_t describes a linked list of ".symbolic" lines */typedef struct symbolic_struct { symbolic_list_t *symbolic_list; /* linked list of items */ int symbolic_list_length; /* length of symbolic_list list */ symbolic_label_t *symbolic_label; /* linked list of new names */ int symbolic_label_length; /* length of symbolic_label list */ struct symbolic_struct *next;} symbolic_t;/* PLA_t stores the logical representation of a PLA */typedef struct { pcover F, D, R; /* on-set, off-set and dc-set */ char *filename; /* filename */ int pla_type; /* logical PLA format */ pcube phase; /* phase to split into on-set and off-set */ ppair pair; /* how to pair variables */ char **label; /* labels for the columns */ symbolic_t *symbolic; /* allow binary->symbolic mapping */ symbolic_t *symbolic_output;/* allow symbolic output mapping */} PLA_t, *pPLA;#define equal(a,b) (strcmp(a,b) == 0)/* This is a hack which I wish I hadn't done, but too painful to change */#define CUBELISTSIZE(T) (((pcube *) T[1] - T) - 3)/* For documentation purposes */#define IN#define OUT#define INOUT/* The pla_type field describes the input and output format of the PLA */#define F_type 1#define D_type 2#define R_type 4#define PLEASURE_type 8 /* output format */#define EQNTOTT_type 16 /* output format algebraic eqns */#define KISS_type 128 /* output format kiss */#define CONSTRAINTS_type 256 /* output the constraints (numeric) */#define SYMBOLIC_CONSTRAINTS_type 512 /* output the constraints (symbolic) */#define FD_type (F_type | D_type)#define FR_type (F_type | R_type)#define DR_type (D_type | R_type)#define FDR_type (F_type | D_type | R_type)/* Definitions for the debug variable */#define COMPL 0x0001#define ESSEN 0x0002#define EXPAND 0x0004#define EXPAND1 0x0008#define GASP 0x0010#define IRRED 0x0020#define REDUCE 0x0040#define REDUCE1 0x0080#define SPARSE 0x0100#define TAUT 0x0200#define EXACT 0x0400#define MINCOV 0x0800#define MINCOV1 0x1000#define SHARP 0x2000#define IRRED1 0x4000/* automake does not like VERSION (Jiang)#define VERSION\ "UC Berkeley, Espresso Version #2.3, Release date 01/31/88" *//* Define constants used for recording program statistics */#define TIME_COUNT 16#define READ_TIME 0#define COMPL_TIME 1#define ONSET_TIME 2#define ESSEN_TIME 3#define EXPAND_TIME 4#define IRRED_TIME 5#define REDUCE_TIME 6#define GEXPAND_TIME 7#define GIRRED_TIME 8#define GREDUCE_TIME 9#define PRIMES_TIME 10#define MINCOV_TIME 11#define MV_REDUCE_TIME 12#define RAISE_IN_TIME 13#define VERIFY_TIME 14#define WRITE_TIME 15/* For those who like to think about PLAs, macros to get at inputs/outputs */#define NUMINPUTS cube.num_binary_vars#define NUMOUTPUTS cube.part_size[cube.num_vars - 1]#define POSITIVE_PHASE(pos)\ (is_in_set(PLA->phase, cube.first_part[cube.output]+pos) != 0)#define INLABEL(var) PLA->label[cube.first_part[var] + 1]#define OUTLABEL(pos) PLA->label[cube.first_part[cube.output] + pos]#define GETINPUT(c, pos)\ ((c[WHICH_WORD(2*pos)] >> WHICH_BIT(2*pos)) & 3)#define GETOUTPUT(c, pos)\ (is_in_set(c, cube.first_part[cube.output] + pos) != 0)#define PUTINPUT(c, pos, value)\ c[WHICH_WORD(2*pos)] = (c[WHICH_WORD(2*pos)] & ~(3 << WHICH_BIT(2*pos)))\ | (value << WHICH_BIT(2*pos))#define PUTOUTPUT(c, pos, value)\ c[WHICH_WORD(pos)] = (c[WHICH_WORD(pos)] & ~(1 << WHICH_BIT(pos)))\ | (value << WHICH_BIT(pos))#define TWO 3#define DASH 3#define ONE 2#define ZERO 1#define EXEC(fct, name, S)\ {long t=ptime();fct;if(trace)print_trace(S,name,ptime()-t);}#define EXEC_S(fct, name, S)\ {long t=ptime();fct;if(summary)print_trace(S,name,ptime()-t);}#define EXECUTE(fct,i,S,cost)\ {long t=ptime();fct;totals(t,i,S,&(cost));}/* * Global Variable Declarations */extern unsigned int debug; /* debug parameter */extern bool verbose_debug; /* -v: whether to print a lot */extern char *total_name[TIME_COUNT]; /* basic function names */extern long total_time[TIME_COUNT]; /* time spent in basic fcts */extern int total_calls[TIME_COUNT]; /* # calls to each fct */extern bool echo_comments; /* turned off by -eat option */extern bool echo_unknown_commands; /* always true ?? */extern bool force_irredundant; /* -nirr command line option */extern bool skip_make_sparse;extern bool kiss; /* -kiss command line option */extern bool pos; /* -pos command line option */extern bool print_solution; /* -x command line option */extern bool recompute_onset; /* -onset command line option */extern bool remove_essential; /* -ness command line option */extern bool single_expand; /* -fast command line option */extern bool summary; /* -s command line option */extern bool trace; /* -t command line option */extern bool unwrap_onset; /* -nunwrap command line option */extern bool use_random_order; /* -random command line option */extern bool use_super_gasp; /* -strong command line option */extern char *filename; /* filename PLA was read from */extern bool debug_exact_minimization; /* dumps info for -do exact *//* * pla_types are the input and output types for reading/writing a PLA */struct pla_types_struct { char *key; int value;};/* * The cube structure is a global structure which contains information * on how a set maps into a cube -- i.e., number of parts per variable, * number of variables, etc. Also, many fields are pre-computed to * speed up various primitive operations. */#define CUBE_TEMP 10struct cube_struct { int size; /* set size of a cube */ int num_vars; /* number of variables in a cube */ int num_binary_vars; /* number of binary variables */ int *first_part; /* first element of each variable */ int *last_part; /* first element of each variable */ int *part_size; /* number of elements in each variable */ int *first_word; /* first word for each variable */ int *last_word; /* last word for each variable */ pset binary_mask; /* Mask to extract binary variables */ pset mv_mask; /* mask to get mv parts */ pset *var_mask; /* mask to extract a variable */ pset *temp; /* an array of temporary sets */ pset fullset; /* a full cube */ pset emptyset; /* an empty cube */ unsigned int inmask; /* mask to get odd word of binary part */ int inword; /* which word number for above */ int *sparse; /* should this variable be sparse? */ int num_mv_vars; /* number of multiple-valued variables */ int output; /* which variable is "output" (-1 if none) */};struct cdata_struct { int *part_zeros; /* count of zeros for each element */ int *var_zeros; /* count of zeros for each variable */ int *parts_active; /* number of "active" parts for each var */ bool *is_unate; /* indicates given var is unate */ int vars_active; /* number of "active" variables */ int vars_unate; /* number of unate variables */ int best; /* best "binate" variable */};extern struct pla_types_struct pla_types[];extern struct cube_struct cube, temp_cube_save;extern struct cdata_struct cdata, temp_cdata_save;#ifdef lint#define DISJOINT 0x5555#else#if BPI == 32#define DISJOINT 0x55555555#else#define DISJOINT 0x5555#endif#endif/* function declarations */typedef int (*ESP_PFI)();/* cofactor.c */ EXTERN int binate_split_select ARGS((pcube *, pcube, pcube, int));/* cofactor.c */ EXTERN pcover cubeunlist ARGS((pcube *));/* cofactor.c */ EXTERN pcube *cofactor ARGS((pcube *, pcube));/* cofactor.c */ EXTERN pcube *cube1list ARGS((pcover));/* cofactor.c */ EXTERN pcube *cube2list ARGS((pcover, pcover));/* cofactor.c */ EXTERN pcube *cube3list ARGS((pcover, pcover, pcover));/* cofactor.c */ EXTERN pcube *scofactor ARGS((pcube *, pcube, int));/* cofactor.c */ EXTERN void massive_count ARGS((pcube *));/* compl.c */ EXTERN pcover complement ARGS((pcube *));/* compl.c */ EXTERN pcover simplify ARGS((pcube *));/* compl.c */ EXTERN void simp_comp ARGS((pcube *, pcover *, pcover *));/* contain.c */ EXTERN int d1_rm_equal ARGS((pset *, ESP_PFI));/* contain.c */ EXTERN int rm2_contain ARGS((pset *, pset *));/* contain.c */ EXTERN int rm2_equal ARGS((pset *, pset *, pset *, ESP_PFI));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -