sim-main.h 2.0 KB

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