SyoSil ApS UVM Scoreboard  1.0.3.0
cl_syoscb_queue_locator_std.svh
1 /// Locator class for searching over std queues
3  //-------------------------------------
4  // UVM Macros
5  //-------------------------------------
6  `uvm_object_utils(cl_syoscb_queue_locator_std)
7 
8  function new(string name = "cl_syoscb_queue_locator_std");
9  super.new(name);
10  endfunction: new
11 
12  //-------------------------------------
13  // Locator API
14  //-------------------------------------
15  extern virtual function cl_syoscb_proxy_item_base search(cl_syoscb_proxy_item_base proxy_item);
16 
17  //-------------------------------------
18  // Internal support functions
19  //-------------------------------------
20  extern virtual function bit compare_items(cl_syoscb_item primary_item,
21  cl_syoscb_item sec_item,
22  uvm_comparer comparer);
23 
25 
26 /// <b>Locator API:</b> See cl_syoscb_queue_locator_base#search for details
27 function cl_syoscb_proxy_item_base cl_syoscb_queue_locator_std::search(cl_syoscb_proxy_item_base proxy_item);
28  uvm_comparer comparer;
29  int unsigned msw;
30  cl_syoscb_item primary_item;
31  cl_syoscb_queue_std owner_std;
32  cl_syoscb_item queue[$];
33  int found[$];
34 
35  //Get variables and handle to owner as std queue
36  msw = this.cfg.get_max_search_window(this.owner.get_name());
37  primary_item = proxy_item.get_item();
38  comparer = this.cfg.get_comparer(this.owner.get_name(), primary_item.get_producer());
39  if(comparer == null) begin
40  comparer = this.cfg.get_default_comparer();
41  end
42  if(!$cast(owner_std, this.owner)) begin
43  `uvm_error("LOCATOR_ERROR", $sformatf("Unable to typecast owner from queue_base to queue_std. Type of owner is %0s", this.owner.get_type_name()))
44  end
45 
46  //Get underlying queue, trim representation if msw requires it
47  owner_std.get_native_queue(queue);
48  if(msw > 0) begin
49  queue = queue[0:msw-1];
50  end
51 
52  //Search for item, return it if found
53  found = queue.find_first_index(x) with (this.compare_items(primary_item, x, comparer));
54  if(found.size() == 1) begin
55  cl_syoscb_proxy_item_std return_proxy;
56  `uvm_info("DEBUG", $sformatf("[%0s]: cmp-ooo: Secondary item found at index %0d\n%0s",
57  this.cfg.get_scb_name(),
58  found[0],
59  queue[found[0]].sprint),
60  UVM_DEBUG)
61  return_proxy = cl_syoscb_proxy_item_std::type_id::create("return_proxy");
62  return_proxy.idx = found[0];
63  return_proxy.set_queue(this.owner);
64  return return_proxy;
65  end else if(found.size() > 1) begin //This shouldn't happen
66  `uvm_fatal("LOCATOR_ERROR", $sformatf("queue.find_first_index returned %0d indexes, that shouldn't happen", found.size()))
67  return null;
68  end else begin //size is 0
69  return null;
70  end
71 endfunction: search
72 
73 /// Compare two scoreboard items and check if they're equal.
74 /// Used as parameter to queue.find_first_index when searching std-queues
75 /// \param primary_item The item from the primary queue
76 /// \param sec_item The item from the secondary queue
77 /// \param comparer The comparer to use when comparing the two items
78 /// \return 1 if the two items are equal, 0 otherwise
79 function bit cl_syoscb_queue_locator_std::compare_items(cl_syoscb_item primary_item,
80  cl_syoscb_item sec_item,
81  uvm_comparer comparer);
82  if(primary_item.compare(sec_item, comparer)) begin
83  `uvm_info("DEBUG", "Secondary item found", UVM_DEBUG)
84  return 1'b1;
85  end else begin
86  return 1'b0;
87  end
88 endfunction: compare_items
Locator class for searching over std queues.
The UVM scoreboard item which wraps uvm_sequence_item .
cl_syoscb_cfg cfg
Local handle to the SCB cfg.
virtual bit compare_items(cl_syoscb_item primary_item, cl_syoscb_item sec_item, uvm_comparer comparer)
Compare two scoreboard items and check if they&#39;re equal.
Base class for all proxy items.
Locator base class defining the locator API used for searching in queues.
Standard implementation of a queue.
virtual cl_syoscb_proxy_item_base search(cl_syoscb_proxy_item_base proxy_item)
Locator API: See cl_syoscb_queue_locator_base::search for details
virtual bit set_queue(cl_syoscb_queue_base owner)
Locator API: Sets the queue that this locator is associated with
Proxy item implementation for standard 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:56
Find a documentation bug? Report bugs to: scoreboard@syosil.com