feat(L05): add ALU assembler and execute card
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
module tb;
|
||||
logic [31:0] operand_a, operand_b, result; logic [3:0] operation; logic zero; integer checks=0; string trace_file;
|
||||
alu_core dut (.*);
|
||||
task automatic check(input logic [3:0] op, input logic [31:0] a, b, expected);
|
||||
operation=op; operand_a=a; operand_b=b; #1; if (result !== expected) $fatal(1,"FAIL task01 op=%0d got=%h expected=%h",op,result,expected); checks+=1;
|
||||
endtask
|
||||
initial begin
|
||||
if ($value$plusargs("trace=%s",trace_file)) begin $dumpfile(trace_file); $dumpvars(0,tb); end
|
||||
check(0,7,5,12); check(1,7,5,2); check(2,'ha5,'h3c,'h24); check(3,'ha5,'h3c,'hbd); check(4,'ha5,'h3c,'h99);
|
||||
check(5,1,4,16); check(6,'h80000000,4,'h08000000); check(7,'h80000000,4,'hf8000000); check(8,'h80000000,1,1); check(9,'h80000000,1,0);
|
||||
$display("PASS task01 ops=%0d signed_lt=1 unsigned_lt=0 sra=f8000000",checks); $finish;
|
||||
end
|
||||
endmodule
|
||||
Reference in New Issue
Block a user