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:
114 ":" ( "define" | "undef" )
121 Macro define/undef is currently unimplemented. */
124 /* Functions and internal routins:
126 NB: <filter-models> and <function-models> are the equivalent.
145 "*" [ <processor-list> ]
155 [ ":" <parameter-list> ]
164 function_typedef_field = 4,
166 function_param_field,
171 function_model_name_field = 0,
172 nr_function_model_fields = 1,
176 old_function_typedef_field = 0,
177 old_function_type_field = 2,
178 old_function_name_field = 4,
179 old_function_param_field = 5,
180 nr_old_function_fields = 5, /* parameter-list is optional */
184 typedef struct _function_entry function_entry;
185 struct _function_entry {
194 function_entry *next;
198 typedef void function_entry_handler
200 function_entry *function,
203 extern void function_entry_traverse
205 function_entry *functions,
206 function_entry_handler *handler,
218 ":" <field-name> { "," <field-name> }
223 <cache-macro-type> ::=
231 | <ident> "_is_" <integer>
234 A cache entry is defined (for an instruction) when all
235 <field-name>s are present as named opcode fields within the
238 SCRATCH and CACHE macros are defined during the cache fill stage
239 while CACHE and COMPUTE macros are defined during the instruction
245 cache_typedef_field = 4,
247 cache_original_fields_field,
248 cache_expression_field,
258 typedef struct _cache_entry cache_entry;
259 struct _cache_entry {
263 cache_entry_type entry_type;
265 filter *original_fields;
275 <model-processor> ::=
281 ":" <function-unit-data>
319 nr_model_macro_fields = 4,
320 nr_model_data_fields = 4,
321 nr_model_static_fields = nr_function_fields,
322 nr_model_internal_fields = nr_function_fields,
323 nr_model_function_fields = nr_function_fields,
326 typedef struct _model_data model_data;
336 model_name_field = 4,
337 model_full_name_field,
338 model_unit_data_field,
339 nr_model_processor_fields,
342 typedef struct _model_entry model_entry;
343 struct _model_entry {
353 typedef struct _model_table model_table;
354 struct _model_table {
360 function_entry *statics;
361 function_entry *internals;
362 function_entry *functions;
367 /* Instruction format:
369 An instruction is composed of a sequence of N bit instruction
370 words. Each word broken into a number of instruction fields.
371 Those fields being constant (ex. an opcode) or variable (register
375 <insn-field> { "," <insn-field> } ;
378 ( <binary-value-implying-width>
379 | <field-name-implying-width>
380 | [ <start-or-width> "." ] <field>
382 { "!" <excluded-value> }
390 | "0b" <binary-value>
396 typedef struct _insn_field_exclusion insn_field_exclusion;
397 struct _insn_field_exclusion {
400 insn_field_exclusion *next;
410 typedef struct _insn_field_entry insn_field_entry;
411 struct _insn_field_entry {
416 insn_field_type type;
420 insn_field_exclusion *exclusions;
421 insn_field_entry *next;
422 insn_field_entry *prev;
425 typedef struct _insn_bit_entry insn_bit_entry;
426 struct _insn_bit_entry {
429 insn_field_entry *field;
435 typedef struct _insn_entry insn_entry; /* forward */
437 typedef struct _insn_word_entry insn_word_entry;
438 struct _insn_word_entry {
439 /* list of sub-fields making up the instruction. bit provides
440 faster access to the field data for bit N. */
441 insn_field_entry *first;
442 insn_field_entry *last;
443 insn_bit_entry *bit[max_insn_bit_size];
444 /* set of all the string fields */
446 /* For multi-word instructions, The Nth word (from zero). */
447 insn_word_entry *next;
452 /* Instruction model:
454 Provides scheduling and other data for the code modeling the
458 "*" [ <processor-list> ]
459 ":" [ <function-unit-data> ]
464 <processor> { "," <processor>" }
467 If the <processor-list> is empty, the model is made the default for
473 insn_model_name_field = 0,
474 insn_model_unit_data_field = 1,
475 nr_insn_model_fields = 1,
478 typedef struct _insn_model_entry insn_model_entry;
479 struct _insn_model_entry {
485 insn_model_entry *next;
490 /* Instruction mnemonic:
492 List of assembler mnemonics for the instruction.
495 "\"" <assembler-mnemonic> "\""
496 [ ":" <conditional-expression> ]
500 An assembler mnemonic string has the syntax:
502 <assembler-mnemonic> ::=
503 ( [ "%" <format-spec> ] "<" <func> [ "#" <param-list> ] ">"
508 Where, for instance, the text is translated into a printf format
511 "<FUNC>" : "%ld", (long) FUNC
512 "%<FUNC>..." : "%...", FUNC
513 "%s<FUNC>" : "%s", <%s>FUNC (SD_, FUNC)
514 "%s<FUNC#P1,P2>" : "%s", <%s>FUNC (SD_, P1,P2)
515 "%lx<FUNC>" : "%lx", (unsigned long) FUNC
516 "%08lx<FUNC>" : "%08lx", (unsigned long) FUNC
518 And "<%s>FUNC" denotes a function declared using the "%s" record
528 insn_mnemonic_format_field = 0,
529 insn_mnemonic_condition_field = 1,
530 nr_insn_mnemonic_fields = 1,
533 typedef struct _insn_mnemonic_entry insn_mnemonic_entry;
534 struct _insn_mnemonic_entry {
539 insn_mnemonic_entry *next;
547 <insn-word> { "+" <insn-word> }
561 insn_format_name_field = 1,
562 insn_filter_flags_field = 2,
563 insn_options_field = 3,
569 /* typedef struct _insn_entry insn_entry; */
572 filter *flags; /* filtered by options.filters */
576 /* the words that make up the instruction. Word provides direct
577 access to word N. Pseudo instructions can be identified by
580 insn_word_entry *words;
581 insn_word_entry **word;
582 /* a set of all the fields from all the words */
584 /* an array of processor models, missing models are NULL! */
586 insn_model_entry *models;
587 insn_model_entry **model;
589 /* list of assember formats */
591 insn_mnemonic_entry *mnemonics;
598 /* Instruction table:
602 typedef struct _insn_table insn_table;
608 function_entry *functions;
609 insn_entry *illegal_insn;
615 extern insn_table *load_insn_table
619 typedef void insn_entry_handler
625 extern void insn_table_traverse_insn
628 insn_entry_handler *handler,
635 extern void print_insn_words
647 insn_field_entry *field,
654 insn_word_entry *word,