or1k-sim.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /* OpenRISC simulator support code header
  2. Copyright (C) 2017-2022 Free Software Foundation, Inc.
  3. This file is part of GDB, the GNU debugger.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  14. #ifndef OR1K_SIM_H
  15. #define OR1K_SIM_H
  16. #include "symcat.h"
  17. /* GDB register numbers. */
  18. #define PPC_REGNUM 32
  19. #define PC_REGNUM 33
  20. #define SR_REGNUM 34
  21. /* Misc. profile data. */
  22. typedef struct
  23. {
  24. } OR1K_MISC_PROFILE;
  25. /* Nop codes used in nop simulation. */
  26. #define NOP_NOP 0x0
  27. #define NOP_EXIT 0x1
  28. #define NOP_REPORT 0x2
  29. #define NOP_PUTC 0x4
  30. #define NOP_CNT_RESET 0x5
  31. #define NOP_GET_TICKS 0x6
  32. #define NOP_GET_PS 0x7
  33. #define NOP_TRACE_ON 0x8
  34. #define NOP_TRACE_OFF 0x9
  35. #define NOP_RANDOM 0xa
  36. #define NOP_OR1KSIM 0xb
  37. #define NOP_EXIT_SILENT 0xc
  38. #define NUM_SPR 0x20000
  39. #define SPR_GROUP_SHIFT 11
  40. #define SPR_GROUP_FIRST(group) (((UWI) SPR_GROUP_##group) << SPR_GROUP_SHIFT)
  41. #define SPR_ADDR(group,index) \
  42. (SPR_GROUP_FIRST(group) | ((UWI) SPR_INDEX_##group##_##index))
  43. /* Define word getters and setter helpers based on those from
  44. sim/common/cgen-mem.h. */
  45. #define GETTWI GETTSI
  46. #define SETTWI SETTSI
  47. void or1k_cpu_init (SIM_DESC sd, sim_cpu *current_cpu, const USI or1k_vr,
  48. const USI or1k_upr, const USI or1k_cpucfgr);
  49. void or1k32bf_insn_before (sim_cpu* current_cpu, SEM_PC vpc, const IDESC *idesc);
  50. void or1k32bf_insn_after (sim_cpu* current_cpu, SEM_PC vpc, const IDESC *idesc);
  51. void or1k32bf_fpu_error (CGEN_FPU* fpu, int status);
  52. void or1k32bf_exception (sim_cpu *current_cpu, USI pc, USI exnum);
  53. void or1k32bf_rfe (sim_cpu *current_cpu);
  54. void or1k32bf_nop (sim_cpu *current_cpu, USI uimm16);
  55. USI or1k32bf_mfspr (sim_cpu *current_cpu, USI addr);
  56. void or1k32bf_mtspr (sim_cpu *current_cpu, USI addr, USI val);
  57. int or1k32bf_fetch_register (sim_cpu *current_cpu, int rn, unsigned char *buf,
  58. int len);
  59. int or1k32bf_store_register (sim_cpu *current_cpu, int rn, unsigned char *buf,
  60. int len);
  61. int or1k32bf_model_or1200_u_exec (sim_cpu *current_cpu, const IDESC *idesc,
  62. int unit_num, int referenced);
  63. int or1k32bf_model_or1200nd_u_exec (sim_cpu *current_cpu, const IDESC *idesc,
  64. int unit_num, int referenced);
  65. void or1k32bf_model_insn_before (sim_cpu *current_cpu, int first_p);
  66. void or1k32bf_model_insn_after (sim_cpu *current_cpu, int last_p, int cycles);
  67. USI or1k32bf_h_spr_get_raw (sim_cpu *current_cpu, USI addr);
  68. void or1k32bf_h_spr_set_raw (sim_cpu *current_cpu, USI addr, USI val);
  69. USI or1k32bf_h_spr_field_get_raw (sim_cpu *current_cpu, USI addr, int msb,
  70. int lsb);
  71. void or1k32bf_h_spr_field_set_raw (sim_cpu *current_cpu, USI addr, int msb,
  72. int lsb, USI val);
  73. USI or1k32bf_make_load_store_addr (sim_cpu *current_cpu, USI base, SI offset,
  74. int size);
  75. USI or1k32bf_ff1 (sim_cpu *current_cpu, USI val);
  76. USI or1k32bf_fl1 (sim_cpu *current_cpu, USI val);
  77. #endif /* OR1K_SIM_H */