aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Johnson <scott.johnson@arilinc.com>2023-04-04 09:48:28 -0700
committerGitHub <noreply@github.com>2023-04-04 09:48:28 -0700
commit035cc8e98d3e67fda5f2b2bfbec21b68630e99d7 (patch)
treefb902090a80358dc61c3376f1e24005f0dc2ec71
parentdc109aeb94b8644e9095f1b3a32fc1c5720088c4 (diff)
parent710117a9970a485513938abf6b2d90f1b0b0fc49 (diff)
downloadriscv-isa-sim-035cc8e98d3e67fda5f2b2bfbec21b68630e99d7.zip
riscv-isa-sim-035cc8e98d3e67fda5f2b2bfbec21b68630e99d7.tar.gz
riscv-isa-sim-035cc8e98d3e67fda5f2b2bfbec21b68630e99d7.tar.bz2
Merge pull request #1263 from scottj97/icount-trigger
Improve icount trigger implementation
-rw-r--r--riscv/execute.cc2
-rw-r--r--riscv/processor.cc1
-rw-r--r--riscv/triggers.h10
3 files changed, 7 insertions, 6 deletions
diff --git a/riscv/execute.cc b/riscv/execute.cc
index f412a35..acf0e90 100644
--- a/riscv/execute.cc
+++ b/riscv/execute.cc
@@ -263,7 +263,7 @@ void processor_t::step(size_t n)
state.single_step = state.STEP_STEPPED;
}
- if (!state.serialized) {
+ if (!state.serialized && check_triggers_icount) {
auto match = TM.detect_icount_match();
if (match.has_value()) {
assert(match->timing == triggers::TIMING_BEFORE);
diff --git a/riscv/processor.cc b/riscv/processor.cc
index 153ff9d..c757d42 100644
--- a/riscv/processor.cc
+++ b/riscv/processor.cc
@@ -696,6 +696,7 @@ void processor_t::take_interrupt(reg_t pending_interrupts)
else
abort();
+ if (check_triggers_icount) TM.detect_icount_match();
throw trap_t(((reg_t)1 << (isa->get_max_xlen() - 1)) | ctz(enabled_interrupts));
}
}
diff --git a/riscv/triggers.h b/riscv/triggers.h
index 199a3c2..0c9dabc 100644
--- a/riscv/triggers.h
+++ b/riscv/triggers.h
@@ -249,11 +249,11 @@ public:
virtual std::optional<match_result_t> detect_icount_match(processor_t * const proc) noexcept override;
private:
- bool dmode;
- bool hit;
- unsigned count, count_read_value;
- bool pending, pending_read_value;
- action_t action;
+ bool dmode = false;
+ bool hit = false;
+ unsigned count = 1, count_read_value = 1;
+ bool pending = false, pending_read_value = false;
+ action_t action = (action_t)0;
};
class module_t {