Skip to content

Commit

Permalink
tb: make uart selftesting
Browse files Browse the repository at this point in the history
- Exit with the right exit code
  • Loading branch information
dehanj committed Nov 22, 2024
1 parent 3843332 commit e47b008
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion hw/application_fpga/core/uart/tb/tb_uart.v
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -340,7 +357,7 @@ module tb_uart ();

display_test_result();
$display("*** Simulation done.");
$finish;
exit_with_error_code();
end // uart_test
endmodule // tb_uart

Expand Down

0 comments on commit e47b008

Please sign in to comment.