diff options
author | Rupert Swarbrick <rswarbrick@gmail.com> | 2022-04-11 10:47:50 +0100 |
---|---|---|
committer | Rupert Swarbrick <rswarbrick@lowrisc.org> | 2022-04-12 11:10:35 +0100 |
commit | e4aaed1b7b08998a6b6aefa34f7c575e292dde62 (patch) | |
tree | b3c521ba268aa52adfae14647c469ce15127bb8e /spike_main | |
parent | 0d90f75dc4b5e28b2e3b3f35debaae1169c69d98 (diff) | |
download | riscv-isa-sim-e4aaed1b7b08998a6b6aefa34f7c575e292dde62.zip riscv-isa-sim-e4aaed1b7b08998a6b6aefa34f7c575e292dde62.tar.gz riscv-isa-sim-e4aaed1b7b08998a6b6aefa34f7c575e292dde62.tar.bz2 |
Move the "default hartids" logic from sim.cc into spike.cc
This moves another part of the "configuration" out of the generic
sim.cc code.
Diffstat (limited to 'spike_main')
-rw-r--r-- | spike_main/spike.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spike_main/spike.cc b/spike_main/spike.cc index 25d7c69..a3c18d1 100644 --- a/spike_main/spike.cc +++ b/spike_main/spike.cc @@ -458,6 +458,22 @@ int main(int argc, char** argv) } #endif + if (!hartids.empty()) { + if (cfg.nprocs.overridden() && (cfg.nprocs() != hartids.size())) { + std::cerr << "Number of specified hartids (" + << hartids.size() + << ") doesn't match specified number of processors (" + << cfg.nprocs() << ").\n"; + exit(1); + } + } else { + // Set default set of hartids based on nprocs + hartids.reserve(cfg.nprocs()); + for (size_t i = 0; i < cfg.nprocs(); ++i) { + hartids.push_back(i); + } + } + sim_t s(&cfg, varch, halted, real_time_clint, mems, plugin_devices, htif_args, std::move(hartids), dm_config, log_path, dtb_enabled, dtb_file, |