1 /* CPU family header for iq2000bf.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright 1996-2019 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, see <http://www.gnu.org/licenses/>.
24 #ifndef CPU_IQ2000BF_H
25 #define CPU_IQ2000BF_H
27 /* Maximum number of instructions that are fetched at a time.
28 This is for LIW type instructions sets (e.g. m32r). */
29 #define MAX_LIW_INSNS 1
31 /* Maximum number of instructions that can be executed in parallel. */
32 #define MAX_PARALLEL_INSNS 1
34 /* The size of an "int" needed to hold an instruction word.
35 This is usually 32 bits, but some architectures needs 64 bits. */
36 typedef CGEN_INSN_INT CGEN_INSN_WORD
;
38 #include "cgen-engine.h"
40 /* CPU state information. */
42 /* Hardware elements. */
46 #define GET_H_PC() get_h_pc (current_cpu)
49 set_h_pc (current_cpu, (x));\
51 /* General purpose registers */
53 #define GET_H_GR(index) (((index) == (0))) ? (0) : (CPU (h_gr[index]))
54 #define SET_H_GR(index, x) \
56 if ((((index)) == (0))) {\
60 CPU (h_gr[(index)]) = (x);\
64 #define CPU_CGEN_HW(cpu) (& (cpu)->cpu_data.hardware)
67 /* Cover fns for register access. */
68 USI
iq2000bf_h_pc_get (SIM_CPU
*);
69 void iq2000bf_h_pc_set (SIM_CPU
*, USI
);
70 SI
iq2000bf_h_gr_get (SIM_CPU
*, UINT
);
71 void iq2000bf_h_gr_set (SIM_CPU
*, UINT
, SI
);
73 /* These must be hand-written. */
74 extern CPUREG_FETCH_FN iq2000bf_fetch_register
;
75 extern CPUREG_STORE_FN iq2000bf_store_register
;
81 /* Instruction argument buffer. */
84 struct { /* no operands */
114 /* Writeback handler. */
116 /* Pointer to argbuf entry for insn whose results need writing back. */
117 const struct argbuf
*abuf
;
119 /* x-before handler */
121 /*const SCACHE *insns[MAX_PARALLEL_INSNS];*/
124 /* x-after handler */
128 /* This entry is used to terminate each pbb. */
130 /* Number of insns in pbb. */
132 /* Next pbb to execute. */
134 SCACHE
*branch_target
;
139 /* The ARGBUF struct. */
141 /* These are the baseclass definitions. */
146 /* ??? Temporary hack for skip insns. */
149 /* cpu specific data follows */
152 union sem_fields fields
;
157 ??? SCACHE used to contain more than just argbuf. We could delete the
158 type entirely and always just use ARGBUF, but for future concerns and as
159 a level of abstraction it is left in. */
162 struct argbuf argbuf
;
165 /* Macros to simplify extraction, reading and semantic code.
166 These define and assign the local vars that contain the insn's fields. */
168 #define EXTRACT_IFMT_EMPTY_VARS \
170 #define EXTRACT_IFMT_EMPTY_CODE \
173 #define EXTRACT_IFMT_ADD_VARS \
181 #define EXTRACT_IFMT_ADD_CODE \
183 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
184 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
185 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
186 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
187 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
188 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
190 #define EXTRACT_IFMT_ADDI_VARS \
196 #define EXTRACT_IFMT_ADDI_CODE \
198 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
199 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
200 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
201 f_imm = EXTRACT_LSB0_UINT (insn, 32, 15, 16); \
203 #define EXTRACT_IFMT_RAM_VARS \
212 #define EXTRACT_IFMT_RAM_CODE \
214 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
215 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
216 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
217 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
218 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
219 f_5 = EXTRACT_LSB0_UINT (insn, 32, 5, 1); \
220 f_maskl = EXTRACT_LSB0_UINT (insn, 32, 4, 5); \
222 #define EXTRACT_IFMT_SLL_VARS \
230 #define EXTRACT_IFMT_SLL_CODE \
232 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
233 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
234 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
235 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
236 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
237 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
239 #define EXTRACT_IFMT_SLMV_VARS \
247 #define EXTRACT_IFMT_SLMV_CODE \
249 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
250 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
251 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
252 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
253 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
254 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
256 #define EXTRACT_IFMT_SLTI_VARS \
262 #define EXTRACT_IFMT_SLTI_CODE \
264 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
265 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
266 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
267 f_imm = EXTRACT_LSB0_UINT (insn, 32, 15, 16); \
269 #define EXTRACT_IFMT_BBI_VARS \
275 #define EXTRACT_IFMT_BBI_CODE \
277 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
278 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
279 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
280 f_offset = ((((EXTRACT_LSB0_SINT (insn, 32, 15, 16)) << (2))) + (((pc) + (4)))); \
282 #define EXTRACT_IFMT_BBV_VARS \
288 #define EXTRACT_IFMT_BBV_CODE \
290 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
291 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
292 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
293 f_offset = ((((EXTRACT_LSB0_SINT (insn, 32, 15, 16)) << (2))) + (((pc) + (4)))); \
295 #define EXTRACT_IFMT_BGEZ_VARS \
301 #define EXTRACT_IFMT_BGEZ_CODE \
303 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
304 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
305 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
306 f_offset = ((((EXTRACT_LSB0_SINT (insn, 32, 15, 16)) << (2))) + (((pc) + (4)))); \
308 #define EXTRACT_IFMT_JALR_VARS \
316 #define EXTRACT_IFMT_JALR_CODE \
318 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
319 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
320 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
321 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
322 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
323 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
325 #define EXTRACT_IFMT_JR_VARS \
333 #define EXTRACT_IFMT_JR_CODE \
335 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
336 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
337 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
338 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
339 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
340 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
342 #define EXTRACT_IFMT_LB_VARS \
348 #define EXTRACT_IFMT_LB_CODE \
350 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
351 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
352 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
353 f_imm = EXTRACT_LSB0_UINT (insn, 32, 15, 16); \
355 #define EXTRACT_IFMT_LUI_VARS \
361 #define EXTRACT_IFMT_LUI_CODE \
363 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
364 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
365 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
366 f_imm = EXTRACT_LSB0_UINT (insn, 32, 15, 16); \
368 #define EXTRACT_IFMT_BREAK_VARS \
376 #define EXTRACT_IFMT_BREAK_CODE \
378 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
379 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
380 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
381 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
382 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
383 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
385 #define EXTRACT_IFMT_SYSCALL_VARS \
390 #define EXTRACT_IFMT_SYSCALL_CODE \
392 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
393 f_excode = EXTRACT_LSB0_UINT (insn, 32, 25, 20); \
394 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
396 #define EXTRACT_IFMT_ANDOUI_VARS \
402 #define EXTRACT_IFMT_ANDOUI_CODE \
404 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
405 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
406 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
407 f_imm = EXTRACT_LSB0_UINT (insn, 32, 15, 16); \
409 #define EXTRACT_IFMT_MRGB_VARS \
418 #define EXTRACT_IFMT_MRGB_CODE \
420 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
421 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
422 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
423 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
424 f_10 = EXTRACT_LSB0_UINT (insn, 32, 10, 1); \
425 f_mask = EXTRACT_LSB0_UINT (insn, 32, 9, 4); \
426 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
428 #define EXTRACT_IFMT_BC0F_VARS \
434 #define EXTRACT_IFMT_BC0F_CODE \
436 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
437 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
438 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
439 f_offset = ((((EXTRACT_LSB0_SINT (insn, 32, 15, 16)) << (2))) + (((pc) + (4)))); \
441 #define EXTRACT_IFMT_CFC0_VARS \
448 #define EXTRACT_IFMT_CFC0_CODE \
450 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
451 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
452 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
453 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
454 f_10_11 = EXTRACT_LSB0_UINT (insn, 32, 10, 11); \
456 #define EXTRACT_IFMT_CHKHDR_VARS \
464 #define EXTRACT_IFMT_CHKHDR_CODE \
466 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
467 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
468 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
469 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
470 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
471 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
473 #define EXTRACT_IFMT_LULCK_VARS \
481 #define EXTRACT_IFMT_LULCK_CODE \
483 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
484 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
485 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
486 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
487 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
488 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
490 #define EXTRACT_IFMT_PKRLR1_VARS \
497 #define EXTRACT_IFMT_PKRLR1_CODE \
499 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
500 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
501 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
502 f_count = EXTRACT_LSB0_UINT (insn, 32, 15, 7); \
503 f_index = EXTRACT_LSB0_UINT (insn, 32, 8, 9); \
505 #define EXTRACT_IFMT_RFE_VARS \
511 #define EXTRACT_IFMT_RFE_CODE \
513 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
514 f_25 = EXTRACT_LSB0_UINT (insn, 32, 25, 1); \
515 f_24_19 = EXTRACT_LSB0_UINT (insn, 32, 24, 19); \
516 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
518 #define EXTRACT_IFMT_J_VARS \
523 #define EXTRACT_IFMT_J_CODE \
525 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
526 f_rsrvd = EXTRACT_LSB0_UINT (insn, 32, 25, 10); \
527 f_jtarg = ((((pc) & (0xf0000000))) | (((EXTRACT_LSB0_UINT (insn, 32, 15, 16)) << (2)))); \
529 /* Collection of various things for the trace handler to use. */
531 typedef struct trace_record
{
536 #endif /* CPU_IQ2000BF_H */