diff options
author | Andrew Waterman <aswaterman@gmail.com> | 2017-11-15 16:17:40 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-15 16:17:40 -0800 |
commit | f8a83a80525264761a982cdb4074cb09ac72d7de (patch) | |
tree | 3c50c6febbf5ce7df0ff64cf3568f817dc73e532 /riscv/sim.cc | |
parent | f5bdc2e34299e3721c9319ba92dc72149f6af8a2 (diff) | |
parent | 6c7c772b169d0e1a00998c48e63c7cae98e7aa6a (diff) | |
download | spike-f8a83a80525264761a982cdb4074cb09ac72d7de.zip spike-f8a83a80525264761a982cdb4074cb09ac72d7de.tar.gz spike-f8a83a80525264761a982cdb4074cb09ac72d7de.tar.bz2 |
Merge pull request #156 from p12nGH/noncontiguous_harts
Support for non-contiguous hartids
Diffstat (limited to 'riscv/sim.cc')
-rw-r--r-- | riscv/sim.cc | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/riscv/sim.cc b/riscv/sim.cc index 5aa9213..793a2c8 100644 --- a/riscv/sim.cc +++ b/riscv/sim.cc @@ -25,7 +25,7 @@ static void handle_signal(int sig) sim_t::sim_t(const char* isa, size_t nprocs, bool halted, reg_t start_pc, std::vector<std::pair<reg_t, mem_t*>> mems, - const std::vector<std::string>& args) + const std::vector<std::string>& args, std::vector<int> const hartids) : htif_t(args), debug_module(this), mems(mems), procs(std::max(nprocs, size_t(1))), start_pc(start_pc), current_step(0), current_proc(0), debug(false), remote_bitbang(NULL) @@ -39,8 +39,19 @@ sim_t::sim_t(const char* isa, size_t nprocs, bool halted, reg_t start_pc, debug_mmu = new mmu_t(this, NULL); - for (size_t i = 0; i < procs.size(); i++) { - procs[i] = new processor_t(isa, this, i, halted); + if (hartids.size() == 0) { + for (size_t i = 0; i < procs.size(); i++) { + procs[i] = new processor_t(isa, this, i, halted); + } + } + else { + if (hartids.size() != procs.size()) { + std::cerr << "Number of specified hartids doesn't match number of processors" << strerror(errno) << std::endl; + exit(1); + } + for (size_t i = 0; i < procs.size(); i++) { + procs[i] = new processor_t(isa, this, hartids[i], halted); + } } clint.reset(new clint_t(procs)); |