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 /* What does the instruction look like - bit ordering and size */
24 extern int insn_bit_size
;
27 /* generation options: */
31 generate_with_icache
= 0x1,
32 generate_with_semantic_icache
= 0x2,
33 generate_with_direct_access_icache
= 0x4,
39 /* Transfer control to an instructions semantic code using the the
40 standard call/return mechanism */
42 generate_calls
= 0x10,
44 /* In addition, pre-decode an instructions opcode fields (entering
45 them into an icache) so that semantic code can avoid the need to
46 re-decode fields each time it is executed */
48 generate_calls_with_icache
49 = generate_calls
| generate_with_icache
,
51 /* In addition, the instruction decode code includes a duplicated
52 copy of the instructions semantic code. This avoids the need to
53 perform two calls (one to decode an instructions opcode fields
54 and one to execute the instruction) when there is a miss of the
57 generate_calls_with_semantic_icache
58 = generate_calls_with_icache
| generate_with_semantic_icache
,
60 /* In addition, the semantic function refers to icache entries
61 directly instead of first moving them into local variables */
63 generate_calls_with_direct_access_icache
64 = generate_calls_with_icache
| generate_with_direct_access_icache
,
66 generate_calls_with_direct_access_semantic_icache
67 = generate_calls_with_direct_access_icache
| generate_with_semantic_icache
,
70 /* Transfer control to an instructions semantic code using
71 (computed) goto's instead of the more conventional call/return
74 generate_jumps
= 0x20,
76 /* As for generate_calls_with_icache but applies to jumping code */
78 generate_jumps_with_icache
79 = generate_jumps
| generate_with_icache
,
81 /* As for generate_calls_with_semantic_icache but applies to jumping
84 generate_jumps_with_semantic_icache
85 = generate_jumps_with_icache
| generate_with_semantic_icache
,
87 /* As for generate_calls_with_direct_access_icache */
89 generate_jumps_with_direct_access_icache
90 = generate_jumps_with_icache
| generate_with_direct_access_icache
,
92 generate_jumps_with_direct_access_semantic_icache
93 = generate_jumps_with_direct_access_icache
| generate_with_semantic_icache
,
97 extern igen_code code
;
102 extern int icache_size
;
105 /* Instruction expansion?
107 Should the semantic code for each instruction, when the oportunity
108 arrises, be expanded according to the variable opcode files that
109 the instruction decode process renders constant */
111 extern int generate_expanded_instructions
;
116 Should the generated code include SMP support (>0) and if so, for
117 how many processors? */
119 extern int generate_smp
;
128 /* Function header definitions */
131 /* Cache functions: */
133 #define ICACHE_FUNCTION_FORMAL \
135 instruction_word instruction,\n\
136 unsigned_word cia,\n\
137 idecode_cache *cache_entry"
139 #define ICACHE_FUNCTION_ACTUAL "processor, instruction, cia, cache_entry"
141 #define ICACHE_FUNCTION_TYPE \
142 ((code & generate_with_semantic_icache) \
143 ? SEMANTIC_FUNCTION_TYPE \
144 : "idecode_semantic *")
147 /* Semantic functions: */
149 #define SEMANTIC_FUNCTION_FORMAL \
150 ((code & generate_with_icache) \
151 ? "cpu *processor,\n idecode_cache *cache_entry,\n unsigned_word cia" \
152 : "cpu *processor,\n instruction_word instruction,\n unsigned_word cia")
154 #define SEMANTIC_FUNCTION_ACTUAL \
155 ((code & generate_with_icache) \
156 ? "processor, instruction, cia, cache_entry" \
157 : "processor, instruction, cia")
159 #define SEMANTIC_FUNCTION_TYPE "unsigned_word"
163 extern void print_define_my_index
165 table_entry
*file_entry
);
167 extern void print_itrace
169 table_entry
*file_entry
,
174 function_name_prefix_semantics
,
175 function_name_prefix_idecode
,
176 function_name_prefix_itable
,
177 function_name_prefix_goto
,
178 function_name_prefix_icache
,
179 function_name_prefix_none
180 } lf_function_name_prefixes
;
182 extern int print_function_name
184 const char *basename
,
185 insn_bits
*expanded_bits
,
186 lf_function_name_prefixes prefix
);