From: Jean THOMAS Date: Thu, 16 Jul 2020 13:36:00 +0000 (+0200) Subject: Use assertions in simsoc testbench X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=31ba1b60dadff0d6dfa304755bfebe968b51aca7;p=gram.git Use assertions in simsoc testbench --- diff --git a/gram/simulation/simsoctb.v b/gram/simulation/simsoctb.v index 2c9d15d..cd3b433 100644 --- a/gram/simulation/simsoctb.v +++ b/gram/simulation/simsoctb.v @@ -183,7 +183,7 @@ module simsoctb; #2000; wishbone_read(32'h10000000 >> 2, tmp); - #2000; + #2000 assert_equal_32(tmp, 32'hFACECA8C); // Write wishbone_write(32'h10000000 >> 2, 32'h12345678); @@ -265,4 +265,17 @@ module simsoctb; #50; end endtask + + task assert_equal_32; + input [31:0] inA; + input [31:0] inB; + + begin + if (inA != inB) + begin + $display("%m at %t: Assertion failed (32-bit) equality: %08x != %08x", $time, inA, inB); + $finish; + end + end + endtask endmodule