diff options
| author | Tim Hutt <timothy.hutt@codasip.com> | 2025-06-27 12:10:19 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-27 11:10:19 +0000 |
| commit | e1fedba9a87bb3b65e6f2be7e841bc52f46dfd73 (patch) | |
| tree | 187dbc2263be74775b2e8f36e536de397fdf8efb /c_emulator/riscv_sim.cpp | |
| parent | f4a94a3a3eceae6da1360b335c8ad755735e2ec4 (diff) | |
| download | sail-riscv-e1fedba9a87bb3b65e6f2be7e841bc52f46dfd73.tar.gz sail-riscv-e1fedba9a87bb3b65e6f2be7e841bc52f46dfd73.tar.bz2 sail-riscv-e1fedba9a87bb3b65e6f2be7e841bc52f46dfd73.zip | |
Change XLEN and FLEN to be configure-time options (#870)
This means you only need to compile the emulator once in order to
support RV32F, RV32D, RV64F and RV64D. The emulator binary has been
renamed to `sail_riscv_sim`.
XLEN is controlled by the `base.xlen` config value. FLEN is controlled
by `extensions.{F,D}.supported`.
Some backends (Lean etc.) still need a compile-time config so for those
we still support building multiple configs.
Diffstat (limited to 'c_emulator/riscv_sim.cpp')
| -rw-r--r-- | c_emulator/riscv_sim.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/c_emulator/riscv_sim.cpp b/c_emulator/riscv_sim.cpp index a2cb77bc..bb894a40 100644 --- a/c_emulator/riscv_sim.cpp +++ b/c_emulator/riscv_sim.cpp @@ -440,7 +440,7 @@ void init_sail_reset_vector(uint64_t entry) } /* boot at reset vector */ - zPC = rom_base; + zforce_pc(rom_base); } void init_sail(uint64_t elf_entry, const char *config_file) @@ -456,15 +456,18 @@ void init_sail(uint64_t elf_entry, const char *config_file) rv_clint_size = UINT64_C(0); rv_htif_tohost = UINT64_C(0); */ - zPC = elf_entry; - } else + zforce_pc(elf_entry); + } else { init_sail_reset_vector(elf_entry); + } } /* reinitialize to clear state and memory, typically across tests runs */ void reinit_sail(uint64_t elf_entry, const char *config_file) { model_fini(); + sail_set_abstract_xlen(); + sail_set_abstract_ext_d_supported(); model_init(); init_sail(elf_entry, config_file); } @@ -666,6 +669,8 @@ int main(int argc, char **argv) { int files_start = process_args(argc, argv); + sail_set_abstract_xlen(); + sail_set_abstract_ext_d_supported(); model_init(); if (do_validate_config) { |
