8 function new(
string name =
"cl_syoscb_queue_locator_hash");
34 if(!$cast(proxy_item_hash,proxy_item))begin
35 `uvm_fatal(
"Incorrect item type", $sformatf(
"[%s]:Proxy_item ", this.
cfg.
get_scb_name()));
39 if(!$cast(qh,this.
owner))begin
40 `uvm_fatal(
"Incorrect queue type", $sformatf(
"[%s]:Queue ", this.
cfg.
get_scb_name()));
43 if(!$cast(q_primary, proxy_item.get_queue())) begin
44 `uvm_fatal(
"TYPECAST", $sformatf(
"[%0s]Incorrect queue type from proxy item. Expected hash queue, got %0s", this.
cfg.
get_scb_name(), proxy_item.get_queue().get_type_name()))
50 hash_primary = q_primary.get_hash();
52 if(hash.exists(proxy_item_hash.digest) == 1) begin
54 proxy_item_hash_return.digest = proxy_item_hash.digest;
56 proxy_item_hash_return.idx = 0;
60 if(hash.get_size(proxy_item_hash.digest) != 1 || hash_primary.get_size(proxy_item_hash.digest) != 1) begin
62 uvm_comparer comparer;
64 primary_item = proxy_item_hash.get_item();
65 comparer = this.
cfg.get_comparer(this.
owner.get_name(), primary_item.get_producer());
66 if(comparer == null) begin
67 comparer = this.
cfg.get_default_comparer();
69 for(
int i=0; i<hash.get_size(proxy_item_hash.digest) && !found; i++) begin
70 sec_item = hash.get_item(proxy_item_hash.digest, i);
71 if(primary_item.compare(sec_item, comparer)) begin
72 proxy_item_hash_return.idx = i;
81 if(found && this.
validate_match(proxy_item, proxy_item_hash_return)) begin
82 return proxy_item_hash_return;
106 if(!$cast(primary_proxy_hash, primary_proxy)) begin
107 `uvm_fatal(
"ITEM_TYPE",
"Primary item was not a hash item")
111 pk_syoscb::SYOSCB_HASH_COMPARE_VALIDATE_NO_MATCH,
112 pk_syoscb::SYOSCB_HASH_COMPARE_NO_VALIDATION: begin
115 pk_syoscb::SYOSCB_HASH_COMPARE_VALIDATE_ALL, 116 pk_syoscb::SYOSCB_HASH_COMPARE_VALIDATE_MATCH: begin 117 cl_syoscb_item primary, secondary; 118 uvm_comparer comparer; 120 primary = primary_proxy.get_item(); 121 secondary = secondary_proxy.get_item(); 122 comparer = this.cfg.get_comparer(this.owner.get_name(), primary.get_producer()); 123 if(comparer == null) begin 124 comparer = this.cfg.get_default_comparer(); 126 if(primary.compare(secondary, comparer)) begin 129 string header, body, footer;
132 header = cl_syoscb_string_library::generate_cmp_table_header( 134 $sformatf("[%s] Seq. items with same hash did not have the same contents.\nHash=%x", 135 this.cfg.get_scb_name(), 136 primary_proxy_hash.digest 139 footer = cl_syoscb_string_library::generate_cmp_table_footer(table_width, comparer); 141 `uvm_error("MISCMP_HASH", {"\n", header, body, footer}) 147 `uvm_fatal(
"QUEUE_ERROR", $sformatf(
"[%s] Value of cfg.hash_compare_check (%s, %d) was not valid",
163 uvm_comparer comparer;
165 if(!$cast(owner_hash, this.
owner)) begin
166 `uvm_fatal(
"QUEUE_ERROR", $sformatf(
"[%s] Queue %s is not a hash queue. It must be to work with hash items", this.
cfg.
get_scb_name(), this.
owner.get_name()))
169 if(!$cast(primary_proxy_hash, primary_proxy)) begin
170 `uvm_fatal(
"ITEM_TYPE",
"Primary item was not a hash item")
174 pk_syoscb::SYOSCB_HASH_COMPARE_NO_VALIDATION,
175 pk_syoscb::SYOSCB_HASH_COMPARE_VALIDATE_MATCH: begin
178 pk_syoscb::SYOSCB_HASH_COMPARE_VALIDATE_ALL,
179 pk_syoscb::SYOSCB_HASH_COMPARE_VALIDATE_NO_MATCH: begin
186 if(comparer == null) begin
191 if(hash.first(sec_digest)) begin
193 int size_before = hash.get_size(sec_digest);
196 for(
int i=0; i<hash.get_size(sec_digest); i++) begin
198 secondary = hash.get_item(sec_digest, i);
200 if(primary.compare(secondary, comparer)) begin
205 header = cl_syoscb_string_library::generate_cmp_table_header( 208 "[%s] Seq. items with different hash but same contents were found\nPrimary: %x. Secondary: %x", 209 this.cfg.get_scb_name(), 210 primary_proxy_hash.digest, 214 `uvm_error("MISCMP_HASH", {"\n", header, body}) 217 end while (hash.next(sec_digest)); 221 t_hash_compare_check hcc = this.cfg.get_hash_compare_check(); 222 `uvm_fatal("QUEUE_ERROR", $sformatf("[%s] Value of cfg.hash_compare_check (%s, %d) was not valid", 223 this.cfg.get_scb_name(), 228 endfunction: validate_no_match 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 tp_aa_hash get_hash()
Gets the hash AA wrapper used for this queue.
virtual uvm_comparer get_comparer(string queue_name, string producer_name)
Configuration API: Returns the comparer associated with a given queue and producer.
The UVM scoreboard item which wraps uvm_sequence_item .
cl_syoscb_cfg cfg
Local handle to the SCB cfg.
virtual uvm_comparer get_default_comparer()
Configuration API: Get the value of the default_comparer member variable
cl_syoscb_item get_item(tp_digest digest, int unsigned idx=0)
Gets the scoreboard item at an index with a given hash value.
Base class for all proxy items.
Locator class for searching over generic hash queues.
Locator base class defining the locator API used for searching in queues.
virtual t_hash_compare_check get_hash_compare_check()
Configuration API: Get the value of the hash_compare_check member variable
virtual bit validate_match(cl_syoscb_proxy_item_base primary_proxy, cl_syoscb_proxy_item_base secondary_proxy)
Validates that a sequence item found in a secondary hash queue matches the sequence item being search...
cl_syoscb_queue_base owner
The queue owning this locator.
A wrapper around an associative array, used for storing hash queues.
virtual bit set_queue(cl_syoscb_queue_base owner)
Locator API: Sets the queue that this locator is associated with
static int generate_cmp_table_body(cl_syoscb_item items[], cl_syoscb_cfg cfg, output string result)
Generates the body of a comparison table.
Proxy item implementation for hash queues.
virtual string get_scb_name()
Configuration API: Get the name of the SCB that this cfg is related to
Class which represents the base concept of a hash queue.
virtual void validate_no_match(cl_syoscb_proxy_item_base primary_proxy)
Validates that no sequence item in this secondary hash queue matches the primary sequence item being ...