aboutsummaryrefslogtreecommitdiff
path: root/riscv/sim.cc
diff options
context:
space:
mode:
authorRupert Swarbrick <rswarbrick@gmail.com>2022-04-11 10:59:20 +0100
committerRupert Swarbrick <rswarbrick@lowrisc.org>2022-04-12 11:10:45 +0100
commit61b4f61a857de65d1a341f55597bfceeb7b7690d (patch)
treee4537514b7522fba146bf3aeb1bb27b7fd34c3c9 /riscv/sim.cc
parente4aaed1b7b08998a6b6aefa34f7c575e292dde62 (diff)
downloadspike-61b4f61a857de65d1a341f55597bfceeb7b7690d.zip
spike-61b4f61a857de65d1a341f55597bfceeb7b7690d.tar.gz
spike-61b4f61a857de65d1a341f55597bfceeb7b7690d.tar.bz2
Move hartids into cfg_t
The only slightly difficult thing here is that hartids will always be considered "overridden" by the time we get to sim_t::sim_t (either overridden by a command line argument, or overridden when we set default hartids just before the constructor). To allow downstream code to distinguish between "I picked IDs 0, 1, 2, 3 because the user asked for 4 processors" and "The user explicitly asked for IDs 0, 1, 2, 3", we have an extra explicit_hartids field.
Diffstat (limited to 'riscv/sim.cc')
-rw-r--r--riscv/sim.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/riscv/sim.cc b/riscv/sim.cc
index d285183..d7585ca 100644
--- a/riscv/sim.cc
+++ b/riscv/sim.cc
@@ -32,7 +32,6 @@ sim_t::sim_t(const cfg_t *cfg, const char* varch, bool halted, bool real_time_cl
std::vector<std::pair<reg_t, mem_t*>> mems,
std::vector<std::pair<reg_t, abstract_device_t*>> plugin_devices,
const std::vector<std::string>& args,
- std::vector<int> const hartids,
const debug_module_config_t &dm_config,
const char *log_path,
bool dtb_enabled, const char *dtb_file,
@@ -63,7 +62,7 @@ sim_t::sim_t(const cfg_t *cfg, const char* varch, bool halted, bool real_time_cl
remote_bitbang(NULL),
debug_module(this, dm_config)
{
- assert(hartids.size() == cfg->nprocs());
+ assert(cfg->hartids().size() == cfg->nprocs());
signal(SIGINT, &handle_signal);
@@ -79,8 +78,8 @@ sim_t::sim_t(const cfg_t *cfg, const char* varch, bool halted, bool real_time_cl
debug_mmu = new mmu_t(this, NULL);
- for (size_t i = 0; i < nprocs(); i++) {
- procs[i] = new processor_t(&isa, varch, this, hartids[i], halted,
+ for (size_t i = 0; i < cfg->nprocs(); i++) {
+ procs[i] = new processor_t(&isa, varch, this, cfg->hartids()[i], halted,
log_file.get(), sout_);
}