Full Library / Resource / Event Queue / Queue
Block Name: Queue
Code File Location: VisualSim/actor/lib/Queue_One
Note: If you have purchased the Smart_Resource package, use the Smart_Resource block and not this one.
o Define Ingress or Egress ports.
o Create a FIFO or LIFO.
o Define a temporary memory location to store requests or transactions.
o Create rudimentary cache with equal sized data access (Read or Write).
The following is a block diagram that illustrates the operation of the Queue block.
This block defines a single queue. Each transaction on the input port is queued in a FIFO or LIFO order and in the order of arrival. When the block receives a value on the pop_input port, it sends the head of the Queue on the output port. If the value on the pop_input port is an integer, it sends the data structure in the specific numbered location of the queue on the output port. If the queue is full, then the incoming Data Structure or token is placed on the reject_output port.
Refer the following Demo Models.
Statistics Output
Statistic Name |
Value |
Explanation |
Mathematical Equation |
Type |
Number_Entered |
100 |
Number of transactions entering the queue. |
- |
int |
Number_Exited |
25 |
Number of transactions that left the queue. |
- |
int |
Number_Rejected |
10 |
Number of transactions rejected and output to reject port. |
- |
int |
Queue_Number |
1 |
Queue number start at 1. |
- |
int |
Occupancy_Min |
4.0 |
Minimum queue size during the simulation. |
// Obtain Min for X, where X0 = Double.MAX_VALUE if (Xn < Xn – 1) Xmin = Xn |
double |
Occupancy_Mean |
8.0 |
Mean/Average queue size during the simulation. |
// Obtain Mean for X Xµ = (1 / n) * (X1 + X2 + … + Xn) |
double |
Occupancy_StDev |
3.0 |
Standard Deviation from the Mean queue size during the simulation. |
// Obtain Standard Deviation for X |
double |
Occupancy_Max |
25.0 |
Maximum queue size consumed during the simulation. |
// Obtain Max for X, where X0 = Double.MIN_VALUE if (Xn > Xn – 1) Xmax = Xn |
double |
Total_Delay_Min |
1.3 |
In seconds. Least time through the queue among all transactions. |
// Obtain Min for X, where X0 = Double.MAX_VALUE if (Xn < Xn – 1) Xmin = Xn |
double |
Total_Delay_Mean |
1.3 |
In seconds. Mean/Average time through the queue among all transactions. |
// Obtain Mean for X Xµ = (1 / n) * (X1 + X2 + … + Xn) |
double |
Total_Delay_StDev |
1.3 |
In seconds. Standard Deviation from the Mean time through the queue among all transactions. |
// Obtain Standard Deviation for X |
double |
Total_Delay_Max |
1.3 |
In seconds. Maximum time through the queue among all transactions. |
// Obtain Max for X, where X0 = Double.MIN_VALUE if (Xn > Xn – 1) Xmax = Xn |
double |
Utilization_Pct_Mean |
0.0 |
Not Used for Queues. Will default to 0.0. |
Where n is the number of samples and X is occupancy or delay.
Parameter |
Explanation |
Type |
Example |
Max_Queue_Length |
This Parameter is the maximum number of tokens or data structures that can be in the queue at any instance of time. All items exceeding this limit will be send to the reject_output port. |
Integer |
10 |
Initial_Queue_State |
Queue initial state attribute. This setting is used whenever the queue is empty and the first token arrives. If 'First_Token_Flow_Through' is selected, then the first data structure will flow through the queue without a pop whenever the queue is empty. If 'First_Token_Enqueue' is selected, a 'pop_queue_input' is required to obtain the first data token or data structure. |
- |
'First_Token_Flow_Through' 'First_Token_Enqueue' The default is 'First_Token_Flow_Through'. |
Queue_Type |
Queue type attribute, either 'Queue_FIFO', or 'Queue_LIFO'. The default is 'Queue_FIFO'. FIFO is First-in-first-out, whereas LIFO is Last-in-last-out. This pertains to the ordering of the incoming Data Structure in the queue. |
- |
- |
Port |
Explanation |
queue_input |
Input port for data tokens (numerical values) or data structures entering the queue. This token must arrive with a priority_input to queue the incoming token or data structure. |
pop_queue_input |
This port initiates the queue to send an item out of the queue. A '0' on the 'pop_queue_input' will send the head (front) of the FIFO queue to the 'pop_queue_output'. If the input on the 'pop_queue_input' is '1', then the second element of the queue will be sent to the 'pop_queue_output'. |
copy_queue_n_input |
This input specifies the index location of a token in the queue that must be placed on the 'Copy_queue_n_output" port. The items in the queue are not disturbed, thereby preserving the queue order. This is used to trigger an algorithm like an arbiter to act on the incoming request. This copied data structure can be a request for service or access. |
stats_input |
This port is triggered to output accumulated statistics for this block. To clear the statistics for the queue, send "-1". To output the statistics, send '1' on 'stats_input'. The statistics for the queue will be placed on the stats_output port as a Data Structure. |
pop_queue_output |
The pop data structure or token is placed on this port and the token is removed from the queue. |
reject_queue_output |
The incoming token is sent to this output if the queue is full. The type is based on the input token type. |
copy_queue_n_output |
This outputs the current token or Data Structure in the index location specified by the integer on the 'copy_queue_n_input' port. The data structure is not removed from the queue. |
queue_length_output |
This provides the length of the queue each time a token is received on the input_queue, pop_queue_input or copy_queue_n_input ports. |
stats_output |
Output port receiving queue statistics as a data structure. See top for details on the fields of this Data Structure. Note: When the statistics reset, the Number_in_Queue is equal to the current queue length. |
Created with the Personal Edition of HelpNDoc: Single source CHM, PDF, DOC and HTML Help creation