1 /* This file is part of the program psim.
3 Copyright (C) 1994,1995,1996, 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.
22 typedef struct _opcode_field opcode_field
;
23 struct _opcode_field
{
29 unsigned boolean_constant
;
33 typedef struct _opcode_bits opcode_bits
;
38 insn_field_entry
*field
;
43 typedef struct _insn_opcodes insn_opcodes
;
44 struct _insn_opcodes
{
49 typedef struct _insn_list insn_list
;
53 /* list of non constant bits that have been made constant */
54 opcode_bits
*expanded_bits
;
55 /* list of the various opcode field paths used to reach this
57 insn_opcodes
*opcodes
;
58 /* number of prefetched words for this instruction */
59 int nr_prefetched_words
;
60 /* The semantic function list_entry corresponding to this insn */
67 typedef struct _gen_list gen_list
;
69 typedef struct _gen_entry gen_entry
;
72 /* as an entry in a table */
76 opcode_bits
*expanded_bits
;
77 gen_entry
*parent
; /* parent has the opcode* data */
79 /* as a table containing entries */
80 decode_table
*opcode_rule
;
82 int nr_prefetched_words
;
86 /* as both an entry and a table */
90 /* if siblings are being combined */
91 gen_entry
*combined_next
;
92 gen_entry
*combined_parent
;
107 typedef struct _gen_table gen_table
;
109 /* list of all the instructions */
111 /* list of all the semantic functions */
113 /* list of all the generated instruction tables */
115 /* list of all the semantic functions */
117 insn_list
*semantics
;
121 extern gen_table
*make_gen_tables
123 decode_table
*rules
);
126 extern void gen_tables_expand_insns
129 extern void gen_tables_expand_semantics
132 extern int gen_entry_depth
137 /* Traverse the created data structure */
139 typedef void gen_entry_handler
145 extern void gen_entry_traverse_tree
149 gen_entry_handler
*start
,
150 gen_entry_handler
*leaf
,
151 gen_entry_handler
*end
,
156 /* Misc functions - actually in igen.c */
159 /* Cache functions: */
161 extern int print_icache_function_formal
162 (lf
*file
, int nr_prefetched_words
);
164 extern int print_icache_function_actual
165 (lf
*file
, int nr_prefetched_words
);
167 extern int print_icache_function_type
170 extern int print_semantic_function_formal
171 (lf
*file
, int nr_prefetched_words
);
173 extern int print_semantic_function_actual
174 (lf
*file
, int nr_prefetched_words
);
176 extern int print_semantic_function_type
179 extern int print_idecode_function_formal
180 (lf
*file
, int nr_prefetched_words
);
182 extern int print_idecode_function_actual
183 (lf
*file
, int nr_prefetched_words
);
186 function_name_prefix_semantics
,
187 function_name_prefix_idecode
,
188 function_name_prefix_itable
,
189 function_name_prefix_icache
,
190 function_name_prefix_engine
,
191 function_name_prefix_none
192 } lf_function_name_prefixes
;
195 is_function_declaration
= 0,
196 is_function_definition
= 1,
197 is_function_variable
,
198 } function_decl_type
;
200 extern int print_function_name
202 const char *basename
,
203 const char *format_name
,
204 const char *model_name
,
205 opcode_bits
*expanded_bits
,
206 lf_function_name_prefixes prefix
);
208 extern void print_my_defines
210 const char *basename
,
211 const char *format_name
,
212 opcode_bits
*expanded_bits
);
214 extern void print_itrace
219 extern void print_sim_engine_abort
221 const char *message
);
224 extern void print_include (lf
*file
, igen_module module
);
225 extern void print_include_inline (lf
*file
, igen_module module
);
226 extern void print_includes (lf
*file
);