sim: replace CIA_{GET,SET} with CPU_PC_{GET,SET}
[external/binutils.git] / sim / iq2000 / sim-main.h
1
2 /* Main header for the Vitesse IQ2000.  */
3
4 #ifndef SIM_MAIN_H
5 #define SIM_MAIN_H
6
7 #define USING_SIM_BASE_H /* FIXME: quick hack */
8
9 struct _sim_cpu; /* FIXME: should be in sim-basics.h */
10 typedef struct _sim_cpu SIM_CPU;
11
12 /* sim-basics.h includes config.h but cgen-types.h must be included before
13    sim-basics.h and cgen-types.h needs config.h.  */
14 #include "config.h"
15
16 #include "symcat.h"
17 #include "sim-basics.h"
18 #include "cgen-types.h"
19 #include "iq2000-desc.h"
20 #include "iq2000-opc.h"
21 #include "arch.h"
22
23 /* Pull in IQ2000_{DATA,INSN}_{MASK,VALUE}.  */
24 #include "elf/iq2000.h"
25
26 /* These must be defined before sim-base.h.  */
27 typedef USI sim_cia;
28
29 #include "sim-base.h"
30 #include "cgen-sim.h"
31 #include "iq2000-sim.h"
32 \f
33 /* The _sim_cpu struct.  */
34
35 struct _sim_cpu {
36   /* sim/common cpu base.  */
37   sim_cpu_base base;
38
39   /* Static parts of cgen.  */
40   CGEN_CPU cgen_cpu;
41
42   /* CPU specific parts go here.
43      Note that in files that don't need to access these pieces WANT_CPU_FOO
44      won't be defined and thus these parts won't appear.  This is ok in the
45      sense that things work.  It is a source of bugs though.
46      One has to of course be careful to not take the size of this
47      struct and no structure members accessed in non-cpu specific files can
48      go after here.  Oh for a better language.  */
49 #if defined (WANT_CPU_IQ2000BF)
50   IQ2000BF_CPU_DATA cpu_data;
51 #endif
52 };
53 \f
54 /* The sim_state struct.  */
55
56 struct sim_state {
57   sim_cpu *cpu[MAX_NR_PROCESSORS];
58
59   CGEN_STATE cgen_state;
60
61   sim_state_base base;
62 };
63 \f
64 /* Misc.  */
65
66 /* Catch address exceptions.  */
67 extern SIM_CORE_SIGNAL_FN iq2000_core_signal;
68 #define SIM_CORE_SIGNAL(SD,CPU,CIA,MAP,NR_BYTES,ADDR,TRANSFER,ERROR) \
69 iq2000_core_signal ((SD), (CPU), (CIA), (MAP), (NR_BYTES), (ADDR), \
70                   (TRANSFER), (ERROR))
71
72 /* Convert between CPU-internal addresses and sim_core addresses.  */
73 #define CPU2DATA(addr) (IQ2000_DATA_VALUE + (addr))
74 #define DATA2CPU(addr) ((addr) - IQ2000_DATA_VALUE)
75 #define CPU2INSN(addr) (IQ2000_INSN_VALUE + ((addr) & ~IQ2000_INSN_MASK))
76 #define INSN2CPU(addr) ((addr) - IQ2000_INSN_VALUE)
77 #define IQ2000_INSN_MEM_SIZE (CPU2INSN(0x800000) - CPU2INSN(0x0000))
78 #define IQ2000_DATA_MEM_SIZE (CPU2DATA(0x800000) - CPU2DATA(0x0000))
79
80 #endif /* SIM_MAIN_H */