From 09c3d9b58e018fea3dd0b2bcc95c249815c32542 Mon Sep 17 00:00:00 2001 From: Daniel Jobson Date: Thu, 21 Nov 2024 14:21:36 +0100 Subject: [PATCH] tb: Make tb_tk1.v selftesting - Exit with the right error code --- hw/application_fpga/core/tk1/tb/tb_tk1.v | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/hw/application_fpga/core/tk1/tb/tb_tk1.v b/hw/application_fpga/core/tk1/tb/tb_tk1.v index 640a714..2344849 100644 --- a/hw/application_fpga/core/tk1/tb/tb_tk1.v +++ b/hw/application_fpga/core/tk1/tb/tb_tk1.v @@ -714,6 +714,22 @@ module tb_tk1 (); end endtask // test10 + //---------------------------------------------------------------- + // exit_with_error_code() + // + // Exit with the right error code + //---------------------------------------------------------------- + task exit_with_error_code; + begin + if (error_ctr == 0) begin + $finish(0); + end + else begin + $fatal(1); + end + end + endtask // exit_with_error_code + //---------------------------------------------------------------- // tk1_test @@ -744,7 +760,7 @@ module tb_tk1 (); $display(" -= Testbench for tk1 completed =-"); $display(" ============================="); $display(""); - $finish; + exit_with_error_code(); end // tk1_test endmodule // tb_tk1