From f99cd747dae83c29d1df6e6eb2c5019854f084f7 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Fri, 14 Jul 2017 11:20:55 +0200 Subject: [PATCH] Suppress writes to cpuregs[0] to prevent confusion --- picorv32.v | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/picorv32.v b/picorv32.v index eb642d0..b7beaf0 100644 --- a/picorv32.v +++ b/picorv32.v @@ -190,7 +190,7 @@ module picorv32 #( endtask `ifdef DEBUGREGS - wire [31:0] dbg_reg_x0 = cpuregs[0]; + wire [31:0] dbg_reg_x0 = 0; wire [31:0] dbg_reg_x1 = cpuregs[1]; wire [31:0] dbg_reg_x2 = cpuregs[2]; wire [31:0] dbg_reg_x3 = cpuregs[3]; @@ -1301,7 +1301,7 @@ module picorv32 #( end always @(posedge clk) begin - if (resetn && cpuregs_write) + if (resetn && cpuregs_write && latched_rd) cpuregs[latched_rd] <= cpuregs_wrdata; end