|
|
|
@ -55,16 +55,19 @@ void trigger_t::tdata3_write(processor_t * const proc, const reg_t val) noexcept |
|
|
|
sselect = (sselect_t)((proc->extension_enabled_const('S') && get_field(val, CSR_TEXTRA_SSELECT(xlen)) <= SSELECT_MAXVAL) ? get_field(val, CSR_TEXTRA_SSELECT(xlen)) : SSELECT_IGNORE); |
|
|
|
} |
|
|
|
|
|
|
|
bool trigger_t::common_match(processor_t * const proc) const noexcept { |
|
|
|
return mode_match(proc->get_state()) && textra_match(proc); |
|
|
|
bool trigger_t::common_match(processor_t * const proc, bool use_prev_prv) const noexcept { |
|
|
|
auto state = proc->get_state(); |
|
|
|
auto prv = use_prev_prv ? state->prev_prv : state->prv; |
|
|
|
auto v = use_prev_prv ? state->prev_v : state->v; |
|
|
|
return mode_match(prv, v) && textra_match(proc); |
|
|
|
} |
|
|
|
|
|
|
|
bool trigger_t::mode_match(state_t * const state) const noexcept |
|
|
|
bool trigger_t::mode_match(reg_t prv, bool v) const noexcept |
|
|
|
{ |
|
|
|
switch (state->prv) { |
|
|
|
switch (prv) { |
|
|
|
case PRV_M: return m; |
|
|
|
case PRV_S: return state->v ? vs : s; |
|
|
|
case PRV_U: return state->v ? vu : u; |
|
|
|
case PRV_S: return v ? vs : s; |
|
|
|
case PRV_U: return v ? vu : u; |
|
|
|
default: assert(false); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -397,7 +400,8 @@ void itrigger_t::tdata1_write(processor_t * const proc, const reg_t val, const b |
|
|
|
|
|
|
|
std::optional<match_result_t> trap_common_t::detect_trap_match(processor_t * const proc, const trap_t& t) noexcept |
|
|
|
{ |
|
|
|
if (!common_match(proc)) |
|
|
|
// Use the previous privilege for matching
|
|
|
|
if (!common_match(proc, true)) |
|
|
|
return std::nullopt; |
|
|
|
|
|
|
|
auto xlen = proc->get_xlen(); |
|
|
|
|