SyoSil ApS UVM Scoreboard  1.0.3.0
cl_syoscb_compare_io.svh
1 /// Implementation of the in-order comparison algorithm for N queues.
3 
4  ///Scoreboard wrapper item from the primary queue
6 
7  //-------------------------------------
8  // UVM Macros
9  //-------------------------------------
10  `uvm_object_utils_begin(cl_syoscb_compare_io)
11  `uvm_field_object(primary_item, UVM_DEFAULT)
12  `uvm_object_utils_end
13 
14  //-------------------------------------
15  // Constructor
16  //-------------------------------------
17  extern function new(string name = "cl_syoscb_compare_io");
18 
19  //-------------------------------------
20  // Compare Strategy API
21  //-------------------------------------
22  extern protected virtual function void primary_loop_do();
23  extern protected virtual function void count_producers(string producer = "");
24  extern protected virtual function void secondary_loop_do();
25 
26 endclass: cl_syoscb_compare_io
27 
28 function cl_syoscb_compare_io::new(string name = "cl_syoscb_compare_io");
29  super.new(name);
30 endfunction: new
31 
32 /// <b>Compare Strategy API</b>: Implementation of the in-order comparison algorithm.
33 ///
34 /// In the primary loop, the algorithm extracts the oldest inserted element
35 /// from the primary queue, and then starts looping over all secondary queues
36 /// to find a matching item in #secondary_loop_do.
37 /// If matching items are found, these are removed from all of the queues
38 /// If no matching items are found, a miscompare is generated and a UVM_ERROR is issued.
40  `uvm_info("DEBUG", $sformatf("[%s]: cmp-io: number of queues: %0d", this.cfg.get_scb_name(), this.secondary_queues.size()+1), UVM_FULL);
41  `uvm_info("DEBUG", $sformatf("[%s]: cmp-io: primary queue: %s", this.cfg.get_scb_name(), this.primary_queue_name), UVM_FULL);
42 
43  // Get first item in primary queue
44  // *NOTE*: No need to check if there is any item since compare_do is only invoked
45  // if there is at least a single element in all queues
46  //Iterator has already been reset in create_primary_iterator, so we can get the item right now
47  this.primary_item_proxy = this.primary_queue_iter.next();
48  this.primary_item = this.primary_queue.get_item(this.primary_item_proxy);
49 
50  `uvm_info("DEBUG", $sformatf("[%s]: cmp-io: Now comparing primary transaction:\n%s",
51  this.cfg.get_scb_name(),
52  cl_syoscb_string_library::sprint_item(primary_item, this.cfg)),
53  UVM_FULL);
54 
55  // Clear secondary match item counter before starting new secondary queue loop
57 
58  this.secondary_loop_do();
59 
60  void'(this.delete());
61 endfunction: primary_loop_do
62 
63 function void cl_syoscb_compare_io::count_producers(string producer = "");
64  // For io compare, this function is kept empty. This because
65  // for io, the count_producers does not make sense because
66  // Item are ever matched starting from the first element in each queue
67  // Idependently by the producer. If the inserted item belongs to a different producer,
68  // a simply miscompare error will be generated
69 endfunction: count_producers
70 
71 /// <b>Compare Strategy API:</b> Loop through all the secondary queues, checking if the first item in that
72 /// secondary queues matches the first in the primary queue.
73 /// If a match is found, this is recorded in cl_syoscb_compare_base#secondary_items_found
75  foreach(this.secondary_queues[i]) begin
76  `uvm_info("DEBUG", $sformatf("[%s]: cmp-io: Looking at secondary queue: %s", this.cfg.get_scb_name(), this.secondary_queue_names[i]), UVM_FULL);
77 
78  `uvm_info("DEBUG", $sformatf("[%s]: cmp-io: %0d items in queue: %s", this.cfg.get_scb_name(),secondary_queues[i].get_size(), this.secondary_queue_names[i]), UVM_FULL);
79 
80  // Do the compare
81  begin
82  cl_syoscb_item secondary_item;
83  string sec_queue_name;
84  cl_syoscb_proxy_item_base sec_proxy;
85  uvm_comparer comparer;
87 
88  sec_queue_name = this.secondary_queue_names[i];
89 
90  //Get first item of sec. queue using an iterator
91  //Cannot use proxy item to get it, as this will allow hash-queues to find items that are not in order
92  iter = this.secondary_queues[i].get_iterator("default");
93  if(iter == null) begin
94  iter = this.secondary_queues[i].create_iterator("default");
95  end
96  void'(iter.first());
97  sec_proxy = iter.next();
98 
99  secondary_item = this.secondary_queues[i].get_item(sec_proxy);
100  comparer = this.cfg.get_comparer(this.primary_queue_name, this.primary_item.get_producer());
101  if(comparer == null) begin
102  comparer = this.cfg.get_default_comparer();
103  end
104 
105  if(secondary_item.compare(this.primary_item, comparer) == 1'b1) begin
106  `uvm_info("DEBUG", $sformatf("[%s]: cmp-io: Secondary item found:\n%s",
107  this.cfg.get_scb_name(),
108  cl_syoscb_string_library::sprint_item(secondary_item, this.cfg)),
109  UVM_FULL);
110 
111  this.secondary_item_found[sec_queue_name] = sec_proxy;
112  end else begin
113  string miscmp_table;
114 
115  miscmp_table = this.generate_miscmp_table(this.primary_item, secondary_item, sec_queue_name, comparer, "cmp-io");
116  `uvm_error("COMPARE_ERROR", $sformatf("\n%0s", miscmp_table))
117 
118  break; //Exit foreach loop on error
119  end
120  end
121  end
122 endfunction: secondary_loop_do
virtual void primary_loop_do()
Compare Strategy API: Implementation of the in-order comparison algorithm.
cl_syoscb_queue_iterator_base primary_queue_iter
Iterator into primary queue.
The UVM scoreboard item which wraps uvm_sequence_item .
cl_syoscb_queue_base secondary_queues[]
Handles to secondary queues.
cl_syoscb_item primary_item
Scoreboard wrapper item from the primary queue.
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.
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.
Queue iterator base class defining the iterator API used for iterating over queues.
cl_syoscb_queue_base primary_queue
Handle to primary queue.
virtual void count_producers(string producer="")
Compare Strategy API: Checks if the producer of the current item exists in all other queues...
virtual string generate_miscmp_table(cl_syoscb_item primary_item, cl_syoscb_item secondary_item, string sec_queue_name, uvm_comparer comparer, string cmp_name)
Generates a side-by-side comparison of the seq.
virtual void secondary_loop_do()
Compare Strategy API: Loop through all the secondary queues, checking if the first item in that secon...
cl_syoscb_cfg cfg
Handle to the configuration object.
Implementation of the in-order comparison algorithm for N queues.

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:00
Find a documentation bug? Report bugs to: scoreboard@syosil.com