aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Zhao <jerryz123@berkeley.edu>2023-01-10 10:34:03 -0800
committerJerry Zhao <jerryz123@berkeley.edu>2023-01-18 11:20:32 -0800
commit67bbdf5506c5ef8dfd2cb198c3eb918ca6ca024f (patch)
tree4210994be7108980d61d0153a54c9111b31b9dce
parent7937438882d708bfee54c250fffa4a8c094ba89e (diff)
downloadriscv-isa-sim-67bbdf5506c5ef8dfd2cb198c3eb918ca6ca024f.zip
riscv-isa-sim-67bbdf5506c5ef8dfd2cb198c3eb918ca6ca024f.tar.gz
riscv-isa-sim-67bbdf5506c5ef8dfd2cb198c3eb918ca6ca024f.tar.bz2
Add trigger_count field to cfg_t
-rw-r--r--ci-tests/testlib.c3
-rw-r--r--riscv/cfg.h7
-rw-r--r--riscv/processor.cc2
-rw-r--r--spike_main/spike-log-parser.cc3
-rw-r--r--spike_main/spike.cc3
5 files changed, 12 insertions, 6 deletions
diff --git a/ci-tests/testlib.c b/ci-tests/testlib.c
index d06277f..f20e749 100644
--- a/ci-tests/testlib.c
+++ b/ci-tests/testlib.c
@@ -27,7 +27,8 @@ int main()
16,
mem_cfg,
hartids,
- false);
+ false,
+ 4);
std::vector<std::pair<reg_t, abstract_device_t*>> plugin_devices;
std::vector<std::string> htif_args {"pk", "hello"};
debug_module_config_t dm_config = {
diff --git a/riscv/cfg.h b/riscv/cfg.h
index 1fb358f..a40bbf5 100644
--- a/riscv/cfg.h
+++ b/riscv/cfg.h
@@ -71,7 +71,8 @@ public:
const reg_t default_pmpregions,
const std::vector<mem_cfg_t> &default_mem_layout,
const std::vector<int> default_hartids,
- bool default_real_time_clint)
+ bool default_real_time_clint,
+ const reg_t default_trigger_count)
: initrd_bounds(default_initrd_bounds),
bootargs(default_bootargs),
isa(default_isa),
@@ -84,7 +85,8 @@ public:
mem_layout(default_mem_layout),
hartids(default_hartids),
explicit_hartids(false),
- real_time_clint(default_real_time_clint)
+ real_time_clint(default_real_time_clint),
+ trigger_count(default_trigger_count)
{}
cfg_arg_t<std::pair<reg_t, reg_t>> initrd_bounds;
@@ -101,6 +103,7 @@ public:
cfg_arg_t<std::vector<int>> hartids;
bool explicit_hartids;
cfg_arg_t<bool> real_time_clint;
+ reg_t trigger_count;
size_t nprocs() const { return hartids().size(); }
};
diff --git a/riscv/processor.cc b/riscv/processor.cc
index c3c5d8f..f843224 100644
--- a/riscv/processor.cc
+++ b/riscv/processor.cc
@@ -35,7 +35,7 @@ processor_t::processor_t(const isa_parser_t *isa, const cfg_t *cfg,
histogram_enabled(false), log_commits_enabled(false),
log_file(log_file), sout_(sout_.rdbuf()), halt_on_reset(halt_on_reset),
in_wfi(false),
- impl_table(256, false), last_pc(1), executions(1), TM(4)
+ impl_table(256, false), last_pc(1), executions(1), TM(cfg->trigger_count)
{
VU.p = this;
TM.proc = this;
diff --git a/spike_main/spike-log-parser.cc b/spike_main/spike-log-parser.cc
index dfdb117..0020751 100644
--- a/spike_main/spike-log-parser.cc
+++ b/spike_main/spike-log-parser.cc
@@ -39,7 +39,8 @@ int main(int UNUSED argc, char** argv)
/*default_pmpregions=*/16,
/*default_mem_layout=*/std::vector<mem_cfg_t>(),
/*default_hartids=*/std::vector<int>(),
- /*default_real_time_clint=*/false);
+ /*default_real_time_clint=*/false,
+ /*default_trigger_count=*/4);
isa_parser_t isa(isa_string, DEFAULT_PRIV);
processor_t p(&isa, &cfg, 0, 0, false, nullptr, cerr);
diff --git a/spike_main/spike.cc b/spike_main/spike.cc
index 8386a49..c874d00 100644
--- a/spike_main/spike.cc
+++ b/spike_main/spike.cc
@@ -355,7 +355,8 @@ int main(int argc, char** argv)
/*default_pmpregions=*/16,
/*default_mem_layout=*/parse_mem_layout("2048"),
/*default_hartids=*/std::vector<int>(),
- /*default_real_time_clint=*/false);
+ /*default_real_time_clint=*/false,
+ /*default_trigger_count=*/4);
auto const device_parser = [&plugin_devices](const char *s) {
const std::string str(s);