machs.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /* RISC-V simulator.
  2. Copyright (C) 2005-2022 Free Software Foundation, Inc.
  3. Contributed by Mike Frysinger.
  4. This file is part of simulators.
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  15. /* This must come before any other includes. */
  16. #include "defs.h"
  17. #include "sim-main.h"
  18. static void
  19. riscv_model_init (SIM_CPU *cpu)
  20. {
  21. }
  22. static void
  23. riscv_init_cpu (SIM_CPU *cpu)
  24. {
  25. }
  26. static void
  27. riscv_prepare_run (SIM_CPU *cpu)
  28. {
  29. }
  30. static const SIM_MACH_IMP_PROPERTIES riscv_imp_properties =
  31. {
  32. sizeof (SIM_CPU),
  33. 0,
  34. };
  35. #if WITH_TARGET_WORD_BITSIZE >= 32
  36. static const SIM_MACH rv32i_mach;
  37. static const SIM_MODEL rv32_models[] =
  38. {
  39. #define M(ext) { "RV32"#ext, &rv32i_mach, MODEL_RV32##ext, NULL, riscv_model_init },
  40. #include "model_list.def"
  41. #undef M
  42. { 0, NULL, 0, NULL, NULL, }
  43. };
  44. static const SIM_MACH rv32i_mach =
  45. {
  46. "rv32i", "riscv:rv32", MACH_RV32I,
  47. 32, 32, &rv32_models[0], &riscv_imp_properties,
  48. riscv_init_cpu,
  49. riscv_prepare_run
  50. };
  51. #endif
  52. #if WITH_TARGET_WORD_BITSIZE >= 64
  53. static const SIM_MACH rv64i_mach;
  54. static const SIM_MODEL rv64_models[] =
  55. {
  56. #define M(ext) { "RV64"#ext, &rv64i_mach, MODEL_RV64##ext, NULL, riscv_model_init },
  57. #include "model_list.def"
  58. #undef M
  59. { 0, NULL, 0, NULL, NULL, }
  60. };
  61. static const SIM_MACH rv64i_mach =
  62. {
  63. "rv64i", "riscv:rv64", MACH_RV64I,
  64. 64, 64, &rv64_models[0], &riscv_imp_properties,
  65. riscv_init_cpu,
  66. riscv_prepare_run
  67. };
  68. #endif
  69. #if WITH_TARGET_WORD_BITSIZE >= 128
  70. static const SIM_MACH rv128i_mach;
  71. static const SIM_MODEL rv128_models[] =
  72. {
  73. #define M(ext) { "RV128"#ext, &rv128i_mach, MODEL_RV128##ext, NULL, riscv_model_init },
  74. #include "model_list.def"
  75. #undef M
  76. { 0, NULL, 0, NULL, NULL, }
  77. };
  78. static const SIM_MACH rv128i_mach =
  79. {
  80. "rv128i", "riscv:rv128", MACH_RV128I,
  81. 128, 128, &rv128_models[0], &riscv_imp_properties,
  82. riscv_init_cpu,
  83. riscv_prepare_run
  84. };
  85. #endif
  86. /* Order matters here. */
  87. const SIM_MACH * const riscv_sim_machs[] =
  88. {
  89. #if WITH_TARGET_WORD_BITSIZE >= 128
  90. &rv128i_mach,
  91. #endif
  92. #if WITH_TARGET_WORD_BITSIZE >= 64
  93. &rv64i_mach,
  94. #endif
  95. #if WITH_TARGET_WORD_BITSIZE >= 32
  96. &rv32i_mach,
  97. #endif
  98. NULL
  99. };