aboutsummaryrefslogtreecommitdiff
path: root/riscv/triggers.cc
diff options
context:
space:
mode:
authorYenHaoChen <howard25336284@gmail.com>2022-09-30 11:48:44 +0800
committerYenHaoChen <howard25336284@gmail.com>2022-09-30 11:48:44 +0800
commitb724db52f9d7be3e3068e5bf01ac939ece8d032b (patch)
treeeddd458343c4a65764195961e9014938c64aa84a /riscv/triggers.cc
parent37003b120b1ea704918022216c717e13c391be6c (diff)
downloadspike-b724db52f9d7be3e3068e5bf01ac939ece8d032b.zip
spike-b724db52f9d7be3e3068e5bf01ac939ece8d032b.tar.gz
spike-b724db52f9d7be3e3068e5bf01ac939ece8d032b.tar.bz2
Add has_data argument to trigger checking functions
The mcontrol trigger can select either address or data for checking. The The selection decides the priority of the trigger. For instance, the address trigger has a higher priority over the page fault, and the page fault has a higher priority over the data trigger. The previous implementation only has the checking functions for data trigger, which results in incorrect priority of address trigger. This commit adds a has_data argument to indicate address trigger and the priority of the trigger.
Diffstat (limited to 'riscv/triggers.cc')
-rw-r--r--riscv/triggers.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/riscv/triggers.cc b/riscv/triggers.cc
index 4b73715..e357b4a 100644
--- a/riscv/triggers.cc
+++ b/riscv/triggers.cc
@@ -101,7 +101,7 @@ bool mcontrol_t::simple_match(unsigned xlen, reg_t value) const {
assert(0);
}
-match_result_t mcontrol_t::memory_access_match(processor_t * const proc, operation_t operation, reg_t address, reg_t data) {
+match_result_t mcontrol_t::memory_access_match(processor_t * const proc, operation_t operation, reg_t address, bool has_data, reg_t data) {
state_t * const state = proc->get_state();
if ((operation == triggers::OPERATION_EXECUTE && !execute_bit) ||
(operation == triggers::OPERATION_STORE && !store_bit) ||
@@ -115,6 +115,8 @@ match_result_t mcontrol_t::memory_access_match(processor_t * const proc, operati
reg_t value;
if (select) {
value = data;
+ if (!has_data)
+ return MATCH_NONE;
} else {
value = address;
}
@@ -150,7 +152,7 @@ module_t::~module_t() {
}
}
-match_result_t module_t::memory_access_match(action_t * const action, operation_t operation, reg_t address, reg_t data)
+match_result_t module_t::memory_access_match(action_t * const action, operation_t operation, reg_t address, bool has_data, reg_t data)
{
state_t * const state = proc->get_state();
if (state->debug_mode)
@@ -170,7 +172,7 @@ match_result_t module_t::memory_access_match(action_t * const action, operation_
* entire chain did not match. This is allowed by the spec, because the final
* trigger in the chain will never get `hit` set unless the entire chain
* matches. */
- match_result_t result = triggers[i]->memory_access_match(proc, operation, address, data);
+ match_result_t result = triggers[i]->memory_access_match(proc, operation, address, has_data, data);
if (result != MATCH_NONE && !triggers[i]->chain()) {
*action = triggers[i]->action;
return result;