]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - sim/h8300/inst.h
Initial creation of sourceware repository
[thirdparty/binutils-gdb.git] / sim / h8300 / inst.h
1 #define DEBUG
2
3 /* These define the size of main memory for the simulator.
4
5 Note the size of main memory for the H8/300H is only 256k. Keeping it
6 small makes the simulator run much faster and consume less memory.
7
8 The linker knows about the limited size of the simulator's main memory
9 on the H8/300H (via the h8300h.sc linker script). So if you change
10 H8300H_MSIZE, be sure to fix the linker script too.
11
12 Also note that there's a separate "eightbit" area aside from main
13 memory. For simplicity, the simulator assumes any data memory reference
14 outside of main memory refers to the eightbit area (in theory, this
15 can only happen when simulating H8/300H programs). We make no attempt
16 to catch overlapping addresses, wrapped addresses, etc etc. */
17 #define H8300_MSIZE (1<<16)
18 #define H8300H_MSIZE (1<<18)
19
20 #define CSIZE 1000
21
22 /* Local register names */
23 typedef enum
24 {
25 R0, R1, R2, R3, R4, R5, R6, R7,
26 R_ZERO,
27 R_PC,
28 R_CCR,
29 R_HARD_0,
30 R_LAST,
31 } reg_type;
32
33
34 /* Structure used to describe addressing */
35
36 typedef struct
37 {
38 int type;
39 int reg;
40 int literal;
41 } ea_type;
42
43
44
45 typedef struct
46 {
47 ea_type src;
48 ea_type dst;
49 int opcode;
50 int next_pc;
51 int oldpc;
52 int cycles;
53 #ifdef DEBUG
54 struct h8_opcode *op;
55 #endif
56 }
57 decoded_inst;
58
59 enum h8300_sim_state {
60 SIM_STATE_RUNNING, SIM_STATE_EXITED, SIM_STATE_SIGNALLED, SIM_STATE_STOPPED
61 };
62
63 typedef struct
64 {
65 enum h8300_sim_state state;
66 int exception;
67 unsigned int regs[9];
68 int pc;
69 int ccr;
70
71
72 unsigned char *memory;
73 unsigned char *eightbit;
74 unsigned short *cache_idx;
75 int cache_top;
76 int maximum;
77 int csize;
78 int mask;
79
80 decoded_inst *cache;
81 int cycles;
82 int insts;
83 int ticks;
84 int compiles;
85 #ifdef ADEBUG
86 int stats[O_LAST];
87 #endif
88 }
89 cpu_state_type;