From 155d3ba55468db2ec641a9973dcce49be6310aa5 Mon Sep 17 00:00:00 2001 From: Luke Wren Date: Fri, 23 Jul 2021 23:09:03 +0100 Subject: [PATCH] Tie off 1 or 2 LSBs of DPC depending on IALIGN --- hdl/hazard3_csr.v | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hdl/hazard3_csr.v b/hdl/hazard3_csr.v index b85c90e..1f35bcd 100644 --- a/hdl/hazard3_csr.v +++ b/hdl/hazard3_csr.v @@ -550,7 +550,8 @@ always @ (posedge clk or negedge rst_n) begin if (enter_debug_mode) dpc <= mepc_in; else if (debug_mode && wen && addr == DPC) - dpc <= update(dpc); + // 1 or 2 LSBs are hardwired to 0, depending on IALIGN. + dpc <= update(dpc) & (~X0 << 2 - EXTENSION_C); end end