aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Newsome <tim@casualhacker.net>2024-09-05 13:42:54 -0700
committerTim Newsome <tim@casualhacker.net>2024-09-05 13:42:54 -0700
commit4abd669b3d6babe974816ac9433398bdcca6fc94 (patch)
tree888e1bf055b8f5dd48bad7f0d14e02714bfc3d27
parent9c5a20fbdb0e112f57a462b6a520ea5835ca00bb (diff)
downloadriscv-isa-sim-4abd669b3d6babe974816ac9433398bdcca6fc94.zip
riscv-isa-sim-4abd669b3d6babe974816ac9433398bdcca6fc94.tar.gz
riscv-isa-sim-4abd669b3d6babe974816ac9433398bdcca6fc94.tar.bz2
Make allow_action() take proc instead of state
-rw-r--r--riscv/triggers.cc11
-rw-r--r--riscv/triggers.h2
2 files changed, 7 insertions, 6 deletions
diff --git a/riscv/triggers.cc b/riscv/triggers.cc
index 4553f87..a93d2b1 100644
--- a/riscv/triggers.cc
+++ b/riscv/triggers.cc
@@ -117,8 +117,9 @@ bool trigger_t::textra_match(processor_t * const proc) const noexcept
return true;
}
-bool trigger_t::allow_action(const state_t * const state) const
+bool trigger_t::allow_action(processor_t * const proc) const
{
+ const state_t *state = proc->get_state();
if (get_action() == ACTION_DEBUG_EXCEPTION) {
const bool mstatus_mie = state->mstatus->read() & MSTATUS_MIE;
const bool sstatus_sie = state->sstatus->read() & MSTATUS_SIE;
@@ -242,7 +243,7 @@ std::optional<match_result_t> mcontrol_common_t::detect_memory_access_match(proc
value &= 0xffffffff;
}
- if (simple_match(xlen, value) && allow_action(proc->get_state())) {
+ if (simple_match(xlen, value) && allow_action(proc)) {
/* This is OK because this function is only called if the trigger was not
* inhibited by the previous trigger in the chain. */
set_hit(timing ? HIT_IMMEDIATELY_AFTER : HIT_BEFORE);
@@ -331,7 +332,7 @@ void mcontrol6_t::tdata1_write(processor_t * const proc, const reg_t val, const
std::optional<match_result_t> icount_t::detect_icount_fire(processor_t * const proc) noexcept
{
- if (!common_match(proc) || !allow_action(proc->get_state()))
+ if (!common_match(proc) || !allow_action(proc))
return std::nullopt;
std::optional<match_result_t> ret = std::nullopt;
@@ -346,7 +347,7 @@ std::optional<match_result_t> icount_t::detect_icount_fire(processor_t * const p
void icount_t::detect_icount_decrement(processor_t * const proc) noexcept
{
- if (!common_match(proc) || !allow_action(proc->get_state()))
+ if (!common_match(proc) || !allow_action(proc))
return;
if (count >= 1) {
@@ -438,7 +439,7 @@ std::optional<match_result_t> trap_common_t::detect_trap_match(processor_t * con
bool interrupt = (t.cause() & ((reg_t)1 << (xlen - 1))) != 0;
reg_t bit = t.cause() & ~((reg_t)1 << (xlen - 1));
assert(bit < xlen);
- if (simple_match(interrupt, bit) && allow_action(proc->get_state())) {
+ if (simple_match(interrupt, bit) && allow_action(proc)) {
hit = true;
return match_result_t(TIMING_AFTER, action);
}
diff --git a/riscv/triggers.h b/riscv/triggers.h
index d88678d..880e5c9 100644
--- a/riscv/triggers.h
+++ b/riscv/triggers.h
@@ -99,7 +99,7 @@ public:
protected:
static action_t legalize_action(reg_t val, reg_t action_mask, reg_t dmode_mask) noexcept;
bool common_match(processor_t * const proc, bool use_prev_prv = false) const noexcept;
- bool allow_action(const state_t * const state) const;
+ bool allow_action(processor_t * const proc) const;
reg_t tdata2;
bool vs = false;