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
;
26 struct _opcode_field
{
32 unsigned boolean_constant
;
36 typedef struct _opcode_bits opcode_bits
;
41 insn_field_entry
*field
;
46 typedef struct _insn_opcodes insn_opcodes
;
47 struct _insn_opcodes
{
52 typedef struct _insn_list insn_list
;
56 /* list of non constant bits that have been made constant */
57 opcode_bits
*expanded_bits
;
58 /* list of the various opcode field paths used to reach this
60 insn_opcodes
*opcodes
;
61 /* number of prefetched words for this instruction */
62 int nr_prefetched_words
;
63 /* The semantic function list_entry corresponding to this insn */
70 typedef struct _gen_list gen_list
;
72 typedef struct _gen_entry gen_entry
;
75 /* as an entry in a table */
79 opcode_bits
*expanded_bits
;
80 gen_entry
*parent
; /* parent has the opcode* data */
82 /* as a table containing entries */
83 decode_table
*opcode_rule
;
85 int nr_prefetched_words
;
89 /* as both an entry and a table */
93 /* if siblings are being combined */
94 gen_entry
*combined_next
;
95 gen_entry
*combined_parent
;
110 typedef struct _gen_table gen_table
;
112 /* list of all the instructions */
114 /* list of all the semantic functions */
116 /* list of all the generated instruction tables */
118 /* list of all the semantic functions */
120 insn_list
*semantics
;
124 extern gen_table
*make_gen_tables
126 decode_table
*rules
);
129 extern void gen_tables_expand_insns
132 extern void gen_tables_expand_semantics
135 extern int gen_entry_depth
140 /* Traverse the created data structure */
142 typedef void gen_entry_handler
148 extern void gen_entry_traverse_tree
152 gen_entry_handler
*start
,
153 gen_entry_handler
*leaf
,
154 gen_entry_handler
*end
,
159 /* Misc functions - actually in igen.c */
162 /* Cache functions: */
164 extern int print_icache_function_formal
165 (lf
*file
, int nr_prefetched_words
);
167 extern int print_icache_function_actual
168 (lf
*file
, int nr_prefetched_words
);
170 extern int print_icache_function_type
173 extern int print_semantic_function_formal
174 (lf
*file
, int nr_prefetched_words
);
176 extern int print_semantic_function_actual
177 (lf
*file
, int nr_prefetched_words
);
179 extern int print_semantic_function_type
182 extern int print_idecode_function_formal
183 (lf
*file
, int nr_prefetched_words
);
185 extern int print_idecode_function_actual
186 (lf
*file
, int nr_prefetched_words
);
189 function_name_prefix_semantics
,
190 function_name_prefix_idecode
,
191 function_name_prefix_itable
,
192 function_name_prefix_icache
,
193 function_name_prefix_engine
,
194 function_name_prefix_none
195 } lf_function_name_prefixes
;
198 is_function_declaration
= 0,
199 is_function_definition
= 1,
200 is_function_variable
,
201 } function_decl_type
;
203 extern int print_function_name
205 const char *basename
,
206 const char *format_name
,
207 const char *model_name
,
208 opcode_bits
*expanded_bits
,
209 lf_function_name_prefixes prefix
);
211 extern void print_my_defines
213 const char *basename
,
214 const char *format_name
,
215 opcode_bits
*expanded_bits
);
217 extern void print_itrace
222 extern void print_sim_engine_abort
224 const char *message
);
227 extern void print_include (lf
*file
, igen_module module
);
228 extern void print_include_inline (lf
*file
, igen_module module
);
229 extern void print_includes (lf
*file
);