1 /* CPU family header for iq2000bf.
3 THIS FILE IS MACHINE GENERATED WITH CGEN.
5 Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
7 This file is part of the GNU simulators.
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, or (at your option)
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 along
20 with this program; if not, write to the Free Software Foundation, Inc.,
21 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 #ifndef CPU_IQ2000BF_H
26 #define CPU_IQ2000BF_H
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 /* CPU state information. */
37 /* Hardware elements. */
41 #define GET_H_PC() get_h_pc (current_cpu)
44 set_h_pc (current_cpu, (x));\
46 /* General purpose registers */
48 #define GET_H_GR(index) (((index) == (0))) ? (0) : (CPU (h_gr[index]))
49 #define SET_H_GR(index, x) \
51 if ((((index)) == (0))) {\
55 CPU (h_gr[(index)]) = (x);\
59 #define CPU_CGEN_HW(cpu) (& (cpu)->cpu_data.hardware)
62 /* Cover fns for register access. */
63 USI
iq2000bf_h_pc_get (SIM_CPU
*);
64 void iq2000bf_h_pc_set (SIM_CPU
*, USI
);
65 SI
iq2000bf_h_gr_get (SIM_CPU
*, UINT
);
66 void iq2000bf_h_gr_set (SIM_CPU
*, UINT
, SI
);
68 /* These must be hand-written. */
69 extern CPUREG_FETCH_FN iq2000bf_fetch_register
;
70 extern CPUREG_STORE_FN iq2000bf_store_register
;
76 /* Instruction argument buffer. */
79 struct { /* no operands */
109 /* Writeback handler. */
111 /* Pointer to argbuf entry for insn whose results need writing back. */
112 const struct argbuf
*abuf
;
114 /* x-before handler */
116 /*const SCACHE *insns[MAX_PARALLEL_INSNS];*/
119 /* x-after handler */
123 /* This entry is used to terminate each pbb. */
125 /* Number of insns in pbb. */
127 /* Next pbb to execute. */
129 SCACHE
*branch_target
;
134 /* The ARGBUF struct. */
136 /* These are the baseclass definitions. */
141 /* ??? Temporary hack for skip insns. */
144 /* cpu specific data follows */
147 union sem_fields fields
;
152 ??? SCACHE used to contain more than just argbuf. We could delete the
153 type entirely and always just use ARGBUF, but for future concerns and as
154 a level of abstraction it is left in. */
157 struct argbuf argbuf
;
160 /* Macros to simplify extraction, reading and semantic code.
161 These define and assign the local vars that contain the insn's fields. */
163 #define EXTRACT_IFMT_EMPTY_VARS \
165 #define EXTRACT_IFMT_EMPTY_CODE \
168 #define EXTRACT_IFMT_ADD_VARS \
176 #define EXTRACT_IFMT_ADD_CODE \
178 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
179 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
180 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
181 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
182 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
183 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
185 #define EXTRACT_IFMT_ADDI_VARS \
191 #define EXTRACT_IFMT_ADDI_CODE \
193 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
194 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
195 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
196 f_imm = EXTRACT_LSB0_UINT (insn, 32, 15, 16); \
198 #define EXTRACT_IFMT_RAM_VARS \
207 #define EXTRACT_IFMT_RAM_CODE \
209 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
210 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
211 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
212 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
213 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
214 f_5 = EXTRACT_LSB0_UINT (insn, 32, 5, 1); \
215 f_maskl = EXTRACT_LSB0_UINT (insn, 32, 4, 5); \
217 #define EXTRACT_IFMT_SLL_VARS \
225 #define EXTRACT_IFMT_SLL_CODE \
227 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
228 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
229 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
230 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
231 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
232 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
234 #define EXTRACT_IFMT_SLMV_VARS \
242 #define EXTRACT_IFMT_SLMV_CODE \
244 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
245 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
246 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
247 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
248 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
249 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
251 #define EXTRACT_IFMT_SLTI_VARS \
257 #define EXTRACT_IFMT_SLTI_CODE \
259 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
260 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
261 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
262 f_imm = EXTRACT_LSB0_UINT (insn, 32, 15, 16); \
264 #define EXTRACT_IFMT_BBI_VARS \
270 #define EXTRACT_IFMT_BBI_CODE \
272 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
273 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
274 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
275 f_offset = ((((EXTRACT_LSB0_INT (insn, 32, 15, 16)) << (2))) + (((pc) + (4)))); \
277 #define EXTRACT_IFMT_BBV_VARS \
283 #define EXTRACT_IFMT_BBV_CODE \
285 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
286 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
287 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
288 f_offset = ((((EXTRACT_LSB0_INT (insn, 32, 15, 16)) << (2))) + (((pc) + (4)))); \
290 #define EXTRACT_IFMT_BGEZ_VARS \
296 #define EXTRACT_IFMT_BGEZ_CODE \
298 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
299 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
300 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
301 f_offset = ((((EXTRACT_LSB0_INT (insn, 32, 15, 16)) << (2))) + (((pc) + (4)))); \
303 #define EXTRACT_IFMT_JALR_VARS \
311 #define EXTRACT_IFMT_JALR_CODE \
313 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
314 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
315 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
316 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
317 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
318 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
320 #define EXTRACT_IFMT_JR_VARS \
328 #define EXTRACT_IFMT_JR_CODE \
330 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
331 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
332 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
333 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
334 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
335 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
337 #define EXTRACT_IFMT_LB_VARS \
343 #define EXTRACT_IFMT_LB_CODE \
345 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
346 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
347 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
348 f_imm = EXTRACT_LSB0_UINT (insn, 32, 15, 16); \
350 #define EXTRACT_IFMT_LUI_VARS \
356 #define EXTRACT_IFMT_LUI_CODE \
358 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
359 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
360 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
361 f_imm = EXTRACT_LSB0_UINT (insn, 32, 15, 16); \
363 #define EXTRACT_IFMT_BREAK_VARS \
371 #define EXTRACT_IFMT_BREAK_CODE \
373 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
374 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
375 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
376 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
377 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
378 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
380 #define EXTRACT_IFMT_SYSCALL_VARS \
385 #define EXTRACT_IFMT_SYSCALL_CODE \
387 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
388 f_excode = EXTRACT_LSB0_UINT (insn, 32, 25, 20); \
389 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
391 #define EXTRACT_IFMT_ANDOUI_VARS \
397 #define EXTRACT_IFMT_ANDOUI_CODE \
399 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
400 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
401 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
402 f_imm = EXTRACT_LSB0_UINT (insn, 32, 15, 16); \
404 #define EXTRACT_IFMT_MRGB_VARS \
413 #define EXTRACT_IFMT_MRGB_CODE \
415 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
416 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
417 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
418 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
419 f_10 = EXTRACT_LSB0_UINT (insn, 32, 10, 1); \
420 f_mask = EXTRACT_LSB0_UINT (insn, 32, 9, 4); \
421 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
423 #define EXTRACT_IFMT_BC0F_VARS \
429 #define EXTRACT_IFMT_BC0F_CODE \
431 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
432 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
433 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
434 f_offset = ((((EXTRACT_LSB0_INT (insn, 32, 15, 16)) << (2))) + (((pc) + (4)))); \
436 #define EXTRACT_IFMT_CFC0_VARS \
443 #define EXTRACT_IFMT_CFC0_CODE \
445 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
446 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
447 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
448 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
449 f_10_11 = EXTRACT_LSB0_UINT (insn, 32, 10, 11); \
451 #define EXTRACT_IFMT_CHKHDR_VARS \
459 #define EXTRACT_IFMT_CHKHDR_CODE \
461 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
462 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
463 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
464 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
465 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
466 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
468 #define EXTRACT_IFMT_LULCK_VARS \
476 #define EXTRACT_IFMT_LULCK_CODE \
478 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
479 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
480 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
481 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
482 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
483 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
485 #define EXTRACT_IFMT_PKRLR1_VARS \
492 #define EXTRACT_IFMT_PKRLR1_CODE \
494 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
495 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
496 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
497 f_count = EXTRACT_LSB0_UINT (insn, 32, 15, 7); \
498 f_index = EXTRACT_LSB0_UINT (insn, 32, 8, 9); \
500 #define EXTRACT_IFMT_RFE_VARS \
506 #define EXTRACT_IFMT_RFE_CODE \
508 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
509 f_25 = EXTRACT_LSB0_UINT (insn, 32, 25, 1); \
510 f_24_19 = EXTRACT_LSB0_UINT (insn, 32, 24, 19); \
511 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
513 #define EXTRACT_IFMT_J_VARS \
518 #define EXTRACT_IFMT_J_CODE \
520 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
521 f_rsrvd = EXTRACT_LSB0_UINT (insn, 32, 25, 10); \
522 f_jtarg = ((((pc) & (0xf0000000))) | (((EXTRACT_LSB0_UINT (insn, 32, 15, 16)) << (2)))); \
524 /* Collection of various things for the trace handler to use. */
526 typedef struct trace_record
{
531 #endif /* CPU_IQ2000BF_H */