With increasing cases of COVID-19 (corona-virus), it is advised to follow WHO precautionary measures to be safe and protect others.
  1. Alok Mandal
  2. Uncategorized
  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
$display("%s",str);
end
endmodule


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

regards
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. 3 weeks ago
  2. Uncategorized
  3. # 1
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

You consent to our cookies if you continue to use our website. To know more about cookies, see our privacy policy. I accept cookies from this site.

Agree