SyoSil ApS UVM Scoreboard  1.0.3.0
cl_syoscb_compare_io_2hp.svh
1 /// Implementation of the 2-queue, high speed in-order comparison algorithm.
3  //-------------------------------------
4  // UVM Macros
5  //-------------------------------------
6  `uvm_object_utils(cl_syoscb_compare_io_2hp)
7 
8  /// Handle to the secondary queue
10 
11  //-------------------------------------
12  // Constructor
13  //-------------------------------------
14  function new(string name = "cl_syoscb_compare_io_2hp");
15  super.new(name);
16  endfunction: new
17 
18  //-------------------------------------
19  // Compare Strategy API
20  //-------------------------------------
21  extern protected virtual function void compare_do();
22  extern protected virtual function void primary_loop_do();
24 
25 /// <b>Compare Strategy API</b>: Mandatory overwriting of the base class' do_compare method.
26 /// Here the actual in-order 2-queue compare is implemented.
27 ///
28 /// The algorithm is a specialization of the normal in-order compare which handles N queues.
29 /// Here, only 2 queues are allowed and the compare simply just checks if the first item in the
30 /// primary queue matches the first item in the secondary queue. If not then a UVM error is issued.
32 
33  if(this.secondary_queues.size() != 1) begin
34  `uvm_fatal("QUEUE_ERROR", $sformatf("[%s]: cmp-io-2hp: This in order compare only works with a single secondary queue. %0d secondary queues defined", this.cfg.get_scb_name(), this.secondary_queues.size()));
35  end
36 
37  this.primary_loop_init();
38 
39  this.primary_loop_do();
40 endfunction: compare_do
41 
42 /// <b>Compare Strategy API:</b> Selects the primary queue's first element, comparing it to the secondary queue's first element.
43 /// Does this without using #secondary_loop_do, as no looping is required.
45  `uvm_info("DEBUG", $sformatf("[%s]: cmp-io-2hp: number of queues: %0d", this.cfg.get_scb_name(), this.secondary_queues.size()+1), UVM_FULL);
46  `uvm_info("DEBUG", $sformatf("[%s]: cmp-io-2hp: primary queue: %s", this.cfg.get_scb_name(), this.primary_queue_name), UVM_FULL);
47 
48  this.primary_item_proxy = this.primary_queue_iter.next();
49  this.primary_item = this.primary_queue.get_item(this.primary_item_proxy);
50 
51  `uvm_info("DEBUG", $sformatf("[%s]: cmp-io-2hp: Now comparing primary transaction:\n%s",
52  this.cfg.get_scb_name(),
53  cl_syoscb_string_library::sprint_item(primary_item, this.cfg)),
54  UVM_FULL);
55 
57 
58  // Do the compare
59  begin
61  cl_syoscb_proxy_item_base sec_proxy;
62  cl_syoscb_item secondary_item;
63  uvm_comparer comparer;
64 
65 
66  //Get first item from sec. queue using an iterator
67  //Cannot use proxy item to get it, as this will allow hash-queues to find items that are not in order
68  iter = this.secondary_queues[0].get_iterator("default");
69  if(iter == null) begin
70  iter = this.secondary_queues[0].create_iterator("default");
71  end
72  void'(iter.first());
73  sec_proxy = iter.next();
74  secondary_item = this.secondary_queues[0].get_item(sec_proxy);
75 
76  comparer = this.cfg.get_comparer(this.primary_queue_name, this.primary_item.get_producer());
77  if(comparer == null) begin
78  comparer = this.cfg.get_default_comparer();
79  end
80 
81  if(secondary_item.compare(primary_item, comparer) == 1'b1) begin
82  `uvm_info("DEBUG", $sformatf("[%s]: cmp-io-2hp: Secondary item found:\n%s",
83  this.cfg.get_scb_name(),
84  cl_syoscb_string_library::sprint_item(secondary_item, this.cfg)),
85  UVM_FULL);
86 
87  this.secondary_item_found[secondary_queue_names[0]] = sec_proxy;
88  end else begin
89  string miscmp_table;
90 
91  miscmp_table = this.generate_miscmp_table(primary_item, secondary_item, this.secondary_queue_names[0], comparer, "cmp-io-2hp");
92  `uvm_error("COMPARE_ERROR", $sformatf("\n%0s", miscmp_table))
93  end
94  end
95 
96  void'(this.delete());
97 endfunction: primary_loop_do
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.
virtual void compare_do()
Compare Strategy API: Mandatory overwriting of the base class&#39; do_compare method. ...
virtual bit delete()
Compare Strategy API: Deletes matched items from the primary and all secondary queues if a match was ...
Implementation of the 2-queue, high speed in-order comparison algorithm.
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 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 primary_loop_do()
Compare Strategy API: Selects the primary queue&#39;s first element, comparing it to the secondary queue&#39;...
Class which represents the base concept of a queue.
cl_syoscb_cfg cfg
Handle to the configuration object.
virtual void primary_loop_init()
Compare Strategy API: Contains all the operations to be executed immediately before starting the prim...
cl_syoscb_queue_base secondary_queue
Handle to the secondary queue.
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:03
Find a documentation bug? Report bugs to: scoreboard@syosil.com