feat(L09): add load and store semantics card
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
module tb;
|
||||
logic [1:0] address_low;
|
||||
logic [2:0] funct3;
|
||||
logic [31:0] store_value, bus_write_data;
|
||||
logic [3:0] write_strobe;
|
||||
logic fault;
|
||||
string trace_file;
|
||||
store_lanes dut (.*);
|
||||
initial begin
|
||||
if ($value$plusargs("trace=%s", trace_file)) begin $dumpfile(trace_file); $dumpvars(0, tb); end
|
||||
address_low=3; funct3=0; store_value=32'haa; #1;
|
||||
if (write_strobe!==4'b1000 || bus_write_data!==32'haa000000 || fault) $fatal(1,"FAIL SB");
|
||||
address_low=2; funct3=1; store_value=32'hbeef; #1;
|
||||
if (write_strobe!==4'b1100 || bus_write_data!==32'hbeef0000 || fault) $fatal(1,"FAIL SH");
|
||||
address_low=0; funct3=2; store_value=32'h12345678; #1;
|
||||
if (write_strobe!==4'b1111 || bus_write_data!==store_value || fault) $fatal(1,"FAIL SW");
|
||||
address_low=1; funct3=1; #1; if (!fault || write_strobe!==0) $fatal(1,"FAIL misaligned");
|
||||
$display("PASS task01 sb_strobe=1000 sb_data=aa000000 sh_strobe=1100 sh_data=beef0000 sw_strobe=1111 fault=1");
|
||||
$finish;
|
||||
end
|
||||
endmodule
|
||||
Reference in New Issue
Block a user