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 3 of the License, or
12 (at your option) any later version.
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
20 along 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 /* CPU state information. */
36 /* Hardware elements. */
40 #define GET_H_PC() get_h_pc (current_cpu)
43 set_h_pc (current_cpu, (x));\
45 /* General purpose registers */
47 #define GET_H_GR(index) (((index) == (0))) ? (0) : (CPU (h_gr[index]))
48 #define SET_H_GR(index, x) \
50 if ((((index)) == (0))) {\
54 CPU (h_gr[(index)]) = (x);\
58 #define CPU_CGEN_HW(cpu) (& (cpu)->cpu_data.hardware)
61 /* Cover fns for register access. */
62 USI
iq2000bf_h_pc_get (SIM_CPU
*);
63 void iq2000bf_h_pc_set (SIM_CPU
*, USI
);
64 SI
iq2000bf_h_gr_get (SIM_CPU
*, UINT
);
65 void iq2000bf_h_gr_set (SIM_CPU
*, UINT
, SI
);
67 /* These must be hand-written. */
68 extern CPUREG_FETCH_FN iq2000bf_fetch_register
;
69 extern CPUREG_STORE_FN iq2000bf_store_register
;
75 /* Instruction argument buffer. */
78 struct { /* no operands */
108 /* Writeback handler. */
110 /* Pointer to argbuf entry for insn whose results need writing back. */
111 const struct argbuf
*abuf
;
113 /* x-before handler */
115 /*const SCACHE *insns[MAX_PARALLEL_INSNS];*/
118 /* x-after handler */
122 /* This entry is used to terminate each pbb. */
124 /* Number of insns in pbb. */
126 /* Next pbb to execute. */
128 SCACHE
*branch_target
;
133 /* The ARGBUF struct. */
135 /* These are the baseclass definitions. */
140 /* ??? Temporary hack for skip insns. */
143 /* cpu specific data follows */
146 union sem_fields fields
;
151 ??? SCACHE used to contain more than just argbuf. We could delete the
152 type entirely and always just use ARGBUF, but for future concerns and as
153 a level of abstraction it is left in. */
156 struct argbuf argbuf
;
159 /* Macros to simplify extraction, reading and semantic code.
160 These define and assign the local vars that contain the insn's fields. */
162 #define EXTRACT_IFMT_EMPTY_VARS \
164 #define EXTRACT_IFMT_EMPTY_CODE \
167 #define EXTRACT_IFMT_ADD_VARS \
175 #define EXTRACT_IFMT_ADD_CODE \
177 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
178 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
179 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
180 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
181 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
182 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
184 #define EXTRACT_IFMT_ADDI_VARS \
190 #define EXTRACT_IFMT_ADDI_CODE \
192 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
193 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
194 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
195 f_imm = EXTRACT_LSB0_UINT (insn, 32, 15, 16); \
197 #define EXTRACT_IFMT_RAM_VARS \
206 #define EXTRACT_IFMT_RAM_CODE \
208 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
209 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
210 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
211 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
212 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
213 f_5 = EXTRACT_LSB0_UINT (insn, 32, 5, 1); \
214 f_maskl = EXTRACT_LSB0_UINT (insn, 32, 4, 5); \
216 #define EXTRACT_IFMT_SLL_VARS \
224 #define EXTRACT_IFMT_SLL_CODE \
226 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
227 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
228 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
229 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
230 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
231 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
233 #define EXTRACT_IFMT_SLMV_VARS \
241 #define EXTRACT_IFMT_SLMV_CODE \
243 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
244 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
245 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
246 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
247 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
248 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
250 #define EXTRACT_IFMT_SLTI_VARS \
256 #define EXTRACT_IFMT_SLTI_CODE \
258 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
259 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
260 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
261 f_imm = EXTRACT_LSB0_UINT (insn, 32, 15, 16); \
263 #define EXTRACT_IFMT_BBI_VARS \
269 #define EXTRACT_IFMT_BBI_CODE \
271 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
272 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
273 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
274 f_offset = ((((EXTRACT_LSB0_INT (insn, 32, 15, 16)) << (2))) + (((pc) + (4)))); \
276 #define EXTRACT_IFMT_BBV_VARS \
282 #define EXTRACT_IFMT_BBV_CODE \
284 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
285 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
286 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
287 f_offset = ((((EXTRACT_LSB0_INT (insn, 32, 15, 16)) << (2))) + (((pc) + (4)))); \
289 #define EXTRACT_IFMT_BGEZ_VARS \
295 #define EXTRACT_IFMT_BGEZ_CODE \
297 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
298 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
299 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
300 f_offset = ((((EXTRACT_LSB0_INT (insn, 32, 15, 16)) << (2))) + (((pc) + (4)))); \
302 #define EXTRACT_IFMT_JALR_VARS \
310 #define EXTRACT_IFMT_JALR_CODE \
312 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
313 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
314 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
315 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
316 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
317 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
319 #define EXTRACT_IFMT_JR_VARS \
327 #define EXTRACT_IFMT_JR_CODE \
329 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
330 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
331 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
332 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
333 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
334 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
336 #define EXTRACT_IFMT_LB_VARS \
342 #define EXTRACT_IFMT_LB_CODE \
344 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
345 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
346 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
347 f_imm = EXTRACT_LSB0_UINT (insn, 32, 15, 16); \
349 #define EXTRACT_IFMT_LUI_VARS \
355 #define EXTRACT_IFMT_LUI_CODE \
357 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
358 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
359 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
360 f_imm = EXTRACT_LSB0_UINT (insn, 32, 15, 16); \
362 #define EXTRACT_IFMT_BREAK_VARS \
370 #define EXTRACT_IFMT_BREAK_CODE \
372 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
373 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
374 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
375 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
376 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
377 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
379 #define EXTRACT_IFMT_SYSCALL_VARS \
384 #define EXTRACT_IFMT_SYSCALL_CODE \
386 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
387 f_excode = EXTRACT_LSB0_UINT (insn, 32, 25, 20); \
388 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
390 #define EXTRACT_IFMT_ANDOUI_VARS \
396 #define EXTRACT_IFMT_ANDOUI_CODE \
398 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
399 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
400 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
401 f_imm = EXTRACT_LSB0_UINT (insn, 32, 15, 16); \
403 #define EXTRACT_IFMT_MRGB_VARS \
412 #define EXTRACT_IFMT_MRGB_CODE \
414 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
415 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
416 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
417 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
418 f_10 = EXTRACT_LSB0_UINT (insn, 32, 10, 1); \
419 f_mask = EXTRACT_LSB0_UINT (insn, 32, 9, 4); \
420 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
422 #define EXTRACT_IFMT_BC0F_VARS \
428 #define EXTRACT_IFMT_BC0F_CODE \
430 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
431 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
432 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
433 f_offset = ((((EXTRACT_LSB0_INT (insn, 32, 15, 16)) << (2))) + (((pc) + (4)))); \
435 #define EXTRACT_IFMT_CFC0_VARS \
442 #define EXTRACT_IFMT_CFC0_CODE \
444 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
445 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
446 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
447 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
448 f_10_11 = EXTRACT_LSB0_UINT (insn, 32, 10, 11); \
450 #define EXTRACT_IFMT_CHKHDR_VARS \
458 #define EXTRACT_IFMT_CHKHDR_CODE \
460 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
461 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
462 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
463 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
464 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
465 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
467 #define EXTRACT_IFMT_LULCK_VARS \
475 #define EXTRACT_IFMT_LULCK_CODE \
477 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
478 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
479 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
480 f_rd = EXTRACT_LSB0_UINT (insn, 32, 15, 5); \
481 f_shamt = EXTRACT_LSB0_UINT (insn, 32, 10, 5); \
482 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
484 #define EXTRACT_IFMT_PKRLR1_VARS \
491 #define EXTRACT_IFMT_PKRLR1_CODE \
493 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
494 f_rs = EXTRACT_LSB0_UINT (insn, 32, 25, 5); \
495 f_rt = EXTRACT_LSB0_UINT (insn, 32, 20, 5); \
496 f_count = EXTRACT_LSB0_UINT (insn, 32, 15, 7); \
497 f_index = EXTRACT_LSB0_UINT (insn, 32, 8, 9); \
499 #define EXTRACT_IFMT_RFE_VARS \
505 #define EXTRACT_IFMT_RFE_CODE \
507 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
508 f_25 = EXTRACT_LSB0_UINT (insn, 32, 25, 1); \
509 f_24_19 = EXTRACT_LSB0_UINT (insn, 32, 24, 19); \
510 f_func = EXTRACT_LSB0_UINT (insn, 32, 5, 6); \
512 #define EXTRACT_IFMT_J_VARS \
517 #define EXTRACT_IFMT_J_CODE \
519 f_opcode = EXTRACT_LSB0_UINT (insn, 32, 31, 6); \
520 f_rsrvd = EXTRACT_LSB0_UINT (insn, 32, 25, 10); \
521 f_jtarg = ((((pc) & (0xf0000000))) | (((EXTRACT_LSB0_UINT (insn, 32, 15, 16)) << (2)))); \
523 /* Collection of various things for the trace handler to use. */
525 typedef struct trace_record
{
530 #endif /* CPU_IQ2000BF_H */