From 31ba1b60dadff0d6dfa304755bfebe968b51aca7 Mon Sep 17 00:00:00 2001 From: Jean THOMAS Date: Thu, 16 Jul 2020 15:36:00 +0200 Subject: [PATCH] Use assertions in simsoc testbench --- gram/simulation/simsoctb.v | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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 -- 2.30.2