RTL Studio Open IDE

Wiki SystemVerilog Queues

Queues

Ordered TB buffers with push_back and pop_front.

A queue (type q[$]) is an ordered list you can push and pop. Scoreboards and stimulus fifos use queues; synthesis does not.

flowchart LR
  gen[generator] --> pb["push_back"]
  pb --> q["txn q[$]"]
  q --> pf["pop_front"]
  pf --> drv[driver]
transaction q[$];
q.push_back(tr);
tr2 = q.pop_front();

$ is the queue dimension. Methods: push_back, push_front, pop_front, pop_back, size. A mailbox is a thread-safe alternative when two processes rendezvous.

Wrong vs right

Wrong — busy-wait while (q.size()==0); without a wait event (delta-cycle spin).

Right — wait (q.size() > 0) or use a mailbox get.

See also