From 7f8427033ae59094f54e9abb46a3341eda9a4452 Mon Sep 17 00:00:00 2001 From: Daniel Jobson Date: Thu, 21 Nov 2024 15:28:20 +0100 Subject: [PATCH] tb: make trng selftesting - Exit with the right error code --- hw/application_fpga/core/trng/tb/tb_trng.v | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/hw/application_fpga/core/trng/tb/tb_trng.v b/hw/application_fpga/core/trng/tb/tb_trng.v index 8c7f6d47..eb8893b9 100644 --- a/hw/application_fpga/core/trng/tb/tb_trng.v +++ b/hw/application_fpga/core/trng/tb/tb_trng.v @@ -221,6 +221,22 @@ module tb_trng (); end endtask // test1 + //---------------------------------------------------------------- + // 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 + //---------------------------------------------------------------- // trng_test @@ -240,7 +256,7 @@ module tb_trng (); $display(" -= Testbench for trng completed =-"); $display(" =============================="); $display(""); - $finish; + exit_with_error_code(); end // trng_test endmodule // tb_trng