SyoSil ApS UVM Scoreboard  1.0.3.0
cl_syoscb_hash_item.svh
1 /// A utility class used to wrap cl_syoscb_item objects when when using hash queues.
2 /// In case of a hash collision, this class contains a queue of all items with the same hash
3 class cl_syoscb_hash_item extends uvm_object;
4  //-------------------------------------
5  // Non randomizable variables
6  //-------------------------------------
7  /// Queue of cl_syoscb_item with the same hash
8  local cl_syoscb_item items[$];
9 
10  //-------------------------------------
11  // UVM Macros
12  //-------------------------------------
13  `uvm_object_utils_begin(cl_syoscb_hash_item)
14  `uvm_field_queue_object(items, UVM_DEFAULT)
15  `uvm_object_utils_end
16 
17  //-------------------------------------
18  // Constructor
19  //-------------------------------------
20  function new(string name = "cl_syoscb_hash_item");
21  super.new(name);
22  endfunction : new
23 
24  //-------------------------------------
25  // Item API
26  //-------------------------------------
27  extern virtual function cl_syoscb_item get_item(int unsigned idx = 0);
28  extern virtual function void add_item(cl_syoscb_item item);
29  extern virtual function int unsigned get_size();
30  extern virtual function void delete_item(int unsigned idx = 0);
31 endclass: cl_syoscb_hash_item
32 
33 /// <b>Item API:</b> Returns an item from this hash item's queue
34 /// If called without parameters, returns the first item from the queue
35 /// If idx is not a valid index in the queue, raises a UVM_WARNING and returns null
36 ///
37 /// \param idx The index to access. Defaults to 0
38 /// \return The item at that index, or null if no items exist / the index is invalid
39 function cl_syoscb_item cl_syoscb_hash_item::get_item(int unsigned idx = 0);
40  if(idx >= this.items.size()) begin
41  `uvm_warning("HASH_ERROR", $sformatf("No item at index %0d in hash item, size of hash item queue is %0d", idx, this.items.size()))
42  return null;
43  end else if (this.items.size() == 0) begin
44  return null;
45  end else begin
46  return this.items[idx];
47  end
48 endfunction: get_item
49 
50 /// <b>Item API:</b> Adds an item to this hash item
51 /// \param item The item to add
52 function void cl_syoscb_hash_item::add_item(cl_syoscb_item item);
53  this.items.push_back(item);
54 endfunction: add_item
55 
56 /// <b>Item API:</b> Returns the number of items stored in this hash item
57 function int unsigned cl_syoscb_hash_item::get_size();
58  return this.items.size();
59 endfunction: get_size
60 
61 /// <b>Item API:</b> Deletes an item from this hash item
62 ///
63 /// \param idx The index of the item to delete. If index is out range,
64 /// generates a UVM_ERROR
65 function void cl_syoscb_hash_item::delete_item(int unsigned idx = 0);
66  if(idx >= this.items.size()) begin
67  `uvm_error("HASH_ERROR", $sformatf("Cannot delete item at index %0d, out of range (only %0d items in hash item)", idx, this.items.size()))
68  end else begin
69  this.items.delete(idx);
70  end
71 endfunction: delete_item
cl_syoscb_item items[$]
Queue of cl_syoscb_item with the same hash.
The UVM scoreboard item which wraps uvm_sequence_item .
virtual cl_syoscb_item get_item(int unsigned idx=0)
Item API: Returns an item from this hash item&#39;s queue If called without parameters, returns the first item from the queue If idx is not a valid index in the queue, raises a UVM_WARNING and returns null
virtual void add_item(cl_syoscb_item item)
Item API: Adds an item to this hash item
virtual void delete_item(int unsigned idx=0)
Item API: Deletes an item from this hash item
virtual int unsigned get_size()
Item API: Returns the number of items stored in this hash item
A utility class used to wrap cl_syoscb_item objects when when using hash 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:16
Find a documentation bug? Report bugs to: scoreboard@syosil.com