tb: Make uart selftesting

- Exit with the right exit code
This commit is contained in:
Daniel Jobson 2024-11-21 15:32:26 +01:00
parent c637c745cc
commit 66888a3756
No known key found for this signature in database
GPG Key ID: 3707A9DBF4BB8F1A

View File

@ -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