From 6111c97506d40c0b05f456292504185d99baddc8 Mon Sep 17 00:00:00 2001 From: Nils Wistoff Date: Thu, 5 Dec 2024 17:33:45 +1100 Subject: [PATCH] cheshire_pkg: Fix CVA6 debug module addresses This fixes two errors in the debug module addresses passed to CVA6: 1. `HaltAddress` and `ExceptionAddress` are assumed to be relative to `DmBaseAddress`, see https://github.com/pulp-platform/cva6/blob/99ae53bde1a94b90c1d9bbbe7fe272a9336200a6/core/frontend/frontend.sv#L380 and https://github.com/pulp-platform/cva6/blob/99ae53bde1a94b90c1d9bbbe7fe272a9336200a6/core/csr_regfile.sv#L2295. Coincidentally, this currently does not cause any issues since `AmDbg = '0`, 2. `ExceptionAddress` was changed from `0x808` to `0x810` in https://github.com/pulp-platform/riscv-dbg/pull/145, which is included in the debug module version used in Cheshire. This means that exceptions in debug mode currently cause CVA6 to jump to `resume` and return from debug mode instead of handling the exception, which breaks several openocd commands that use exceptions to discover CSR availabilities. Signed-off-by: Nils Wistoff --- hw/cheshire_pkg.sv | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/cheshire_pkg.sv b/hw/cheshire_pkg.sv index 104976a4..6c05ded0 100644 --- a/hw/cheshire_pkg.sv +++ b/hw/cheshire_pkg.sv @@ -493,8 +493,8 @@ package cheshire_pkg; ret.AxiIdWidth = Cva6IdWidth; ret.AxiUserWidth = cfg.AxiUserWidth; ret.DmBaseAddress = AmDbg; - ret.HaltAddress = AmDbg + 'h800; - ret.ExceptionAddress = AmDbg + 'h808; + ret.HaltAddress = 'h800; // Relative to AmDbg + ret.ExceptionAddress = 'h810; // Relative to AmDbg ret.NrNonIdempotentRules = 2; // Periphs, ExtNonCI; ret.NonIdempotentAddrBase = {64'h0000_0000, NoCieBase}; ret.NOCType = config_pkg::NOC_TYPE_AXI4_ATOP;