Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions dv/tb_illegal_full_safety.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
module tb_illegal_full_safety;

logic illegal_insn;

logic rf_we;
logic data_req_o, data_we_o;
logic jump_in_dec_o, branch_in_dec_o;
logic csr_access_o;
logic rf_ren_a_o, rf_ren_b_o;
logic icache_inval_o;

always_comb begin
// simulate your decoder illegal block behavior
rf_we = 1'b1;
data_req_o = 1'b1;
data_we_o = 1'b1;
jump_in_dec_o = 1'b1;
branch_in_dec_o = 1'b1;
csr_access_o = 1'b1;
rf_ren_a_o = 1'b1;
rf_ren_b_o = 1'b1;
icache_inval_o = 1'b1;

if (illegal_insn) begin
rf_we = 1'b0;
data_req_o = 1'b0;
data_we_o = 1'b0;
jump_in_dec_o = 1'b0;
branch_in_dec_o = 1'b0;
csr_access_o = 1'b0;
rf_ren_a_o = 1'b0;
rf_ren_b_o = 1'b0;
icache_inval_o = 1'b0;
end
end

initial begin
$display("Testing full illegal instruction safety...");

illegal_insn = 1'b1;
#1;

if (rf_we || data_req_o || data_we_o ||
jump_in_dec_o || branch_in_dec_o ||
csr_access_o || rf_ren_a_o || rf_ren_b_o ||
icache_inval_o) begin
$error("FAIL: Side effects not fully blocked");
end

$display("✅ PASS: All side effects blocked");

$finish;
end

endmodule
9 changes: 7 additions & 2 deletions rtl/ibex_decoder.sv
Original file line number Diff line number Diff line change
Expand Up @@ -663,9 +663,14 @@ module ibex_decoder #(
jump_set_o = 1'b0;
branch_in_dec_o = 1'b0;
csr_access_o = 1'b0;
end
end

rf_ren_a_o = 1'b0;
rf_ren_b_o = 1'b0;
icache_inval_o = 1'b0;
csr_op_o = CSR_OP_READ;
end
end

/////////////////////////////
// Decoder for ALU control //
/////////////////////////////
Expand Down