Skip to content

Commit

Permalink
target/sim: Correctly handle empty UART lines (pulp-platform#141)
Browse files Browse the repository at this point in the history
Currently, printing empty lines (back-to-back `\n`s) causes Questasim to
crash while attempting to stream the empty `uart_read_buf`. Fix this by
checking if `uart_read_buf` is empty.

Signed-off-by: Nils Wistoff <[email protected]>
  • Loading branch information
niwis authored Aug 29, 2024
1 parent c3e6f0d commit 99dd957
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions target/sim/src/vip_cheshire_soc.sv
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,12 @@ module vip_cheshire_soc import cheshire_pkg::*; #(
uart_boot_byte = bite;
uart_boot_ena = 0;
end else if (bite == "\n") begin
$display("[UART] %s", {>>8{uart_read_buf}});
uart_read_buf.delete();
if (uart_read_buf.size() > 0) begin
$display("[UART] %s", {>>8{uart_read_buf}});
uart_read_buf.delete();
end else begin
$display("[UART]");
end
end else if (bite == UartDebugEoc) begin
uart_boot_eoc = 1;
end else begin
Expand Down

0 comments on commit 99dd957

Please sign in to comment.