1 @page pQueueImplementationNotes Queue implementation notes
3 The queues are used to store the items that needs to be compared.
4 It is possible to select the maximum number of items you can store before
5 obtaining an error by modifying the value of cl_syoscb_cfg.max_queue_size.
7 The scoreboard provides two different queue topologies. Standard queues, which are based on SV queues,
8 and hash queues, which use an associative array to store items.
9 In the following figure it is possible to see the format of the two different types of queues.
11 \image html queues.png width=50%
12 \image latex queues.pdf
14 The hash queue shows that multiple sequence items may be associated with the same hash value. This is a rare occurrence, and should almost never happen. In the cases where it does happen, the scoreboard tracks all items with matching hash values, ensuring that no sequence items are lost in case of a hash collision.
16 The two types of queues are further described in the table below:
24 <td>cl_syoscb_queue_std</td>
25 <td>SystemVerilog queue. New items are added at the end of the queue. </td>
28 <td>cl_syoscb_queue_hash</td>
29 <td>Associative array. Items are stored as key-value pairs, using the hash values of the packed item (using \c object.pack())
30 as the key. The value is a SV queue storing all items with that hash value. The queue is used
31 to handle the very rare cases where two seq. items have the same hash value.</td>
35 Hash queues do not by themselves preserve insertion order. To do so, such that hash queues can be iterated in the same order as standard queues, the configuration knob cl_syoscb_cfg.ordered_next must be enabled.
36 - Configuration knob set to 1: Guarantees the order of insertions by maintaining some metadata.
37 This ensures that when using an iterator and traversing the queue with the iterator's \c next method, items are returned in the same order as they were inserted.
38 The OOO compare with hashed queues take a minor performance hit when this is enabled.
40 - Configuration knob set to 0: Uses the SystemVerilog implementation of the \c next
41 method for associative arrays. This does not guarantee the iteration order to be the order that items were inserted in.
42 For OOO compares using hash queues, this is the option which makes the OOO compare perform at its maximum.
44 The advantage of using hash queue can be seen when using OOO comparisons. To check if an element is in a queue or not, all that is required is to check if the hash value is in the associative array. This operation runs in <b>O(1)</b> time. Using the SystemVerilog queue, checking if an item is present runs in <b>O(n)</b> time, where n is the number of items in the queue.
46 In the following graph, the time needed to finish the comparison using out of order compare is shown for the standard queue vs. the MD5 hash queue. It is obvious that hash queues are much better suited for large queues when using OOO comparisons than standard queues.
48 \image html benchmark.png width=50%
49 \image latex benchmark.png