1. Alok Mandal
  2. SystemVerilog
  3. Wednesday, 11 March 2020
how to print this string in systemverilog

module tb;
string str='10ns'; // NOTE : str value is in single type quotation
initial begin

i am getting syntax error when tried to print single quotaed text , is there any wy to print (without putting text into double quotation );

Responses (1)
Accepted Answer Pending Moderation
SystemVerilog does not allow you to represent strings in single quotes in my knowledge. If you want to use double quotes within a string you can use it with \ escape sequencer.

string str = "\"10ns\"";

If you are doing this to print time values, you can instead use %0t to print realtime, and time variables

$display("Simulation time now is %0t", $time);
  1. more than a month ago
  2. SystemVerilog
  3. # 1
  • Page :
  • 1

There are no replies made for this post yet.
Be one of the first to reply to this post!