aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYenHaoChen <howard25336284@gmail.com>2023-01-11 18:37:21 +0800
committerYenHaoChen <howard25336284@gmail.com>2023-01-30 21:16:42 +0800
commit1230b321f9f547b6ab728cdb1ff1d82fb230df2a (patch)
tree4284a001f64dc4ef548cd4012488a75f959a5359
parentf8856e4d4f5a62bcc04234a2007910c20b0ca185 (diff)
downloadspike-1230b321f9f547b6ab728cdb1ff1d82fb230df2a.zip
spike-1230b321f9f547b6ab728cdb1ff1d82fb230df2a.tar.gz
spike-1230b321f9f547b6ab728cdb1ff1d82fb230df2a.tar.bz2
triggers: force to slow path with icount triggers
-rw-r--r--riscv/execute.cc2
-rw-r--r--riscv/processor.cc6
-rw-r--r--riscv/processor.h1
-rw-r--r--riscv/triggers.h2
4 files changed, 9 insertions, 2 deletions
diff --git a/riscv/execute.cc b/riscv/execute.cc
index b093e72..ea03922 100644
--- a/riscv/execute.cc
+++ b/riscv/execute.cc
@@ -204,7 +204,7 @@ static inline reg_t execute_insn_logged(processor_t* p, reg_t pc, insn_fetch_t f
bool processor_t::slow_path()
{
return debug || state.single_step != state.STEP_NONE || state.debug_mode ||
- log_commits_enabled || histogram_enabled || in_wfi;
+ log_commits_enabled || histogram_enabled || in_wfi || check_triggers_icount;
}
// fetch/decode/execute loop
diff --git a/riscv/processor.cc b/riscv/processor.cc
index 81ae0ce..d55d218 100644
--- a/riscv/processor.cc
+++ b/riscv/processor.cc
@@ -34,7 +34,7 @@ processor_t::processor_t(const isa_parser_t *isa, const cfg_t *cfg,
: debug(false), halt_request(HR_NONE), isa(isa), cfg(cfg), sim(sim), id(id), xlen(0),
histogram_enabled(false), log_commits_enabled(false),
log_file(log_file), sout_(sout_.rdbuf()), halt_on_reset(halt_on_reset),
- in_wfi(false),
+ in_wfi(false), check_triggers_icount(false),
impl_table(256, false), last_pc(1), executions(1), TM(cfg->trigger_count)
{
VU.p = this;
@@ -1123,6 +1123,7 @@ void processor_t::trigger_updated(const std::vector<triggers::trigger_t *> &trig
mmu->check_triggers_fetch = false;
mmu->check_triggers_load = false;
mmu->check_triggers_store = false;
+ check_triggers_icount = false;
for (auto trigger : triggers) {
if (trigger->get_execute()) {
@@ -1134,5 +1135,8 @@ void processor_t::trigger_updated(const std::vector<triggers::trigger_t *> &trig
if (trigger->get_store()) {
mmu->check_triggers_store = true;
}
+ if (trigger->icount_check_needed()) {
+ check_triggers_icount = true;
+ }
}
}
diff --git a/riscv/processor.h b/riscv/processor.h
index 7c4c24f..3aa8372 100644
--- a/riscv/processor.h
+++ b/riscv/processor.h
@@ -301,6 +301,7 @@ private:
std::ostream sout_; // needed for socket command interface -s, also used for -d and -l, but not for --log
bool halt_on_reset;
bool in_wfi;
+ bool check_triggers_icount;
std::vector<bool> impl_table;
std::vector<insn_desc_t> instructions;
diff --git a/riscv/triggers.h b/riscv/triggers.h
index 85842e3..e1a0fd7 100644
--- a/riscv/triggers.h
+++ b/riscv/triggers.h
@@ -79,6 +79,7 @@ public:
virtual bool get_store() const { return false; }
virtual bool get_load() const { return false; }
virtual action_t get_action() const { return ACTION_DEBUG_EXCEPTION; }
+ virtual bool icount_check_needed() const { return false; }
virtual std::optional<match_result_t> detect_memory_access_match(processor_t UNUSED * const proc,
operation_t UNUSED operation, reg_t UNUSED address, std::optional<reg_t> UNUSED data) noexcept { return std::nullopt; }
@@ -240,6 +241,7 @@ public:
bool get_dmode() const override { return dmode; }
virtual action_t get_action() const override { return action; }
+ virtual bool icount_check_needed() const override { return true; }
private:
bool dmode;