23 function new(
string name =
"cl_syoscb_hash_aa_wrapper");
30 extern function int size();
35 extern function void delete(
tp_digest digest,
int unsigned idx = 0);
43 extern function void do_print(uvm_printer printer);
44 extern function bit do_compare(uvm_object rhs, uvm_comparer comparer);
54 return this.hash.size();
61 if(this.hash.exists(digest)) begin
71 if(!this.hash.exists(digest)) begin
73 hash_item = cl_syoscb_hash_item::type_id::create($sformatf(
"hash-item-%s",digest));
74 this.hash[digest] = hash_item;
83 if(this.hash.exists(digest)) begin
84 return this.hash[digest];
94 if(this.hash.exists(digest)) begin
95 return this.hash[digest].
get_item(idx);
106 if(this.hash[digest].
get_size() == 0) begin
107 this.hash.delete(digest);
120 return this.hash.exists(digest);
129 return this.hash.first(digest);
138 return this.hash.last(digest);
147 return this.hash.next(digest);
156 return this.hash.prev(digest);
161 function void cl_syoscb_hash_aa_wrapper::do_print(uvm_printer printer);
165 if(this.hash.first(digest)) begin
166 printer.print_generic(
"hash",
"-",
this.hash.size(),
"-");
168 printer.print_object(.name($sformatf(
"hash[%0d]", idx)), .value(this.hash[digest]));
170 end
while(this.hash.next(digest));
172 endfunction: do_print
175 function bit cl_syoscb_hash_aa_wrapper::do_compare(uvm_object rhs, uvm_comparer comparer);
179 bit compare_result = super.do_compare(rhs, comparer);
181 if(!$cast(rhs_aa, rhs)) begin
182 `uvm_fatal(
"TYPECAST", $sformatf(
"Unable to cast RHS to cl_syoscb_hash_aa_wrapper#(%0d), it is %0s", this.HASH_DIGEST_WIDTH, rhs.get_type_name()))
189 compare_result &= comparer.compare_object(
196 endfunction: do_compare
int get_size(tp_digest digest)
Return the size of a hash item in the wrapped assoc array.
bit exists(tp_digest digest)
Checks if an entry exists with the given hash value.
The UVM scoreboard item which wraps uvm_sequence_item .
int size()
Returns the size (number of entries) in the wrapped assoc array.
bit next(ref tp_digest digest)
Retrieves the hash of the next item in the wrapped AA The first item is not necessarily the next item...
void insert(tp_digest digest, cl_syoscb_item item)
Inserts an item into the wrapped assoc array.
cl_syoscb_item get_item(tp_digest digest, int unsigned idx=0)
Gets the scoreboard item at an index with a given hash value.
void delete_all()
Deletes all items in the assoc array.
virtual void add_item(cl_syoscb_item item)
Item API: Adds an item to this hash item
cl_syoscb_hash_item get_hash_item(tp_digest digest)
Gets a hash item in the wrapped assoc array.
cl_syoscb_hash_item hash[tp_digest]
Queue implemented as assoc array.
bit first(ref tp_digest digest)
Retrieves the hash of the first item in the wrapped AA The first item is not necessarily the item fir...
bit prev(ref tp_digest digest)
Retrieves the hash of the previous item in the wrapped AA The previous item is not necessarily the pr...
virtual void delete_item(int unsigned idx=0)
Item API: Deletes an item from this hash item
Class which defines the base concept of a hash algorithm.
A wrapper around an associative array, used for storing hash queues.
void delete(tp_digest digest, int unsigned idx=0)
Deletes a sequence item with a given hash value.
bit last(ref tp_digest digest)
Retrieves the hash of the last item in the wrapped AA The last item is not necessarily the item last ...
A utility class used to wrap cl_syoscb_item objects when when using hash queues.
cl_syoscb_hash_base< HASH_DIGEST_WIDTH >::tp_hash_digest tp_digest
Typedef for hash algorithm digests.