Does this queue have a variable size?
Solution 1:
A SystemVerilog queue is an array whose size is not fixed. It can grow and shrink.
bit [31:0] queue_1[$];
is a queue of 32-bit, 2-state numbers. The type bit
is a 2-state type (it can have values 1'b0
or 1'b1
). This would be a queue of 1-bit, 2-state numbers:
bit queue_1[$];
In SystemVerilog, dimensions to the left of the variable name are called packed dimensions. They represent the number of bits in a number. Dimensions to the right of a variable name are called unpacked dimensions. They represent the number of elements in an array. So, for example, this is an array of 16 32-bit numbers:
bit [31:0] array [0:15];