User guide

24-33
SystemVerilog Testbench Constructs
for (int i =0; i<strque.size; i++)
$write(strque[i]," ");
end
The system tasks display the following:
the elements of strque are first second third
s1 before pop contains
s1 after pop contains first
the elements of strque are second third
string strque [$] = {"first","second","third"};
string s1;
initial
begin
for (int i =0; i<strque.size; i++)
$write(strque[i]," ");
$display(" ");
s1 = strque.pop_front;
for (int i =0; i<strque.size; i++)
$write(strque[i]," ");
end
The system tasks display the following:
first second third
second third
pop_back
Removes and returns the last element in the queue.
program prog;
string strque [$] = {"first","second","third"};
string s1;
initial
begin
$write("the elements of strque are ");
for (int i =0; i<strque.size; i++)
$write(strque[i]," ");
$display("\ns1 before pop contains %s ",s1);
s1 = strque.pop_back;