Add JAL/JALR support to the ALU
This commit is contained in:
parent
37d703c83e
commit
5884a437b8
3 changed files with 7 additions and 1 deletions
|
|
@ -46,6 +46,7 @@ module rv32_alu (
|
|||
RV32_ALU_OP_SRL_SRA: result_out <= srl_sra;
|
||||
RV32_ALU_OP_SLT: result_out <= {31'b0, lt};
|
||||
RV32_ALU_OP_SLTU: result_out <= {31'b0, ltu};
|
||||
RV32_ALU_OP_SRC1P4: result_out <= src1 + 4;
|
||||
RV32_ALU_OP_SRC2: result_out <= src2;
|
||||
default: result_out <= 32'bx;
|
||||
endcase
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ localparam RV32_ALU_OP_SLL = 4'b0100;
|
|||
localparam RV32_ALU_OP_SRL_SRA = 4'b0101;
|
||||
localparam RV32_ALU_OP_SLT = 4'b0110;
|
||||
localparam RV32_ALU_OP_SLTU = 4'b0111;
|
||||
localparam RV32_ALU_OP_SRC2 = 4'b1000;
|
||||
localparam RV32_ALU_OP_SRC1P4 = 4'b1000;
|
||||
localparam RV32_ALU_OP_SRC2 = 4'b1001;
|
||||
|
||||
localparam RV32_ALU_SRC1_REG = 1'b0;
|
||||
localparam RV32_ALU_SRC1_PC = 1'b1;
|
||||
|
|
|
|||
|
|
@ -81,11 +81,15 @@ module rv32_decode (
|
|||
{RV32_OPCODE_JAL, RV32_FUNCT3_ANY, RV32_FUNCT7_ANY}: begin
|
||||
/* JAL */
|
||||
valid_out <= 1;
|
||||
alu_op_out <= RV32_ALU_OP_SRC1P4;
|
||||
alu_src1_out <= RV32_ALU_SRC1_PC;
|
||||
imm_out <= imm_j;
|
||||
end
|
||||
{RV32_OPCODE_JALR, RV32_FUNCT3_ZERO, RV32_FUNCT7_ANY}: begin
|
||||
/* JALR */
|
||||
valid_out <= 1;
|
||||
alu_op_out <= RV32_ALU_OP_SRC1P4;
|
||||
alu_src1_out <= RV32_ALU_SRC1_PC;
|
||||
imm_out <= imm_i;
|
||||
end
|
||||
{RV32_OPCODE_BRANCH, RV32_FUNCT3_BRANCH_BEQ, RV32_FUNCT7_ANY}: begin
|
||||
|
|
|
|||
Loading…
Reference in a new issue