From 9f0cf3437051b1ff0da9f087d001f768c2242870 Mon Sep 17 00:00:00 2001 From: Rupert Swarbrick Date: Mon, 11 Apr 2022 11:07:08 +0100 Subject: Remove nprocs from cfg_t Now we have hartids, we can remove nprocs so that we have a single source of truth. --- riscv/cfg.h | 6 +++--- riscv/sim.cc | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'riscv') diff --git a/riscv/cfg.h b/riscv/cfg.h index 6410c81..1e40aed 100644 --- a/riscv/cfg.h +++ b/riscv/cfg.h @@ -54,13 +54,12 @@ class cfg_t { public: cfg_t(std::pair default_initrd_bounds, - const char *default_bootargs, size_t default_nprocs, + const char *default_bootargs, const char *default_isa, const char *default_priv, const std::vector &default_mem_layout, const std::vector default_hartids) : initrd_bounds(default_initrd_bounds), bootargs(default_bootargs), - nprocs(default_nprocs), isa(default_isa), priv(default_priv), mem_layout(default_mem_layout), @@ -70,13 +69,14 @@ public: cfg_arg_t> initrd_bounds; cfg_arg_t bootargs; - cfg_arg_t nprocs; cfg_arg_t isa; cfg_arg_t priv; cfg_arg_t> mem_layout; std::optional start_pc; cfg_arg_t> hartids; bool explicit_hartids; + + size_t nprocs() const { return hartids().size(); } }; #endif diff --git a/riscv/sim.cc b/riscv/sim.cc index d7585ca..6945c64 100644 --- a/riscv/sim.cc +++ b/riscv/sim.cc @@ -62,8 +62,6 @@ 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(cfg->hartids().size() == cfg->nprocs()); - signal(SIGINT, &handle_signal); sout_.rdbuf(std::cerr.rdbuf()); // debug output goes to stderr by default -- cgit v1.1