From ef8014eebd35552aa8dde4bfddf9d7e27b5d1645 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Sat, 9 Apr 2016 14:09:43 +0200 Subject: [PATCH] Bugfix in C.ADDI4SPN implementation --- picorv32.v | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/picorv32.v b/picorv32.v index 8a6dbbb..8d40052 100644 --- a/picorv32.v +++ b/picorv32.v @@ -240,7 +240,7 @@ module picorv32 #( case (mem_rdata_latched[15:13]) 3'b000: begin // C.ADDI4SPN mem_rdata_q[14:12] <= 3'b000; - mem_rdata_q[31:20] <= {mem_rdata_latched[10:7], mem_rdata_latched[12:11], mem_rdata_latched[5], mem_rdata_latched[6]}; + mem_rdata_q[31:20] <= {mem_rdata_latched[10:7], mem_rdata_latched[12:11], mem_rdata_latched[5], mem_rdata_latched[6], 2'b00}; end 3'b010: begin // C.LW mem_rdata_q[31:20] <= {mem_rdata_latched[5], mem_rdata_latched[12:10], mem_rdata_latched[6], 2'b00}; @@ -565,7 +565,7 @@ module picorv32 #( 3'b000: begin // C.ADDI4SPN is_alu_reg_imm <= |mem_rdata_latched[12:5]; decoded_rs1 <= 2; - decoded_rd <= 8 + mem_rdata_latched[9:7]; + decoded_rd <= 8 + mem_rdata_latched[4:2]; end 3'b010: begin // C.LW is_lb_lh_lw_lbu_lhu <= 1;