User guide
24-32
SystemVerilog Testbench Constructs
The $display system tasks display the following:
first second third forth
first next somewhere second third forth
delete
Removes an element from the queue, specified by element
number. If you don’t specify an element number, this method
deletes all elements in the queue.
string strque [$] = {"first","second","third"};
initial
begin
for (int i =0; i<strque.size; i++)
$write(strque[i]," ");
$display(" ");
strque.delete(1);
for (int i =0; i<strque.size; i++)
$write(strque[i]," ");
end
The system tasks display the following:
first second third
first third
pop_front
Removes and returns the first element of the queue.
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_front;
$display("s1 after pop contains %s ",s1);
$write("the elements of strque are ");