From 9b811f37d7cd8e8ce3dd645a6fab2ed3c1f37f8d Mon Sep 17 00:00:00 2001 From: Robert Norton Date: Fri, 22 Feb 2019 13:39:31 +0000 Subject: Fix off-by-one in PCC top check. --- model/riscv_step.sail | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/riscv_step.sail b/model/riscv_step.sail index c0fc704..df07b5f 100644 --- a/model/riscv_step.sail +++ b/model/riscv_step.sail @@ -22,7 +22,7 @@ function fetch() -> FetchResult = { F_CHERI_Err(CapEx_SealViolation, PC) else if not(PCC.permit_execute) then F_CHERI_Err(CapEx_PermitExecuteViolation, PC) - else if abs_pc < pcc_base | abs_pc + 2 >= pcc_top then + else if abs_pc < pcc_base | abs_pc + 2 > pcc_top then F_CHERI_Err(CapEx_LengthViolation, PC) else if (abs_pc_bits[0] != 0b0 | (abs_pc_bits[1] != 0b0 & (~ (haveRVC())))) then F_Error(E_Fetch_Addr_Align, PC) -- cgit v1.1