From e47b00862ec03c28b51618540375dd825d2eabed Mon Sep 17 00:00:00 2001 From: Daniel Jobson Date: Thu, 21 Nov 2024 15:32:26 +0100 Subject: [PATCH] tb: make uart selftesting - Exit with the right exit code --- hw/application_fpga/core/uart/tb/tb_uart.v | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/hw/application_fpga/core/uart/tb/tb_uart.v b/hw/application_fpga/core/uart/tb/tb_uart.v index 0019ff5d..4d67656e 100644 --- a/hw/application_fpga/core/uart/tb/tb_uart.v +++ b/hw/application_fpga/core/uart/tb/tb_uart.v @@ -324,6 +324,23 @@ module tb_uart (); endtask // display_test_result + //---------------------------------------------------------------- + // 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 + + //---------------------------------------------------------------- // uart_test // The main test functionality. @@ -340,7 +357,7 @@ module tb_uart (); display_test_result(); $display("*** Simulation done."); - $finish; + exit_with_error_code(); end // uart_test endmodule // tb_uart