From 4b63f43df012535574da20d6c66b0c57650ea05d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Sintzoff?= <61976467+ASintzoff@users.noreply.github.com> Date: Wed, 15 Nov 2023 23:57:48 +0100 Subject: [PATCH] compressed_decoder.sv: reorganize conditions to improve code coverage (#1630) --- core/compressed_decoder.sv | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/core/compressed_decoder.sv b/core/compressed_decoder.sv index e816972275..42932f8986 100644 --- a/core/compressed_decoder.sv +++ b/core/compressed_decoder.sv @@ -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