1 /* This file is part of the program psim.
3 Copyright (C) 1994-1998 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:
123 [ <name> { "," <arg-list> } ]
130 macro_name_field = 4,
138 /* Functions and internal routins:
140 NB: <filter-models> and <function-models> are equivalent.
159 "*" [ <processor-list> ]
169 [ ":" <parameter-list> ]
178 function_typedef_field = 4,
180 function_param_field,
185 function_model_name_field = 0,
186 nr_function_model_fields = 1,
190 old_function_typedef_field = 0,
191 old_function_type_field = 2,
192 old_function_name_field = 4,
193 old_function_param_field = 5,
194 nr_old_function_fields = 5, /* parameter-list is optional */
198 typedef struct _function_entry function_entry;
199 struct _function_entry {
208 function_entry *next;
212 typedef void function_entry_handler
214 function_entry *function,
217 extern void function_entry_traverse
219 function_entry *functions,
220 function_entry_handler *handler,
232 ":" <field-name> { "," <field-name> }
237 <cache-macro-type> ::=
245 | <ident> "_is_" <integer>
248 A cache entry is defined (for an instruction) when all
249 <field-name>s are present as named opcode fields within the
252 SCRATCH and CACHE macros are defined during the cache fill stage
253 while CACHE and COMPUTE macros are defined during the instruction
259 cache_typedef_field = 4,
261 cache_original_fields_field,
262 cache_expression_field,
272 typedef struct _cache_entry cache_entry;
273 struct _cache_entry {
277 cache_entry_type entry_type;
279 filter *original_fields;
289 <model-processor> ::=
295 ":" <function-unit-data>
333 nr_model_macro_fields = 4,
334 nr_model_data_fields = 4,
335 nr_model_static_fields = nr_function_fields,
336 nr_model_internal_fields = nr_function_fields,
337 nr_model_function_fields = nr_function_fields,
340 typedef struct _model_data model_data;
350 model_name_field = 4,
351 model_full_name_field,
352 model_unit_data_field,
353 nr_model_processor_fields,
356 typedef struct _model_entry model_entry;
357 struct _model_entry {
367 typedef struct _model_table model_table;
368 struct _model_table {
374 function_entry *statics;
375 function_entry *internals;
376 function_entry *functions;
381 /* Instruction format:
383 An instruction is composed of a sequence of N bit instruction
384 words. Each word broken into a number of instruction fields.
385 Those fields being constant (ex. an opcode) or variable (register
389 <insn-field> { "," <insn-field> } ;
392 ( <binary-value-implying-width>
393 | <field-name-implying-width>
394 | [ <start-or-width> "." ] <field>
396 { [ "!" | "=" ] [ <value> | <field-name> ] }
404 | "0b" <binary-value>
410 typedef enum _insn_field_cond_type {
411 insn_field_cond_value,
412 insn_field_cond_field,
413 } insn_field_cond_type;
414 typedef enum _insn_field_cond_test {
417 } insn_field_cond_test;
418 typedef struct _insn_field_cond insn_field_cond;
419 struct _insn_field_cond {
420 insn_field_cond_type type;
421 insn_field_cond_test test;
423 struct _insn_field_entry *field;
425 insn_field_cond *next;
429 typedef enum _insn_field_type {
437 typedef struct _insn_field_entry insn_field_entry;
438 struct _insn_field_entry {
443 insn_field_type type;
447 insn_field_cond *conditions;
448 insn_field_entry *next;
449 insn_field_entry *prev;
452 typedef struct _insn_bit_entry insn_bit_entry;
453 struct _insn_bit_entry {
456 insn_field_entry *field;
462 typedef struct _insn_entry insn_entry; /* forward */
464 typedef struct _insn_word_entry insn_word_entry;
465 struct _insn_word_entry {
466 /* list of sub-fields making up the instruction. bit provides
467 faster access to the field data for bit N. */
468 insn_field_entry *first;
469 insn_field_entry *last;
470 insn_bit_entry *bit[max_insn_bit_size];
471 /* set of all the string fields */
473 /* For multi-word instructions, The Nth word (from zero). */
474 insn_word_entry *next;
479 /* Instruction model:
481 Provides scheduling and other data for the code modeling the
485 "*" [ <processor-list> ]
486 ":" [ <function-unit-data> ]
491 <processor> { "," <processor>" }
494 If the <processor-list> is empty, the model is made the default for
500 insn_model_name_field = 0,
501 insn_model_unit_data_field = 1,
502 nr_insn_model_fields = 1,
505 typedef struct _insn_model_entry insn_model_entry;
506 struct _insn_model_entry {
512 insn_model_entry *next;
517 /* Instruction mnemonic:
519 List of assembler mnemonics for the instruction.
522 "\"" <assembler-mnemonic> "\""
523 [ ":" <conditional-expression> ]
527 An assembler mnemonic string has the syntax:
529 <assembler-mnemonic> ::=
530 ( [ "%" <format-spec> ] "<" <func> [ "#" <param-list> ] ">"
535 Where, for instance, the text is translated into a printf format
538 "<FUNC>" : "%ld", (long) FUNC
539 "%<FUNC>..." : "%...", FUNC
540 "%s<FUNC>" : "%s", <%s>FUNC (SD_, FUNC)
541 "%s<FUNC#P1,P2>" : "%s", <%s>FUNC (SD_, P1,P2)
542 "%lx<FUNC>" : "%lx", (unsigned long) FUNC
543 "%08lx<FUNC>" : "%08lx", (unsigned long) FUNC
545 And "<%s>FUNC" denotes a function declared using the "%s" record
555 insn_mnemonic_format_field = 0,
556 insn_mnemonic_condition_field = 1,
557 nr_insn_mnemonic_fields = 1,
560 typedef struct _insn_mnemonic_entry insn_mnemonic_entry;
561 struct _insn_mnemonic_entry {
566 insn_mnemonic_entry *next;
574 <insn-word> { "+" <insn-word> }
588 insn_format_name_field = 1,
589 insn_filter_flags_field = 2,
590 insn_options_field = 3,
596 /* typedef struct _insn_entry insn_entry; */
599 filter *flags; /* filtered by options.filters */
603 /* the words that make up the instruction. Word provides direct
604 access to word N. Pseudo instructions can be identified by
607 insn_word_entry *words;
608 insn_word_entry **word;
609 /* a set of all the fields from all the words */
611 /* an array of processor models, missing models are NULL! */
613 insn_model_entry *models;
614 insn_model_entry **model;
616 /* list of assember formats */
618 insn_mnemonic_entry *mnemonics;
625 /* Instruction table:
629 typedef struct _insn_table insn_table;
635 function_entry *functions;
636 insn_entry *illegal_insn;
642 extern insn_table *load_insn_table
646 typedef void insn_entry_handler
652 extern void insn_table_traverse_insn
655 insn_entry_handler *handler,
662 extern void print_insn_words
674 insn_field_entry *field,
681 insn_word_entry *word,