SyoSil ApS UVM Scoreboard  1.0.3.0
cl_syoscb_compare_ooo.svh
1 /// Class which implements the out of order compare algorithm
3  //-------------------------------------
4  // UVM Macros
5  //-------------------------------------
6  `uvm_object_utils(cl_syoscb_compare_ooo)
7 
8  //-------------------------------------
9  // Constructor
10  //-------------------------------------
11  extern function new(string name = "cl_syoscb_compare_ooo");
12 
13  //-------------------------------------
14  // Compare Strategy API
15  //-------------------------------------
16  // *NOTE*: init() hook s not used by the out-of-order compare
17  extern protected virtual function void primary_loop_do();
18  extern protected virtual function void secondary_loop_do();
19  extern protected virtual function string get_count_producer();
20 endclass: cl_syoscb_compare_ooo
21 
22 function cl_syoscb_compare_ooo::new(string name = "cl_syoscb_compare_ooo");
23  super.new(name);
24 endfunction: new
25 
26 /// <b>Compare Strategy API</b>: Implementation of the out-of-order comparison is here.
27 ///
28 /// The algorithm iterates over the primary queue, starting from the oldest inserted item.
29 /// For each item in the primary queue, it then loops over all secondary queues,
30 /// attempting to find a matching item in the secondary queue.
31 /// If a match for an item in the primary queue is found in all secondary queues,
32 /// all of those items are removed from their respective queues.
33 /// If a match is not found in all queues, nothing is deleted.
34 /// Note that this means that if some items are not matched, the queues will be non-empty
35 /// at the end of simulation. This is caught in the cl_syoscb#check_phase.
36 ///
37 /// The number of items that are inspected in each queue is controlled by the value of
38 /// cl_syoscb_cfg#max_search_window for that specific queue.
40  int unsigned msw = this.cfg.get_max_search_window(this.primary_queue_name);
41 
42  //Reset primary iterator to first element, loop through at most max_search_window primary elements, comparing to secondary elements
43  if(this.primary_queue_iter.first()) begin
44  while(this.primary_queue_iter.has_next() && (msw > 0 ? this.primary_queue_iter.next_index() < msw : 1)) begin
45  this.primary_item_proxy = this.primary_queue_iter.next();
46  `uvm_info("DEBUG", $sformatf("[%s]: cmp-ooo: Now comparing primary transaction:\n%s", this.cfg.get_scb_name(), cl_syoscb_string_library::sprint_item(this.primary_queue.get_item(this.primary_item_proxy), this.cfg)), UVM_FULL);
47 
48  // Clear secondary match item counter before starting new secondary queue loop
50  this.secondary_loop_do();
51  //break out if matches were found
52  if(this.delete()) begin
53  break;
54  end
55  end
56  end
57 endfunction: primary_loop_do
58 
59 /// <b>Compare Strategy API</b>: Loop through all secondary queues, attempting to find an item
60 /// which matches the item from the primary queue (as specified by #primary_item_proxy).
61 /// Searches at most cl_syoscb_cfg#max_search_window in each secondary queue if std. queues are used.
62 /// If MD5 queues are used, the max search window is not applied.
64  // Inner loop through all queues
65  foreach(this.secondary_queue_names[i]) begin
66  cl_syoscb_queue_locator_base secondary_queue_loc;
67  cl_syoscb_proxy_item_base secondary_proxy_item;
68 
69  if(this.secondary_queues[i] == null) begin
70  `uvm_fatal("QUEUE_ERROR", $sformatf("[%s]: cmp-ooo: Unable to retrieve secondary queue handle", this.cfg.get_scb_name()));
71  end
72 
73  `uvm_info("DEBUG", $sformatf("[%s]: cmp-ooo: %0d items in queue: %s", this.cfg.get_scb_name(), secondary_queues[i].get_size(), this.secondary_queue_names[i]), UVM_FULL);
74 
75  // Get a locator for the secondary queue
76  secondary_queue_loc = secondary_queues[i].get_locator();
77  secondary_proxy_item = secondary_queue_loc.search(this.primary_item_proxy);
78 
79  if(secondary_proxy_item == null) begin
80  break;
81  end else begin
82  this.secondary_item_found[this.secondary_queue_names[i]] = secondary_proxy_item;
83  end
84  end
85 endfunction: secondary_loop_do
86 
87 
88 /// <b>Compare Strategy API</b>: For OOO comparisons, the overrided function returns the producer
89 /// of the first element (the oldest) inside the primary queue.
91  cl_syoscb_proxy_item_base l_item_proxy;
92  cl_syoscb_item l_item;
93 
94  if(this.primary_queue_iter == null) begin
95  this.primary_queue_iter = this.primary_queue.create_iterator("default");
96  end
97 
98  void'(this.primary_queue_iter.first());
99 
100  l_item_proxy = this.primary_queue_iter.next();
101  l_item = this.primary_queue.get_item(l_item_proxy);
102  void'(this.primary_queue_iter.first());
103 
104  return l_item.get_producer();
105 endfunction: get_count_producer
virtual void primary_loop_do()
Compare Strategy API: Implementation of the out-of-order comparison is here.
cl_syoscb_queue_iterator_base primary_queue_iter
Iterator into primary queue.
The UVM scoreboard item which wraps uvm_sequence_item .
virtual void secondary_loop_do()
Compare Strategy API: Loop through all secondary queues, attempting to find an item which matches the...
cl_syoscb_queue_base secondary_queues[]
Handles to secondary queues.
Class which implements the out of order compare algorithm.
Base class for all proxy items.
Base class for all compare algorithms.
virtual bit delete()
Compare Strategy API: Deletes matched items from the primary and all secondary queues if a match was ...
cl_syoscb_proxy_item_base secondary_item_found[string]
Associative array used to indicate if a matching item was found in a secondary queue.
virtual string get_count_producer()
Compare Strategy API: For OOO comparisons, the overrided function returns the producer of the first e...
Locator base class defining the locator API used for searching in queues.
string secondary_queue_names[]
Names of secondary queues.
cl_syoscb_proxy_item_base primary_item_proxy
Proxy item for the item being searched for in all secondary queue.
cl_syoscb_queue_base primary_queue
Handle to primary queue.
cl_syoscb_cfg cfg
Handle to the configuration object.

Project: SyoSil ApS UVM Scoreboard, Revision: 1.0.3.0

Copyright 2014-2022 SyoSil ApS
All Rights Reserved Worldwide

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
doxygen
Doxygen Version: 1.8.14
Generated with IDV SV Filter Version: 2.6.3
Fri Sep 2 2022 14:39:07
Find a documentation bug? Report bugs to: scoreboard@syosil.com