diff options
author | Flavian Kaufmann <flavian@flaviankaufmann.ch> | 2024-05-14 10:38:47 +0200 |
---|---|---|
committer | Flavian Kaufmann <flavian@flaviankaufmann.ch> | 2024-05-14 10:38:47 +0200 |
commit | d107f7e40f02a7374b8685ba310500a6c38d43b1 (patch) | |
tree | 55615eaface31b2473be3dae90fe822c5373f492 /src/alu_op_decode.v | |
parent | 48b36fddef862c3cd5efbdd3ed3e86b179ac117b (diff) | |
download | riscv_cpu-d107f7e40f02a7374b8685ba310500a6c38d43b1.tar.gz riscv_cpu-d107f7e40f02a7374b8685ba310500a6c38d43b1.zip |
bug fixes
Diffstat (limited to 'src/alu_op_decode.v')
-rw-r--r-- | src/alu_op_decode.v | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/alu_op_decode.v b/src/alu_op_decode.v index 0e217ec..4523255 100644 --- a/src/alu_op_decode.v +++ b/src/alu_op_decode.v @@ -12,31 +12,31 @@ module alu_op_decode ( always @ (*) begin if (alu_ctrl == ALU_CTRL_ADD) begin - alu_op <= ALU_OP_ADD; + alu_op = ALU_OP_ADD; end else if (opcode == OPCODE_REG || opcode == OPCODE_IMM) begin case (funct3) - FUNCT3_ALU_ADD_SUB: alu_op <= (opcode == OPCODE_REG || funct7 == FUNCT7_ALU_SUB) ? ALU_OP_SUB : ALU_OP_ADD; - FUNCT3_ALU_SLL: alu_op <= ALU_OP_SLL; - FUNCT3_ALU_SLT: alu_op <= ALU_OP_SLT; - FUNCT3_ALU_SLTU: alu_op <= ALU_OP_SLTU; - FUNCT3_ALU_XOR: alu_op <= ALU_OP_XOR; - FUNCT3_ALU_SR: alu_op <= funct7 == FUNCT7_ALU_SRL ? ALU_OP_SRL : ALU_OP_SRA; - FUNCT3_ALU_OR: alu_op <= ALU_OP_OR; - FUNCT3_ALU_AND: alu_op <= ALU_OP_AND; - default: alu_op <= ALU_OP_ADD; + FUNCT3_ALU_ADD_SUB: alu_op = (opcode == OPCODE_REG && funct7 == FUNCT7_ALU_SUB) ? ALU_OP_SUB : ALU_OP_ADD; + FUNCT3_ALU_SLL: alu_op = ALU_OP_SLL; + FUNCT3_ALU_SLT: alu_op = ALU_OP_SLT; + FUNCT3_ALU_SLTU: alu_op = ALU_OP_SLTU; + FUNCT3_ALU_XOR: alu_op = ALU_OP_XOR; + FUNCT3_ALU_SR: alu_op = funct7 == FUNCT7_ALU_SRL ? ALU_OP_SRL : ALU_OP_SRA; + FUNCT3_ALU_OR: alu_op = ALU_OP_OR; + FUNCT3_ALU_AND: alu_op = ALU_OP_AND; + default: alu_op = ALU_OP_ADD; endcase end else if (opcode == OPCODE_BRANCH) begin case (funct3) - FUNCT3_BRANCH_BEQ: alu_op <= ALU_OP_SUB; - FUNCT3_BRANCH_BNE: alu_op <= ALU_OP_SUB; - FUNCT3_BRANCH_BLT: alu_op <= ALU_OP_SLT; - FUNCT3_BRANCH_BGE: alu_op <= ALU_OP_SLT; - FUNCT3_BRANCH_BLTU: alu_op <= ALU_OP_SLTU; - FUNCT3_BRANCH_BGEU: alu_op <= ALU_OP_SLTU; - default: alu_op <= ALU_OP_ADD; + FUNCT3_BRANCH_BEQ: alu_op = ALU_OP_SUB; + FUNCT3_BRANCH_BNE: alu_op = ALU_OP_SUB; + FUNCT3_BRANCH_BLT: alu_op = ALU_OP_SLT; + FUNCT3_BRANCH_BGE: alu_op = ALU_OP_SLT; + FUNCT3_BRANCH_BLTU: alu_op = ALU_OP_SLTU; + FUNCT3_BRANCH_BGEU: alu_op = ALU_OP_SLTU; + default: alu_op = ALU_OP_ADD; endcase end else begin - alu_op <= ALU_OP_ADD; + alu_op = ALU_OP_ADD; end end |