From 87b98312401ed5ec120d0bace30be9fadd2aeffe Mon Sep 17 00:00:00 2001 From: Florian Zaruba Date: Thu, 17 Aug 2017 19:08:06 +0200 Subject: [PATCH] Check NPC for validity before using it --- src/debug_unit.sv | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/debug_unit.sv b/src/debug_unit.sv index ca5923653..dbcefe9db 100755 --- a/src/debug_unit.sv +++ b/src/debug_unit.sv @@ -149,8 +149,14 @@ module debug_unit ( DBG_IE: rdata_n = dbg_ie_q; DBG_CAUSE: rdata_n = dbg_cause_q; DBG_NPC: begin - if (debug_halted_o) - rdata_n = commit_instr_i.pc; + + if (debug_halted_o) begin + if (commit_instr_i.valid) + rdata_n = commit_instr_i.pc; + else + rdata_n = 64'hdeadbeefdeadbeef; + // TODO: Breakpoint + end // if we came from reset - output the boot address if (reset_q) rdata_n = boot_addr_i;