1 /* This file is part of the program psim.
3 Copyright (C) 1994,1995,1996,1997 Andrew Cagney <cagney@highland.com.au>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 typedef unsigned64 insn_uint;
26 /* Common among most entries:
28 All non instruction records have the format:
39 record_type_field = 1,
40 old_record_type_field = 2,
41 record_filter_flags_field = 2,
42 record_filter_models_field = 3,
48 Include the specified file.
61 include_filename_field = 4,
69 Valid options are: hi-bit-nr (default 0), insn-bit-size (default
70 32), insn-specifying-widths (default true), multi-sim (default false).
83 | "insn-specifying-widths"
99 These update the global options structure. */
103 option_name_field = 4,
110 /* Macro definitions:
114 ":" ( "define" | "undef" )
121 Macro define/undef is currently unimplemented. */
124 /* Functions and internal routins:
146 [ ":" <parameter-list> ]
154 function_typedef_field = 4,
156 function_param_field,
161 old_function_typedef_field = 0,
162 old_function_type_field = 2,
163 old_function_name_field = 4,
164 old_function_param_field = 5,
165 nr_old_function_fields = 5, /* parameter-list is optional */
169 typedef struct _function_entry function_entry;
170 struct _function_entry {
179 function_entry *next;
183 typedef void function_entry_handler
185 function_entry *function,
188 extern void function_entry_traverse
190 function_entry *functions,
191 function_entry_handler *handler,
203 ":" <field-name> { "," <field-name> }
208 <cache-macro-type> ::=
216 | <ident> "_is_" <integer>
219 A cache entry is defined (for an instruction) when all
220 <field-name>s are present as named opcode fields within the
223 SCRATCH and CACHE macros are defined during the cache fill stage
224 while CACHE and COMPUTE macros are defined during the instruction
230 cache_typedef_field = 4,
232 cache_original_fields_field,
233 cache_expression_field,
243 typedef struct _cache_entry cache_entry;
244 struct _cache_entry {
248 cache_entry_type entry_type;
250 filter *original_fields;
260 <model-processor> ::=
266 ":" <function-unit-data>
304 nr_model_macro_fields = 4,
305 nr_model_data_fields = 4,
306 nr_model_static_fields = nr_function_fields,
307 nr_model_internal_fields = nr_function_fields,
308 nr_model_function_fields = nr_function_fields,
311 typedef struct _model_data model_data;
321 model_name_field = 4,
322 model_full_name_field,
323 model_unit_data_field,
324 nr_model_processor_fields,
327 typedef struct _model_entry model_entry;
328 struct _model_entry {
338 typedef struct _model_table model_table;
339 struct _model_table {
345 function_entry *statics;
346 function_entry *internals;
347 function_entry *functions;
352 /* Instruction format:
354 An instruction is composed of a sequence of N bit instruction
355 words. Each word broken into a number of instruction fields.
356 Those fields being constant (ex. an opcode) or variable (register
360 <insn-field> { "," <insn-field> } ;
363 ( <binary-value-implying-width>
364 | <field-name-implying-width>
365 | [ <start-or-width> "." ] <field>
367 { "!" <excluded-value> }
375 | "0b" <binary-value>
381 typedef struct _insn_field_exclusion insn_field_exclusion;
382 struct _insn_field_exclusion {
385 insn_field_exclusion *next;
395 typedef struct _insn_field_entry insn_field_entry;
396 struct _insn_field_entry {
401 insn_field_type type;
405 insn_field_exclusion *exclusions;
406 insn_field_entry *next;
407 insn_field_entry *prev;
410 typedef struct _insn_bit_entry insn_bit_entry;
411 struct _insn_bit_entry {
414 insn_field_entry *field;
420 typedef struct _insn_entry insn_entry; /* forward */
422 typedef struct _insn_word_entry insn_word_entry;
423 struct _insn_word_entry {
424 /* list of sub-fields making up the instruction. bit provides
425 faster access to the field data for bit N. */
426 insn_field_entry *first;
427 insn_field_entry *last;
428 insn_bit_entry *bit[max_insn_bit_size];
429 /* set of all the string fields */
431 /* For multi-word instructions, The Nth word (from zero). */
432 insn_word_entry *next;
437 /* Instruction model:
439 Provides scheduling data for the code modeling the instruction unit.
443 ":" <function-unit-data>
447 If <processor> is NULL, the model is made the default for this
453 insn_model_name_field = 0,
454 insn_model_unit_data_field = 1,
455 nr_insn_model_fields = 1,
458 typedef struct _insn_model_entry insn_model_entry;
459 struct _insn_model_entry {
465 insn_model_entry *next;
470 /* Instruction mnemonic:
472 List of assembler mnemonics for the instruction.
475 "\"" <assembler-mnemonic> "\""
476 [ ":" <conditional-expression> ]
483 insn_mnemonic_format_field = 0,
484 insn_mnemonic_condition_field = 1,
485 nr_insn_mnemonic_fields = 1,
488 typedef struct _insn_mnemonic_entry insn_mnemonic_entry;
489 struct _insn_mnemonic_entry {
494 insn_mnemonic_entry *next;
502 <insn-word> { "+" <insn-word> }
516 insn_format_name_field = 1,
517 insn_filter_flags_field = 2,
518 insn_options_field = 3,
524 /* typedef struct _insn_entry insn_entry; */
527 filter *flags; /* filtered by options.filters */
531 /* the words that make up the instruction. Word provides direct
532 access to word N. Pseudo instructions can be identified by
535 insn_word_entry *words;
536 insn_word_entry **word;
537 /* a set of all the fields from all the words */
539 /* an array of processor models, missing models are NULL! */
541 insn_model_entry *models;
542 insn_model_entry **model;
544 /* list of assember formats */
546 insn_mnemonic_entry *mnemonics;
553 /* Instruction table:
557 typedef struct _insn_table insn_table;
563 function_entry *functions;
564 insn_entry *illegal_insn;
570 extern insn_table *load_insn_table
574 typedef void insn_entry_handler
580 extern void insn_table_traverse_insn
583 insn_entry_handler *handler,
590 extern void print_insn_words
602 insn_field_entry *field,
609 insn_word_entry *word,