Ready-to-run snippets

Code Examples

Ready-to-run Verilog, SystemVerilog, and UVM examples. Click any to open it live in the IDE.

← All examples

Queue: Simple FIFO Scoreboard

SystemVerilog Arrays

Push values into a queue and pop them in order until it is empty

Open in IDE
testbench.sv
module tb;
  int expected_q [$];

  initial begin
    expected_q.push_back(10);
    expected_q.push_back(20);
    expected_q.push_back(30);

    while (expected_q.size() > 0) begin
      $display("Popped %0d, remaining size=%0d", expected_q.pop_front(), expected_q.size());
    end
  end
endmodule
Admin mode — edit and delete controls are visible on each row. Use the IDE to add new snippets via File → Save as Snippet.