aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYenHaoChen <howard25336284@gmail.com>2023-08-01 16:54:05 +0800
committerYenHaoChen <howard25336284@gmail.com>2023-09-13 09:22:13 +0800
commit9bc80f3d095c8220200dec74b0c03f5d806976af (patch)
tree603fd3f4ad76c9893f3d9c1f2f6b3be557bb2a70
parent7b3b2e94adefa63a31c73267af21819ad833aba0 (diff)
downloadriscv-isa-sim-9bc80f3d095c8220200dec74b0c03f5d806976af.zip
riscv-isa-sim-9bc80f3d095c8220200dec74b0c03f5d806976af.tar.gz
riscv-isa-sim-9bc80f3d095c8220200dec74b0c03f5d806976af.tar.bz2
triggers: fix: not decrease icount.count on firing other icount with action=debug
-rw-r--r--riscv/triggers.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/riscv/triggers.cc b/riscv/triggers.cc
index 24a0f4e..5a2d18b 100644
--- a/riscv/triggers.cc
+++ b/riscv/triggers.cc
@@ -595,11 +595,12 @@ std::optional<match_result_t> module_t::detect_icount_match() noexcept
std::optional<match_result_t> ret = std::nullopt;
for (auto trigger: triggers) {
auto result = trigger->detect_icount_fire(proc);
- if (result == std::nullopt || result->action != MCONTROL_ACTION_DEBUG_MODE)
- trigger->detect_icount_decrement(proc);
if (result.has_value() && (!ret.has_value() || ret->action < result->action))
ret = result;
}
+ if (ret == std::nullopt || ret->action != MCONTROL_ACTION_DEBUG_MODE)
+ for (auto trigger: triggers)
+ trigger->detect_icount_decrement(proc);
return ret;
}