Skip to content

Commit

Permalink
compressed_decoder.sv: reorganize conditions to improve code coverage (
Browse files Browse the repository at this point in the history
  • Loading branch information
ASintzoff authored Nov 15, 2023
1 parent 061694e commit 4b63f43
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions core/compressed_decoder.sv
Original file line number Diff line number Diff line change
Expand Up @@ -835,12 +835,14 @@ module compressed_decoder #(
// c.add -> add rd, rd, rs2
instr_o = {7'b0, instr_i[6:2], instr_i[11:7], 3'b0, instr_i[11:7], riscv::OpcodeOp};

if (instr_i[11:7] == 5'b0 && instr_i[6:2] == 5'b0) begin
// c.ebreak -> ebreak
instr_o = {32'h00_10_00_73};
end else if (instr_i[11:7] != 5'b0 && instr_i[6:2] == 5'b0) begin
// c.jalr -> jalr x1, rs1, 0
instr_o = {12'b0, instr_i[11:7], 3'b000, 5'b00001, riscv::OpcodeJalr};
if (instr_i[6:2] == 5'b0) begin
if (instr_i[11:7] == 5'b0) begin
// c.ebreak -> ebreak
instr_o = {32'h00_10_00_73};
end else begin
// c.jalr -> jalr x1, rs1, 0
instr_o = {12'b0, instr_i[11:7], 3'b000, 5'b00001, riscv::OpcodeJalr};
end
end
end
end
Expand Down

0 comments on commit 4b63f43

Please sign in to comment.