feat(L04): add RV32I decoder and register file card

This commit is contained in:
user
2026-07-21 16:54:03 +02:00
commit ecd7adc0ae
42 changed files with 7255 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
module tb;
logic [6:0] opcode;
logic alu_imm, alu_reg, load, store, branch, jump, illegal;
integer legal = 0;
string trace_file;
opcode_decoder dut (.*);
task automatic check_opcode(input logic [6:0] value, input logic [5:0] selected);
opcode = value; #1;
if ({jump, branch, store, load, alu_reg, alu_imm} != selected || illegal)
$fatal(1, "FAIL task02 opcode=%h selected=%b illegal=%b", opcode, {jump, branch, store, load, alu_reg, alu_imm}, illegal);
legal += 1;
endtask
initial begin
if ($value$plusargs("trace=%s", trace_file)) begin $dumpfile(trace_file); $dumpvars(0, tb); end
check_opcode(7'h13, 6'b000001); check_opcode(7'h33, 6'b000010); check_opcode(7'h03, 6'b000100);
check_opcode(7'h23, 6'b001000); check_opcode(7'h63, 6'b010000); check_opcode(7'h6f, 6'b100000); check_opcode(7'h67, 6'b100000);
opcode = 7'h7f; #1;
if (!illegal || {jump, branch, store, load, alu_reg, alu_imm} != 0) $fatal(1, "FAIL task02 illegal default");
$display("PASS task02 legal=%0d jump_opcodes=6f,67 illegal_7f=1", legal);
$finish;
end
endmodule