2

How do you escape % in the SystemVerilog $display statement?

toolic
  • 57,801
  • 17
  • 75
  • 117
Jean
  • 21,665
  • 24
  • 69
  • 119

1 Answers1

1

From IEEE Std 1800-2017, section 21.2.1 The display and write tasks:

The special character string %% indicates the display of the percent sign character %

module tb;
    initial $display("hello %% world");
endmodule

The above displays:

hello % world

Run it on EDA playground.

For a more complex example, see How can I automatically scale a $display column width?

toolic
  • 57,801
  • 17
  • 75
  • 117