Skip to content

Commit

Permalink
Fix decoding of CLRI, BINVI, BSETI, BEXTI and RORI where bit 25 is re…
Browse files Browse the repository at this point in the history
…served in RV32 (#2728)

Fix decoding of some bitmanip instruction where decoding differs between rv32 and rv64.
Co-authored-by: JeanRochCoulon <[email protected]>
  • Loading branch information
Gchauvon authored Jan 22, 2025
1 parent c19a3c1 commit 664c515
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions core/decoder.sv
Original file line number Diff line number Diff line change
Expand Up @@ -916,9 +916,18 @@ module decoder
else if (instr.instr[24:20] == 5'b00000) instruction_o.op = ariane_pkg::CLZ;
else if (instr.instr[24:20] == 5'b00001) instruction_o.op = ariane_pkg::CTZ;
else illegal_instr_bm = 1'b1;
end else if (instr.instr[31:26] == 6'b010010) instruction_o.op = ariane_pkg::BCLRI;
else if (instr.instr[31:26] == 6'b011010) instruction_o.op = ariane_pkg::BINVI;
else if (instr.instr[31:26] == 6'b001010) instruction_o.op = ariane_pkg::BSETI;
end else if (CVA6Cfg.IS_XLEN64 && instr.instr[31:26] == 6'b010010)
instruction_o.op = ariane_pkg::BCLRI;
else if (CVA6Cfg.IS_XLEN32 && instr.instr[31:25] == 7'b0100100)
instruction_o.op = ariane_pkg::BCLRI;
else if (CVA6Cfg.IS_XLEN64 && instr.instr[31:26] == 6'b011010)
instruction_o.op = ariane_pkg::BINVI;
else if (CVA6Cfg.IS_XLEN32 && instr.instr[31:25] == 7'b0110100)
instruction_o.op = ariane_pkg::BINVI;
else if (CVA6Cfg.IS_XLEN64 && instr.instr[31:26] == 6'b001010)
instruction_o.op = ariane_pkg::BSETI;
else if (CVA6Cfg.IS_XLEN32 && instr.instr[31:25] == 7'b0010100)
instruction_o.op = ariane_pkg::BSETI;
else if (CVA6Cfg.ZKN && instr.instr[31:20] == 12'b000010001111)
instruction_o.op = ariane_pkg::ZIP;
else illegal_instr_bm = 1'b1;
Expand All @@ -929,8 +938,14 @@ module decoder
instruction_o.op = ariane_pkg::REV8;
else if (instr.instr[31:20] == 12'b011010011000)
instruction_o.op = ariane_pkg::REV8;
else if (instr.instr[31:26] == 6'b010_010) instruction_o.op = ariane_pkg::BEXTI;
else if (instr.instr[31:26] == 6'b011_000) instruction_o.op = ariane_pkg::RORI;
else if (CVA6Cfg.IS_XLEN64 && instr.instr[31:26] == 6'b010_010)
instruction_o.op = ariane_pkg::BEXTI;
else if (CVA6Cfg.IS_XLEN32 && instr.instr[31:25] == 7'b010_0100)
instruction_o.op = ariane_pkg::BEXTI;
else if (CVA6Cfg.IS_XLEN64 && instr.instr[31:26] == 6'b011_000)
instruction_o.op = ariane_pkg::RORI;
else if (CVA6Cfg.IS_XLEN32 && instr.instr[31:25] == 7'b011_0000)
instruction_o.op = ariane_pkg::RORI;
else if (CVA6Cfg.ZKN && instr.instr[31:20] == 12'b011010000111)
instruction_o.op = ariane_pkg::BREV8;
else if (CVA6Cfg.ZKN && instr.instr[31:20] == 12'b000010001111)
Expand Down

0 comments on commit 664c515

Please sign in to comment.