11 `uvm_component_utils_begin(cl_scb_test_iterator_unit_tests_md5)
13 `uvm_component_utils_end
18 function new(string name = "cl_scb_test_iterator_unit_tests_md5", uvm_component parent = null);
19 super.new(name, parent);
25 extern function void pre_build();
26 extern task main_phase(uvm_phase phase);
27 extern function void check_hash_collision_iteration();
28 extern function void check_hash_collision_iteration_no_ordered_next();
33 function void cl_scb_test_iterator_unit_tests_md5::pre_build();
35 this.syoscb_cfgs.syoscb_cfg[0].set_queue_type(pk_syoscb::SYOSCB_QUEUE_MD5);
36 this.syoscb_cfgs.syoscb_cfg[0].set_ordered_next(1'b1);
37 endfunction: pre_build
40 function void cl_scb_test_iterator_unit_tests_md5::check_hash_collision_iteration_no_ordered_next();
43 cl_tb_seq_item items[4];
47 this.syoscb_cfgs.syoscb_cfg[0].set_disable_clone(1'b1);
48 this.syoscb_cfgs.syoscb_cfg[0].set_ordered_next(1'b0);
51 foreach(items[i]) begin
52 items[i] = cl_tb_seq_item::type_id::create("item");
58 foreach(items[i]) begin
59 this.scb_env.syoscb[0].add_item("Q1", "P1", items[i]);
68 iter = this.syoscb_cfgs.syoscb_cfg[0].get_queue("Q1").create_iterator();
72 cl_tb_seq_item found_item1, found_item2;
73 found_item1 = this.get_next(iter);
74 found_item2 = this.get_next(iter);
75 if(found_item2.int_a != found_item1.int_a+1) begin
76 `uvm_error("ITER_HASH_NEXT", $sformatf("ordered_next=0, first two items did not match. first.int_a=%0d, second.int_a=%0d", found_item1.int_a, found_item2.int_a))
81 cl_tb_seq_item found_item1, found_item2;
82 found_item1 = this.get_next(iter);
83 found_item2 = this.get_next(iter);
85 if(found_item2.int_a != found_item1.int_a+1) begin
86 `uvm_error("ITER_HASH_NEXT", $sformatf("ordered_next=0, last two items did not match. first.int_a=%0d, second.int_a=%0d", found_item1.int_a, found_item2.int_a))
96 cl_tb_seq_item found_item1, found_item2;
97 found_item1 = this.get_previous(iter);
98 found_item2 = this.get_previous(iter);
100 if(found_item1.int_a != found_item2.int_a+1) begin
101 `uvm_error("ITER_HASH_NEXT", $sformatf("ordered_next=0, last two items did not match. first.int_a=%0d, second.int_a=%0d", found_item1.int_a, found_item2.int_a))
105 cl_tb_seq_item found_item1, found_item2;
106 found_item1 = this.get_previous(iter);
107 found_item2 = this.get_previous(iter);
109 if(found_item1.int_a != found_item2.int_a+1) begin
110 `uvm_error("ITER_HASH_NEXT", $sformatf("ordered_next=0, last two items did not match. first.int_a=%0d, second.int_a=%0d", found_item1.int_a, found_item2.int_a))
115 void'(this.syoscb_cfgs.syoscb_cfg[0].get_queue("Q1").delete_iterator(iter));
116 `uvm_info("ITER_HASH_NEXT", "Iterator traversal with hash collisions and ordered_next=0 passed tests", UVM_LOW)
117 this.scb_env.syoscb[0].flush_queues_all();
119 this.syoscb_cfgs.syoscb_cfg[0].set_ordered_next(1'b1);
121 endfunction: check_hash_collision_iteration_no_ordered_next
124 function void cl_scb_test_iterator_unit_tests_md5::check_hash_collision_iteration();
125 cl_tb_seq_item items[4];
128 this.syoscb_cfgs.syoscb_cfg[0].set_disable_clone(1'b1);
131 foreach(items[i]) begin
132 items[i] = cl_tb_seq_item::type_id::create("item");
138 foreach(items[i]) begin
139 this.scb_env.syoscb[0].add_item("Q1", "P1", items[i]);
148 iter = this.syoscb_cfgs.syoscb_cfg[0].get_queue("Q1").create_iterator();
153 while(iter.has_next()) begin
154 cl_tb_seq_item found_item;
156 found_item = this.get_next(iter);
157 if(found_item.int_a != iter.previous_index()) begin
158 `uvm_error("ITER_HASH_NEXT", $sformatf("Item at index %0d did not have expected int_a value, got %0d", iter.previous_index(), found_item.int_a))
169 cl_tb_seq_item found_item;
171 found_item = this.get_previous(iter);
172 if(found_item.int_a != 3) begin
173 `uvm_error("ITER_HASH_NEXT", $sformatf("Item at index %0d did not have expected int_a value, got %0d", iter.next_index(), found_item.int_a))
178 while(iter.has_previous()) begin
179 cl_tb_seq_item found_item;
181 found_item = this.get_previous(iter);
182 if(found_item.int_a != iter.next_index()) begin
183 `uvm_error("ITER_HASH_NEXT", $sformatf("Item at index %0d did not have expected int_a value, got %0d", iter.next_index(), found_item.int_a))
188 void'(this.syoscb_cfgs.syoscb_cfg[0].get_queue("Q1").delete_iterator(iter));
189 `uvm_info("ITER_HASH_NEXT", "Iterator traversal with hash collisions and ordered_next=1 passed tests", UVM_LOW)
190 this.scb_env.syoscb[0].flush_queues_all();
192 endfunction: check_hash_collision_iteration
194 task cl_scb_test_iterator_unit_tests_md5::main_phase(uvm_phase phase);
195 phase.raise_objection(this);
196 super.main_phase(phase);
198 this.check_hash_collision_iteration();
199 this.check_hash_collision_iteration_no_ordered_next();
202 this.syoscb_cfgs.syoscb_cfg[0].set_ordered_next(1'b0);
203 for(int i=0; i<10; i++) begin
204 cl_tb_seq_item item = cl_tb_seq_item::type_id::create("item");
206 this.scb_env.syoscb[0].add_item("Q1", "P1", item);
209 this.scb_env.syoscb[0].flush_queues_all();
211 phase.drop_objection(this);
Test containing a series of unit tests to ensure that all iterators conform to spec.
Queue iterator base class defining the iterator API used for iterating over queues.
Test that md5-iterators using cl_syoscb_cfg::ordered_next conform to spec.