User guide
24-10
SystemVerilog Testbench Constructs
if (string1 == "123")
$display("string1 %s",string1);
string1.itoa(r1);
if (string1 == "456")
$display("string1 %s",string1);
end
The $display system tasks display:
string1 123
hextoa()
hextoa(arg) returns the ASCII hexadecimal representation of the arg.
octtoa()
octtoa(arg) returns the ASCII octal representation of the arg.
bintoa()
bintoa(arg) returns the ASCII binary representation of the arg.
realtoa()
realtoa(arg) returns the ASCII real representation of the arg.
The following program explains the usage of these string methods.
program test();
string s;
real r;
logic [11:0] h = 'hfa1;
reg [11:0] o = 'o172;
bit [5:0] b = 'b101010;
task t1();