Skip to content

Commit

Permalink
Fix illegal instruction issue #1953
Browse files Browse the repository at this point in the history
Signed-off-by: Bruno Sa <[email protected]>
  • Loading branch information
ninolomata committed Mar 22, 2024
1 parent 62bdf11 commit 3ba4a42
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions core/decoder.sv
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,7 @@ module decoder
if (CVA6Cfg.RVH && v_i) virtual_illegal_instr = 1'b1;
else illegal_instr = 1'b1;
end
end
if (CVA6Cfg.RVH) begin
end else if (CVA6Cfg.RVH) begin
if (instr.instr[31:25] == 7'b10001) begin
// check privilege level, HFENCE.VVMA can only be executed in M/S mode
// otherwise decode an illegal instruction or virtual illegal instruction
Expand All @@ -302,8 +301,7 @@ module decoder
illegal_instr = (priv_lvl_i inside {riscv::PRIV_LVL_M, riscv::PRIV_LVL_S}) ? 1'b0 : 1'b1;
end
instruction_o.op = ariane_pkg::HFENCE_VVMA;
end
if (instr.instr[31:25] == 7'b110001) begin
end else if (instr.instr[31:25] == 7'b110001) begin
// check privilege level, HFENCE.GVMA can only be executed in M/S mode
// otherwise decode an illegal instruction or virtual illegal instruction
if (v_i) begin
Expand All @@ -314,7 +312,11 @@ module decoder
instruction_o.op = ariane_pkg::HFENCE_GVMA;
// check TVM flag and intercept HFENCE.GVMA call if necessary
if (priv_lvl_i == riscv::PRIV_LVL_S && !v_i && tvm_i) illegal_instr = 1'b1;
end else begin
illegal_instr = 1'b1;
end
end else begin
illegal_instr = 1'b1;
end
end
endcase
Expand Down

0 comments on commit 3ba4a42

Please sign in to comment.