System Verilog has new data type called ‘queue’ which can grow and shrink. With SV queue, we can easily add and remove elements anywhere that is the reason we say it can shrink and grow as we need. Queues can be used as LIFO (Last In First Out) Buffer or FIFO (First In First Out) type of buffers.
Each element in the queue is identified by an ordinal number that represents its position within the queue, with 0 representing the first element and $ represents the last element.
The size of the queue is variable similar to dynamic array but queue may be empty with zero element and still its a valid data structure.
Lets take a few examples to understand queue operation with different methods we have in system verilog.