15 `uvm_field_int(
digest, UVM_DEFAULT)
19 function new(
string name =
"cl_syoscb_queue_iterator_hash");
27 extern virtual function bit
has_next();
30 extern virtual function bit
first();
31 extern virtual function bit
last();
43 void'($cast(qh,this.get_queue())); 48 if(this.has_next()) begin 61 if(hash.get_size(
this.digest) == 1) begin
68 for(
int i=0; i<hash.get_size(this.
digest); i++) begin
69 item2 = hash.get_item(
this.digest, i);
70 if(item1.compare(item2)) begin
81 if(hash.get_size(
this.digest)-1 == this.
hash_index && this.
position != qh.get_size()) begin
83 void'(hash.next(this.digest)); 89 return proxy_item_hash; 91 `uvm_error("ITER_ERROR", $sformatf("Cannot get next item for hash-queue %0s with %0d elements. Already pointing to last element", qh.get_name(), qh.get_size())) 97 function bit cl_syoscb_queue_iterator_hash::has_next();
98 cl_syoscb_queue_base qh = this.get_queue();
99 return this.position < qh.get_size();
100 endfunction: has_next
103 function cl_syoscb_proxy_item_base cl_syoscb_queue_iterator_hash::previous();
104 cl_syoscb_queue_hash#(HASH_DIGEST_WIDTH) qh;
105 cl_syoscb_hash_aa_wrapper#(HASH_DIGEST_WIDTH) hash;
110 `uvm_error(
"ITER_ERROR", $sformatf(
"Cannot get previous item for hash-queue %0s with %0d elements. Already pointing to first element", qh.get_name(), qh.get_size()))
114 hash = qh.get_hash();
123 key_queue = qh.get_key_queue();
126 if(hash.get_size(
this.digest) == 1) begin
132 item1 = key_queue[this.
position].item;
133 for(
int i=0; i<hash.get_size(this.
digest); i++) begin
134 item2 = hash.
get_item(
this.digest, i);
135 if(item1.compare(item2)) begin
143 void'(hash.prev(this.digest)); 144 this.hash_index = hash.get_size(this.digest)-1; 150 return this.get_item_proxy(); 151 endfunction: previous 154 function bit cl_syoscb_queue_iterator_hash::has_previous();
155 cl_syoscb_queue_base qh = this.get_queue();
156 return (this.position > 0);
157 endfunction: has_previous
160 function bit cl_syoscb_queue_iterator_hash::first();
161 cl_syoscb_queue_hash#(HASH_DIGEST_WIDTH) qh;
162 cl_syoscb_hash_aa_wrapper#(HASH_DIGEST_WIDTH) hash;
164 void'($cast(qh,this.
owner));
166 if(qh.get_size() == 0) begin
172 //when ordered_next == 0, we must also update the value of this.digest, as it is required for next/previous 173 //if ordered_next == 1, this is not necessary as it only depends on this.position when calling next/previous 174 if(!this.cfg.get_ordered_next()) begin 175 hash = qh.get_hash(); 176 void'(hash.first(
this.digest));
182 function bit cl_syoscb_queue_iterator_hash::last();
183 cl_syoscb_queue_hash#(HASH_DIGEST_WIDTH) qh;
184 cl_syoscb_hash_aa_wrapper#(HASH_DIGEST_WIDTH) hash;
186 void'($cast(qh,this.
owner));
187 if(qh.get_size() == 0) begin
191 this.position = qh.get_size(); 192 //Same reasons for only updating digest/hash_index when ordered_next == 0 as stated above in first() 193 if (!this.cfg.get_ordered_next()) begin 194 hash = qh.get_hash(); 195 void'(hash.last(
this.digest));
204 function bit cl_syoscb_queue_iterator_hash::set_queue(cl_syoscb_queue_base owner);
205 cl_syoscb_queue_hash#(HASH_DIGEST_WIDTH) qh;
207 if(owner == null) begin
208 // An iterator should always have an associated queue
209 `uvm_error("ITER_ERROR", "Unable to associate queue with iterator as argument was null")
211 end
else if(this.
owner != null) begin
213 `uvm_error(
"ITER_ERROR", $sformatf(
"Cannot reassign queue owner. Use create_iterator() to create an iterator for queue %s",
owner.get_name()))
215 end else if(!$cast(qh,
owner)) begin
216 `uvm_error("ITER_ERROR", $sformatf({
"Cannot assign queue %0s to iterator %0s, as the types do not match.\n",
217 "Expected a queue of type cl_syoscb_queue_hash#(%0d), got %0s"},
owner.get_name(), this.get_name(), HASH_DIGEST_WIDTH,
owner.get_type_name()))
236 void'($cast(qh, this.get_queue())); 239 if(this.cfg.get_ordered_next()) begin 240 cl_syoscb_queue_hash#(HASH_DIGEST_WIDTH)::tp_queue_of_keys key_queue = qh.get_key_queue(); 241 this.digest = key_queue[this.position].digest; 243 cl_syoscb_hash_aa_wrapper#(HASH_DIGEST_WIDTH) hash = qh.get_hash(); 244 void'(hash.first(this.
digest));
248 proxy_item_hash.digest = this.
digest;
250 proxy_item_hash.set_queue(this.owner);
252 return proxy_item_hash;
cl_syoscb_hash_base< HASH_DIGEST_WIDTH >::tp_hash_digest digest
Holds the value of the most recently accessed hash digest.
cl_syoscb_queue_base owner
The owner of this iterator.
virtual bit has_next()
Iterator API: See cl_syoscb_queue_iterator_base::has_next for details
virtual bit first()
Iterator API: See cl_syoscb_queue_iterator_base::first for details
The UVM scoreboard item which wraps uvm_sequence_item .
uvm_sequence_item item
Handle to the wrapped uvm_sequence_item.
virtual cl_syoscb_queue_base get_queue()
Iterator API: Internal API: Returns the queue over which this iterator is iterating.
virtual cl_syoscb_proxy_item_base previous()
Iterator API: See cl_syoscb_queue_iterator_base::previous for details
Base class for all proxy items.
virtual tp_queue_of_keys get_key_queue()
Get the list of hash values of items in the queue.
cl_syoscb_cfg cfg
Local handle to the SCB cfg.
int unsigned hash_index
Field indicating which cl_syoscb_hash_item index we're currently looking at.
Queue iterator base class defining the iterator API used for iterating over queues.
int unsigned position
Current position in the queue.
Class which represents the base concept of a queue.
virtual bit set_queue(cl_syoscb_queue_base owner)
Iterator API: See cl_syoscb_queue_iterator_base::set_queue for details
virtual bit get_ordered_next()
Configuration API: Get the value of the ordered_next member variable.
virtual cl_syoscb_proxy_item_base get_item_proxy()
Iterator API: See cl_syoscb_queue_iterator_base::get_item_proxy for details
virtual bit last()
Iterator API: See cl_syoscb_queue_iterator_base::last for details
virtual cl_syoscb_item get_item(cl_syoscb_proxy_item_base proxy_item)
Queue API: See cl_syoscb_queue_base::get_item for more details
Queue iterator class defining the iterator API used for iterating hash queues.
Class which defines the base concept of a hash algorithm.
A wrapper around an associative array, used for storing hash queues.
virtual cl_syoscb_proxy_item_base next()
Iterator API: See cl_syoscb_queue_iterator_base::next for details
Proxy item implementation for hash queues.
Class which represents the base concept of a hash queue.
virtual bit has_previous()
Iterator API: See cl_syoscb_queue_iterator_base::has_previous for details