1 /* CPU family header for sh64.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright 1996-2010 Free Software Foundation, Inc.
7 This file is part of the GNU simulators.
9 This file 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 3, or (at your option)
14 It is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 License for more details.
19 You should have received a copy of the GNU General Public License along
20 with this program; if not, write to the Free Software Foundation, Inc.,
21 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
28 /* Maximum number of instructions that are fetched at a time.
29 This is for LIW type instructions sets (e.g. m32r). */
30 #define MAX_LIW_INSNS 1
32 /* Maximum number of instructions that can be executed in parallel. */
33 #define MAX_PARALLEL_INSNS 1
35 /* The size of an "int" needed to hold an instruction word.
36 This is usually 32 bits, but some architectures needs 64 bits. */
37 typedef CGEN_INSN_INT CGEN_INSN_WORD;
39 #include "cgen-engine.h"
41 /* CPU state information. */
43 /* Hardware elements. */
47 #define GET_H_PC() CPU (h_pc)
51 CPU (h_ism) = ANDDI ((x), 1);\
52 CPU (h_pc) = ANDDI ((x), INVDI (1));\
55 /* General purpose integer registers */
57 #define GET_H_GR(index) ((((index) == (63))) ? (MAKEDI (0, 0)) : (CPU (h_gr[index])))
58 #define SET_H_GR(index, x) \
60 if ((((index)) != (63))) {\
61 CPU (h_gr[(index)]) = (x);\
66 /* Control registers */
68 #define GET_H_CR(index) ((((index) == (0))) ? (ZEXTSIDI (CPU (h_sr))) : (CPU (h_cr[index])))
69 #define SET_H_CR(index, x) \
71 if ((((index)) == (0))) {\
74 CPU (h_cr[(index)]) = (x);\
79 #define GET_H_SR() CPU (h_sr)
80 #define SET_H_SR(x) (CPU (h_sr) = (x))
81 /* Floating point status and control register */
83 #define GET_H_FPSCR() CPU (h_fpscr)
84 #define SET_H_FPSCR(x) (CPU (h_fpscr) = (x))
85 /* Single precision floating point registers */
87 #define GET_H_FR(a1) CPU (h_fr)[a1]
88 #define SET_H_FR(a1, x) (CPU (h_fr)[a1] = (x))
89 /* Single/Double precision floating point registers */
91 #define GET_H_FSD(index) ((GET_H_PRBIT ()) ? (GET_H_DRC (index)) : (CGEN_CPU_FPU (current_cpu)->ops->fextsfdf (CGEN_CPU_FPU (current_cpu), CPU (h_fr[index]))))
92 #define SET_H_FSD(index, x) \
94 if (GET_H_PRBIT ()) {\
95 SET_H_DRC ((index), (x));\
97 SET_H_FRC ((index), CGEN_CPU_FPU (current_cpu)->ops->ftruncdfsf (CGEN_CPU_FPU (current_cpu), (x)));\
100 /* floating point registers for fmov */
102 #define GET_H_FMOV(index) ((NOTBI (GET_H_SZBIT ())) ? (CGEN_CPU_FPU (current_cpu)->ops->fextsfdf (CGEN_CPU_FPU (current_cpu), GET_H_FRC (index))) : (((((((index) & (1))) == (1))) ? (GET_H_XD (((index) & ((~ (1)))))) : (GET_H_DR (index)))))
103 #define SET_H_FMOV(index, x) \
105 if (NOTBI (GET_H_SZBIT ())) {\
106 SET_H_FRC ((index), CGEN_CPU_FPU (current_cpu)->ops->ftruncdfsf (CGEN_CPU_FPU (current_cpu), (x)));\
108 if ((((((index)) & (1))) == (1))) {\
109 SET_H_XD ((((index)) & ((~ (1)))), (x));\
111 SET_H_DR ((index), (x));\
115 /* Branch target registers */
117 #define GET_H_TR(a1) CPU (h_tr)[a1]
118 #define SET_H_TR(a1, x) (CPU (h_tr)[a1] = (x))
119 /* Current instruction set mode */
121 #define GET_H_ISM() CPU (h_ism)
122 #define SET_H_ISM(x) \
124 cgen_rtx_error (current_cpu, "cannot set ism directly");\
127 #define CPU_CGEN_HW(cpu) (& (cpu)->cpu_data.hardware)
132 #define GET_H_GRC(index) ANDDI (CPU (h_gr[index]), ZEXTSIDI (0xffffffff))
133 #define SET_H_GRC(index, x) \
135 CPU (h_gr[(index)]) = EXTSIDI ((x));\
137 #define GET_H_FRBIT() ANDSI (SRLSI (CPU (h_fpscr), 21), 1)
138 #define SET_H_FRBIT(x) \
140 CPU (h_fpscr) = ORSI (ANDSI (CPU (h_fpscr), (~ (((1) << (21))))), SLLSI ((x), 21));\
142 #define GET_H_SZBIT() ANDSI (SRLSI (CPU (h_fpscr), 20), 1)
143 #define SET_H_SZBIT(x) \
145 CPU (h_fpscr) = ORSI (ANDSI (CPU (h_fpscr), (~ (((1) << (20))))), SLLSI ((x), 20));\
147 #define GET_H_PRBIT() ANDSI (SRLSI (CPU (h_fpscr), 19), 1)
148 #define SET_H_PRBIT(x) \
150 CPU (h_fpscr) = ORSI (ANDSI (CPU (h_fpscr), (~ (((1) << (19))))), SLLSI ((x), 19));\
152 #define GET_H_SBIT() ANDSI (SRLSI (CPU (h_sr), 1), 1)
153 #define SET_H_SBIT(x) \
155 CPU (h_sr) = ORSI (ANDSI (CPU (h_sr), (~ (2))), SLLSI ((x), 1));\
157 #define GET_H_MBIT() ANDSI (SRLSI (CPU (h_sr), 9), 1)
158 #define SET_H_MBIT(x) \
160 CPU (h_sr) = ORSI (ANDSI (CPU (h_sr), (~ (((1) << (9))))), SLLSI ((x), 9));\
162 #define GET_H_QBIT() ANDSI (SRLSI (CPU (h_sr), 8), 1)
163 #define SET_H_QBIT(x) \
165 CPU (h_sr) = ORSI (ANDSI (CPU (h_sr), (~ (((1) << (8))))), SLLSI ((x), 8));\
167 #define GET_H_FP(index) CPU (h_fr[index])
168 #define SET_H_FP(index, x) \
170 CPU (h_fr[(index)]) = (x);\
172 #define GET_H_FV(index) CPU (h_fr[index])
173 #define SET_H_FV(index, x) \
175 CPU (h_fr[(index)]) = (x);\
177 #define GET_H_FMTX(index) CPU (h_fr[index])
178 #define SET_H_FMTX(index, x) \
180 CPU (h_fr[(index)]) = (x);\
182 #define GET_H_DR(index) SUBWORDDIDF (ORDI (SLLDI (ZEXTSIDI (SUBWORDSFSI (CPU (h_fr[index]))), 32), ZEXTSIDI (SUBWORDSFSI (CPU (h_fr[((index) + (1))])))))
183 #define SET_H_DR(index, x) \
186 CPU (h_fr[(index)]) = SUBWORDSISF (SUBWORDDFSI ((x), 0));\
187 CPU (h_fr[(((index)) + (1))]) = SUBWORDSISF (SUBWORDDFSI ((x), 1));\
190 #define GET_H_ENDIAN() sh64_endian (current_cpu)
191 #define SET_H_ENDIAN(x) \
193 cgen_rtx_error (current_cpu, "cannot alter target byte order mid-program");\
195 #define GET_H_FRC(index) CPU (h_fr[((((16) * (GET_H_FRBIT ()))) + (index))])
196 #define SET_H_FRC(index, x) \
198 CPU (h_fr[((((16) * (GET_H_FRBIT ()))) + ((index)))]) = (x);\
200 #define GET_H_DRC(index) GET_H_DR (((((16) * (GET_H_FRBIT ()))) + (index)))
201 #define SET_H_DRC(index, x) \
203 SET_H_DR (((((16) * (GET_H_FRBIT ()))) + ((index))), (x));\
205 #define GET_H_XF(index) CPU (h_fr[((((16) * (NOTBI (GET_H_FRBIT ())))) + (index))])
206 #define SET_H_XF(index, x) \
208 CPU (h_fr[((((16) * (NOTBI (GET_H_FRBIT ())))) + ((index)))]) = (x);\
210 #define GET_H_XD(index) GET_H_DR (((((16) * (NOTBI (GET_H_FRBIT ())))) + (index)))
211 #define SET_H_XD(index, x) \
213 SET_H_DR (((((16) * (NOTBI (GET_H_FRBIT ())))) + ((index))), (x));\
215 #define GET_H_FVC(index) CPU (h_fr[((((16) * (GET_H_FRBIT ()))) + (index))])
216 #define SET_H_FVC(index, x) \
218 CPU (h_fr[((((16) * (GET_H_FRBIT ()))) + ((index)))]) = (x);\
220 #define GET_H_GBR() SUBWORDDISI (CPU (h_gr[((UINT) 16)]), 1)
221 #define SET_H_GBR(x) \
223 CPU (h_gr[((UINT) 16)]) = EXTSIDI ((x));\
225 #define GET_H_VBR() SUBWORDDISI (CPU (h_gr[((UINT) 20)]), 1)
226 #define SET_H_VBR(x) \
228 CPU (h_gr[((UINT) 20)]) = EXTSIDI ((x));\
230 #define GET_H_PR() SUBWORDDISI (CPU (h_gr[((UINT) 18)]), 1)
231 #define SET_H_PR(x) \
233 CPU (h_gr[((UINT) 18)]) = EXTSIDI ((x));\
235 #define GET_H_MACL() SUBWORDDISI (CPU (h_gr[((UINT) 17)]), 1)
236 #define SET_H_MACL(x) \
238 CPU (h_gr[((UINT) 17)]) = ORDI (SLLDI (ZEXTSIDI (SUBWORDDISI (CPU (h_gr[((UINT) 17)]), 0)), 32), ZEXTSIDI ((x)));\
240 #define GET_H_MACH() SUBWORDDISI (CPU (h_gr[((UINT) 17)]), 0)
241 #define SET_H_MACH(x) \
243 CPU (h_gr[((UINT) 17)]) = ORDI (SLLDI (ZEXTSIDI ((x)), 32), ZEXTSIDI (SUBWORDDISI (CPU (h_gr[((UINT) 17)]), 1)));\
245 #define GET_H_TBIT() ANDBI (CPU (h_gr[((UINT) 19)]), 1)
246 #define SET_H_TBIT(x) \
248 CPU (h_gr[((UINT) 19)]) = ORDI (ANDDI (CPU (h_gr[((UINT) 19)]), INVDI (1)), ZEXTBIDI ((x)));\
251 /* Cover fns for register access. */
252 UDI sh64_h_pc_get (SIM_CPU *);
253 void sh64_h_pc_set (SIM_CPU *, UDI);
254 DI sh64_h_gr_get (SIM_CPU *, UINT);
255 void sh64_h_gr_set (SIM_CPU *, UINT, DI);
256 SI sh64_h_grc_get (SIM_CPU *, UINT);
257 void sh64_h_grc_set (SIM_CPU *, UINT, SI);
258 DI sh64_h_cr_get (SIM_CPU *, UINT);
259 void sh64_h_cr_set (SIM_CPU *, UINT, DI);
260 SI sh64_h_sr_get (SIM_CPU *);
261 void sh64_h_sr_set (SIM_CPU *, SI);
262 SI sh64_h_fpscr_get (SIM_CPU *);
263 void sh64_h_fpscr_set (SIM_CPU *, SI);
264 BI sh64_h_frbit_get (SIM_CPU *);
265 void sh64_h_frbit_set (SIM_CPU *, BI);
266 BI sh64_h_szbit_get (SIM_CPU *);
267 void sh64_h_szbit_set (SIM_CPU *, BI);
268 BI sh64_h_prbit_get (SIM_CPU *);
269 void sh64_h_prbit_set (SIM_CPU *, BI);
270 BI sh64_h_sbit_get (SIM_CPU *);
271 void sh64_h_sbit_set (SIM_CPU *, BI);
272 BI sh64_h_mbit_get (SIM_CPU *);
273 void sh64_h_mbit_set (SIM_CPU *, BI);
274 BI sh64_h_qbit_get (SIM_CPU *);
275 void sh64_h_qbit_set (SIM_CPU *, BI);
276 SF sh64_h_fr_get (SIM_CPU *, UINT);
277 void sh64_h_fr_set (SIM_CPU *, UINT, SF);
278 SF sh64_h_fp_get (SIM_CPU *, UINT);
279 void sh64_h_fp_set (SIM_CPU *, UINT, SF);
280 SF sh64_h_fv_get (SIM_CPU *, UINT);
281 void sh64_h_fv_set (SIM_CPU *, UINT, SF);
282 SF sh64_h_fmtx_get (SIM_CPU *, UINT);
283 void sh64_h_fmtx_set (SIM_CPU *, UINT, SF);
284 DF sh64_h_dr_get (SIM_CPU *, UINT);
285 void sh64_h_dr_set (SIM_CPU *, UINT, DF);
286 DF sh64_h_fsd_get (SIM_CPU *, UINT);
287 void sh64_h_fsd_set (SIM_CPU *, UINT, DF);
288 DF sh64_h_fmov_get (SIM_CPU *, UINT);
289 void sh64_h_fmov_set (SIM_CPU *, UINT, DF);
290 DI sh64_h_tr_get (SIM_CPU *, UINT);
291 void sh64_h_tr_set (SIM_CPU *, UINT, DI);
292 BI sh64_h_endian_get (SIM_CPU *);
293 void sh64_h_endian_set (SIM_CPU *, BI);
294 BI sh64_h_ism_get (SIM_CPU *);
295 void sh64_h_ism_set (SIM_CPU *, BI);
296 SF sh64_h_frc_get (SIM_CPU *, UINT);
297 void sh64_h_frc_set (SIM_CPU *, UINT, SF);
298 DF sh64_h_drc_get (SIM_CPU *, UINT);
299 void sh64_h_drc_set (SIM_CPU *, UINT, DF);
300 SF sh64_h_xf_get (SIM_CPU *, UINT);
301 void sh64_h_xf_set (SIM_CPU *, UINT, SF);
302 DF sh64_h_xd_get (SIM_CPU *, UINT);
303 void sh64_h_xd_set (SIM_CPU *, UINT, DF);
304 SF sh64_h_fvc_get (SIM_CPU *, UINT);
305 void sh64_h_fvc_set (SIM_CPU *, UINT, SF);
306 SI sh64_h_gbr_get (SIM_CPU *);
307 void sh64_h_gbr_set (SIM_CPU *, SI);
308 SI sh64_h_vbr_get (SIM_CPU *);
309 void sh64_h_vbr_set (SIM_CPU *, SI);
310 SI sh64_h_pr_get (SIM_CPU *);
311 void sh64_h_pr_set (SIM_CPU *, SI);
312 SI sh64_h_macl_get (SIM_CPU *);
313 void sh64_h_macl_set (SIM_CPU *, SI);
314 SI sh64_h_mach_get (SIM_CPU *);
315 void sh64_h_mach_set (SIM_CPU *, SI);
316 BI sh64_h_tbit_get (SIM_CPU *);
317 void sh64_h_tbit_set (SIM_CPU *, BI);
319 /* These must be hand-written. */
320 extern CPUREG_FETCH_FN sh64_fetch_register;
321 extern CPUREG_STORE_FN sh64_store_register;
333 } MODEL_SH5_MEDIA_DATA;
335 /* Collection of various things for the trace handler to use. */
337 typedef struct trace_record {
342 #endif /* CPU_SH64_H */