Skip to content

Commit 9088804

Browse files
rtwfroodyhuxuan0307
authored andcommitted
Make allow_action() take proc instead of state
1 parent 6b12345 commit 9088804

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

riscv/triggers.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,9 @@ bool trigger_t::textra_match(processor_t * const proc) const noexcept
117117
return true;
118118
}
119119

120-
bool trigger_t::allow_action(const state_t * const state) const
120+
bool trigger_t::allow_action(processor_t * const proc) const
121121
{
122+
const state_t *state = proc->get_state();
122123
if (get_action() == ACTION_DEBUG_EXCEPTION) {
123124
const bool mstatus_mie = state->mstatus->read() & MSTATUS_MIE;
124125
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
242243
value &= 0xffffffff;
243244
}
244245

245-
if (simple_match(xlen, value) && allow_action(proc->get_state())) {
246+
if (simple_match(xlen, value) && allow_action(proc)) {
246247
/* This is OK because this function is only called if the trigger was not
247248
* inhibited by the previous trigger in the chain. */
248249
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
331332

332333
std::optional<match_result_t> icount_t::detect_icount_fire(processor_t * const proc) noexcept
333334
{
334-
if (!common_match(proc) || !allow_action(proc->get_state()))
335+
if (!common_match(proc) || !allow_action(proc))
335336
return std::nullopt;
336337

337338
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
346347

347348
void icount_t::detect_icount_decrement(processor_t * const proc) noexcept
348349
{
349-
if (!common_match(proc) || !allow_action(proc->get_state()))
350+
if (!common_match(proc) || !allow_action(proc))
350351
return;
351352

352353
if (count >= 1) {
@@ -438,7 +439,7 @@ std::optional<match_result_t> trap_common_t::detect_trap_match(processor_t * con
438439
bool interrupt = (t.cause() & ((reg_t)1 << (xlen - 1))) != 0;
439440
reg_t bit = t.cause() & ~((reg_t)1 << (xlen - 1));
440441
assert(bit < xlen);
441-
if (simple_match(interrupt, bit) && allow_action(proc->get_state())) {
442+
if (simple_match(interrupt, bit) && allow_action(proc)) {
442443
hit = true;
443444
return match_result_t(TIMING_AFTER, action);
444445
}

riscv/triggers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class trigger_t {
9999
protected:
100100
static action_t legalize_action(reg_t val, reg_t action_mask, reg_t dmode_mask) noexcept;
101101
bool common_match(processor_t * const proc, bool use_prev_prv = false) const noexcept;
102-
bool allow_action(const state_t * const state) const;
102+
bool allow_action(processor_t * const proc) const;
103103
reg_t tdata2;
104104

105105
bool vs = false;

0 commit comments

Comments
 (0)