1 /* The IGEN simulator generator for GDB, the GNU Debugger.
3 Copyright 2002 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 2 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, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
25 typedef struct _opcode_field opcode_field
;
33 unsigned boolean_constant
;
37 typedef struct _opcode_bits opcode_bits
;
43 insn_field_entry
*field
;
48 typedef struct _insn_opcodes insn_opcodes
;
55 typedef struct _insn_list insn_list
;
60 /* list of non constant bits that have been made constant */
61 opcode_bits
*expanded_bits
;
62 /* list of the various opcode field paths used to reach this
64 insn_opcodes
*opcodes
;
65 /* number of prefetched words for this instruction */
66 int nr_prefetched_words
;
67 /* The semantic function list_entry corresponding to this insn */
74 typedef struct _gen_list gen_list
;
76 typedef struct _gen_entry gen_entry
;
80 /* as an entry in a table */
84 opcode_bits
*expanded_bits
;
85 gen_entry
*parent
; /* parent has the opcode* data */
87 /* as a table containing entries */
88 decode_table
*opcode_rule
;
90 int nr_prefetched_words
;
94 /* as both an entry and a table */
98 /* if siblings are being combined */
99 gen_entry
*combined_next
;
100 gen_entry
*combined_parent
;
102 /* our top-of-tree */
116 typedef struct _gen_table gen_table
;
119 /* list of all the instructions */
121 /* list of all the semantic functions */
123 /* list of all the generated instruction tables */
125 /* list of all the semantic functions */
127 insn_list
*semantics
;
131 extern gen_table
*make_gen_tables (insn_table
*isa
, decode_table
*rules
);
134 extern void gen_tables_expand_insns (gen_table
*gen
);
136 extern void gen_tables_expand_semantics (gen_table
*gen
);
138 extern int gen_entry_depth (gen_entry
*table
);
142 /* Traverse the created data structure */
144 typedef void gen_entry_handler
145 (lf
*file
, gen_entry
*entry
, int depth
, void *data
);
147 extern void gen_entry_traverse_tree
151 gen_entry_handler
* start
,
152 gen_entry_handler
* leaf
, gen_entry_handler
* end
, void *data
);
156 /* Misc functions - actually in igen.c */
159 /* Cache functions: */
161 extern int print_icache_function_formal (lf
*file
, int nr_prefetched_words
);
163 extern int print_icache_function_actual (lf
*file
, int nr_prefetched_words
);
165 extern int print_icache_function_type (lf
*file
);
167 extern int print_semantic_function_formal (lf
*file
, int nr_prefetched_words
);
169 extern int print_semantic_function_actual (lf
*file
, int nr_prefetched_words
);
171 extern int print_semantic_function_type (lf
*file
);
173 extern int print_idecode_function_formal (lf
*file
, int nr_prefetched_words
);
175 extern int print_idecode_function_actual (lf
*file
, int nr_prefetched_words
);
179 function_name_prefix_semantics
,
180 function_name_prefix_idecode
,
181 function_name_prefix_itable
,
182 function_name_prefix_icache
,
183 function_name_prefix_engine
,
184 function_name_prefix_none
186 lf_function_name_prefixes
;
190 is_function_declaration
= 0,
191 is_function_definition
= 1,
192 is_function_variable
,
196 extern int print_function_name
198 const char *basename
,
199 const char *format_name
,
200 const char *model_name
,
201 opcode_bits
*expanded_bits
, lf_function_name_prefixes prefix
);
203 extern void print_my_defines
205 const char *basename
, const char *format_name
, opcode_bits
*expanded_bits
);
207 extern void print_itrace (lf
*file
, insn_entry
* insn
, int idecode
);
209 extern void print_sim_engine_abort (lf
*file
, const char *message
);
212 extern void print_include (lf
*file
, igen_module module
);
213 extern void print_include_inline (lf
*file
, igen_module module
);
214 extern void print_includes (lf
*file
);