Mailboxes and queues are couple of basic data constructs of system verilog language.
Lets get to the definition of them:
Queue in system verilog is a list of similar elements. Queue is built on top of an array.
Delcaration of a queue.
The default size of the queue in system verilog is "Infinite". The above declaration will create a que of infinite length. You can add elements to the que until your simulator crashes :)
What if you want to create a queue of finite length. Just look at the declaration below:
Q. What happens when you pop from empty queue.
Ans. When you pop an empty queue, the result depends on type of the queue.
* When you pop from a queue of prebuilt data types, like integer, bit, real... The return value is '0'.
* When you pop from queue of some class, the result is null object.
Q. What happens when you push into queue which is finite and full.
Lets get to the definition of them:
Queue:
A Queue in system verilog function as the name suggests. But with a twist.Queue in system verilog is a list of similar elements. Queue is built on top of an array.
Delcaration of a queue.
<TYPE> <que_name>[$];
Default Behaviour: The default size of the queue in system verilog is "Infinite". The above declaration will create a que of infinite length. You can add elements to the que until your simulator crashes :)
What if you want to create a queue of finite length. Just look at the declaration below:
<TYPE> <que_name>[$:<LIMIT>];
The above declaration will create a queue of size "LIMIT+1"
Initializing queue with elements
Accessing elements of a queue
Methods in queue
Inserting elements into queue
Reoving elements from queue
http://www.project-veripage.com/queue_1.php Now some points to ponderQ. What happens when you pop from empty queue.
Ans. When you pop an empty queue, the result depends on type of the queue.
* When you pop from a queue of prebuilt data types, like integer, bit, real... The return value is '0'.
* When you pop from queue of some class, the result is null object.
Q. What happens when you push into queue which is finite and full.
what happens if we pop already empty queue?
ReplyDelete