Automatic date update in version.in
[binutils-gdb.git] / sim / igen / igen.h
blobeb5c755aeda6b35f59e18266ffba1bd9790466dc
1 /* The IGEN simulator generator for GDB, the GNU Debugger.
3 Copyright 2002-2023 Free Software Foundation, Inc.
5 Contributed by Andrew Cagney.
7 This file is part of GDB.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 /* code-generation options: */
25 typedef enum
28 /* Transfer control to an instructions semantic code using the the
29 standard call/return mechanism */
31 generate_calls,
33 /* Transfer control to an instructions semantic code using
34 (computed) goto's instead of the more conventional call/return
35 mechanism */
37 generate_jumps,
40 igen_code;
42 typedef enum
44 nia_is_cia_plus_one,
45 nia_is_void,
46 nia_is_invalid,
48 igen_nia;
52 typedef struct _igen_gen_options igen_gen_options;
53 struct _igen_gen_options
55 int direct_access;
56 int semantic_icache;
57 int insn_in_icache;
58 int conditional_issue;
59 int slot_verification;
60 int delayed_branch;
62 /* If zeroing a register, which one? */
63 int zero_reg;
64 int zero_reg_nr;
66 /* should multiple simulators be generated? */
67 int multi_sim;
69 /* name of the default multi-sim model */
70 char *default_model;
72 /* should the simulator support multi word instructions and if so,
73 what is the max nr of words. */
74 int multi_word;
76 /* SMP? Should the generated code include SMP support (>0) and if
77 so, for how many processors? */
78 int smp;
80 /* how should the next instruction address be computed? */
81 igen_nia nia;
83 /* nr of instructions in the decoded instruction cache */
84 int icache;
85 int icache_size;
87 /* see above */
88 igen_code code;
92 typedef struct _igen_trace_options igen_trace_options;
93 struct _igen_trace_options
95 int rule_selection;
96 int rule_rejection;
97 int insn_insertion;
98 int insn_expansion;
99 int entries;
100 int combine;
103 typedef struct _igen_name
105 char *u;
106 char *l;
108 igen_name;
109 typedef struct _igen_module
111 igen_name prefix;
112 igen_name suffix;
114 igen_module;
116 typedef struct _igen_module_options
118 igen_module global;
119 igen_module engine;
120 igen_module icache;
121 igen_module idecode;
122 igen_module itable;
123 igen_module semantics;
124 igen_module support;
126 igen_module_options;
128 typedef struct _igen_decode_options igen_decode_options;
129 struct _igen_decode_options
132 /* Combine tables? Should the generator make a second pass through
133 each generated table looking for any sub-entries that contain the
134 same instructions. Those entries being merged into a single
135 table */
136 int combine;
138 /* Instruction expansion? Should the semantic code for each
139 instruction, when the oportunity arrises, be expanded according
140 to the variable opcode files that the instruction decode process
141 renders constant */
142 int duplicate;
144 /* Treat reserved fields as constant (zero) instead of ignoring
145 their value when determining decode tables */
146 int zero_reserved;
148 /* Convert any padded switch rules into goto_switch */
149 int switch_as_goto;
151 /* Force all tables to be generated with this lookup mechanism */
152 char *overriding_gen;
156 typedef struct _igen_warn_options igen_warn_options;
157 struct _igen_warn_options
160 /* Issue warning about discarded instructions */
161 int discard;
163 /* Issue warning about invalid instruction widths */
164 int width;
166 /* Issue warning about unimplemented instructions */
167 int unimplemented;
173 typedef struct _igen_options igen_options;
174 struct _igen_options
177 /* What does the instruction look like - bit ordering, size, widths or
178 offesets */
179 int hi_bit_nr;
180 int insn_bit_size;
181 int insn_specifying_widths;
183 /* what should global names be prefixed with? */
184 igen_module_options module;
186 /* See above for options and flags */
187 igen_gen_options gen;
189 /* See above for trace options */
190 igen_trace_options trace;
192 /* See above for include options */
193 table_include *include;
195 /* See above for decode options */
196 igen_decode_options decode;
198 /* Filter set to be used on the flag field of the instruction table */
199 filter *flags_filter;
201 /* See above for warn options */
202 igen_warn_options warn;
204 /* Be more picky about the input */
205 error_func (*warning);
207 /* Model (processor) set - like flags_filter. Used to select the
208 specific ISA within a processor family. */
209 filter *model_filter;
211 /* Format name set */
212 filter *format_name_filter;
215 extern igen_options options;
217 /* default options - hopefully backward compatible */
218 #define INIT_OPTIONS() \
219 do { \
220 memset (&options, 0, sizeof options); \
221 memset (&options.warn, -1, sizeof (options.warn)); \
222 options.hi_bit_nr = 0; \
223 options.insn_bit_size = default_insn_bit_size; \
224 options.insn_specifying_widths = 0; \
225 options.module.global.prefix.u = ""; \
226 options.module.global.prefix.l = ""; \
227 /* the prefixes */ \
228 options.module.engine = options.module.global; \
229 options.module.icache = options.module.global; \
230 options.module.idecode = options.module.global; \
231 options.module.itable = options.module.global; \
232 options.module.semantics = options.module.global; \
233 options.module.support = options.module.global; \
234 /* the suffixes */ \
235 options.module.engine.suffix.l = "engine"; \
236 options.module.engine.suffix.u = "ENGINE"; \
237 options.module.icache.suffix.l = "icache"; \
238 options.module.icache.suffix.u = "ICACHE"; \
239 options.module.idecode.suffix.l = "idecode"; \
240 options.module.idecode.suffix.u = "IDECODE"; \
241 options.module.itable.suffix.l = "itable"; \
242 options.module.itable.suffix.u = "ITABLE"; \
243 options.module.semantics.suffix.l = "semantics"; \
244 options.module.semantics.suffix.u = "SEMANTICS"; \
245 options.module.support.suffix.l = "support"; \
246 options.module.support.suffix.u = "SUPPORT"; \
247 /* misc stuff */ \
248 options.gen.code = generate_calls; \
249 options.gen.icache_size = 1024; \
250 options.warning = warning; \
251 } while (0)