From ea75ab9206c47e93a9be50d94071b3a3af8aaa35 Mon Sep 17 00:00:00 2001 From: "brice.boisson" Date: Mon, 20 Nov 2023 22:21:41 +0900 Subject: [PATCH] Fix: imm value building --- rtl/decoder.v | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rtl/decoder.v b/rtl/decoder.v index a5a8e20..00ab67b 100644 --- a/rtl/decoder.v +++ b/rtl/decoder.v @@ -147,7 +147,7 @@ endfunction alu_not = 0; end BRANCH : begin // BRANCH - Beq, ... - imm[11:0] = {instruction[31:25], instruction[11:7]}; + imm[11:0] = {instruction[7], instruction[30:25], instruction[11:8], 1'b0}; imm[31:12] = (instruction[14:12] == 3'b110 || instruction[14:12] == 3'b111 || instruction[31] == 0) ? 20'b00000000000000000000 : 20'b11111111111111111111; reg_we = 0; reg_sel_data_in = 2'b00; @@ -164,7 +164,7 @@ endfunction alu_not = branch_not(instruction[14:12]); end JAL : begin // JUMP - Jal - imm[19:0] = instruction[31:12]; + imm[19:0] = {instruction[31], instruction[19:12], instruction[20], instruction[30:25], instruction[24:21], 1'b0}; imm[31:20] = (instruction[31] == 0) ? 12'b000000000000 : 12'b111111111111; reg_we = 1; reg_sel_data_in = 2'b10;