diff --git a/src/iss/arch/riscv_hart_m_p.h b/src/iss/arch/riscv_hart_m_p.h
index 9e8db83..e8f71f7 100644
--- a/src/iss/arch/riscv_hart_m_p.h
+++ b/src/iss/arch/riscv_hart_m_p.h
@@ -720,7 +720,7 @@ iss::status riscv_hart_m_p::write(const address_type type, c
return iss::Err;
}
try {
- if(length > 1 && (addr & (length - 1)) && (access & access_type::DEBUG) != access_type::DEBUG) {
+ if(length > 1 && (addr & (length - 1)) && !is_debug(access)) {
this->reg.trap_state = (1UL << 31) | 6 << 16;
fault_data = addr;
return iss::Err;
@@ -740,7 +740,7 @@ iss::status riscv_hart_m_p::write(const address_type type, c
} else {
res = write_mem(phys_addr, length, data);
}
- if(unlikely(res != iss::Ok && (access & access_type::DEBUG) == 0)) {
+ if(unlikely(res != iss::Ok && !is_debug(access))) {
this->reg.trap_state = (1UL << 31) | (7UL << 16); // issue trap 7 (Store/AMO access fault)
fault_data = addr;
}