diff --git a/hw/application_fpga/core/trng/tb/tb_trng.v b/hw/application_fpga/core/trng/tb/tb_trng.v index 8c7f6d4..82292f1 100644 --- a/hw/application_fpga/core/trng/tb/tb_trng.v +++ b/hw/application_fpga/core/trng/tb/tb_trng.v @@ -177,7 +177,7 @@ module tb_trng (); // the word read will be available in the global variable // read_data. //---------------------------------------------------------------- - task read_word(input [ 7 : 0] address, input [31 : 0] expected); + task read_word(input [7 : 0] address, input [31 : 0] expected); begin : read_word reg [31 : 0] read_data; @@ -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