SyoSil ApS UVM Scoreboard  1.0.3.0
cl_scb_test_md5_hash_collisions.svh
1 /// Test to verify that comparisons still work correctly on hash items with multiple entries
2 /// where hash collisions may have occured
3 class cl_scb_test_md5_hash_collisions extends cl_scb_test_single_scb;
4  //-------------------------------------
5  // Non randomizable variables
6  //-------------------------------------
7 
8 
9  //-------------------------------------
10  // UVM Macros
11  //-------------------------------------
12  `uvm_component_utils_begin(cl_scb_test_md5_hash_collisions)
13 
14  `uvm_component_utils_end
15 
16  //-------------------------------------
17  // Constructor
18  //-------------------------------------
19  function new(string name = "cl_scb_test_md5_hash_collisions", uvm_component parent = null);
20  super.new(name, parent);
21  endfunction: new
22 
23  //-------------------------------------
24  // Functions
25  //-------------------------------------
26  extern function void pre_build();
27  extern task main_phase(uvm_phase phase);
28  extern function void hash_collision_test();
29 
30 
32 
33 function void cl_scb_test_md5_hash_collisions::pre_build();
34  super.pre_build();
35 
36  //We must test md5-comparisons and
37  this.syoscb_cfgs.syoscb_cfg[0].set_queue_type(pk_syoscb::SYOSCB_QUEUE_MD5);
38  this.syoscb_cfgs.syoscb_cfg[0].set_compare_type(pk_syoscb::SYOSCB_COMPARE_OOO);
39  this.syoscb_cfgs.syoscb_cfg[0].set_disable_clone(1'b1);
40 endfunction: pre_build
41 
42 function void cl_scb_test_md5_hash_collisions::hash_collision_test();
43  cl_tb_seq_item items[3];
44  cl_tb_seq_item remaining_item;
47 
48  //We generate 3 items of same contents to make sure they have same hash
49  foreach(items[i]) begin
50  items[i] = cl_tb_seq_item::type_id::create("item");
51  items[i].int_a = 5;
52  end
53 
54  this.scb_env.syoscb[0].add_item("Q1", "P1", items[0]);
55  this.scb_env.syoscb[0].add_item("Q1", "P1", items[1]);
56 
57  //After inserting those items, we modify items[0] to simulate a hash collision. items[0] should not match
58  //with items[2], but items[1] should. The only orphan should thus be the item with int_a = 6
59  items[0].int_a=6;
60  this.scb_env.syoscb[0].add_item("Q2", "P1", items[2]);
61 
62  q = this.syoscb_cfgs.syoscb_cfg[0].get_queue("Q1");
63  iter = q.create_iterator();
64  void'(iter.first());
65  //Get item proxy, cast down wrapped item
66  if(!$cast(remaining_item, iter.next().get_item().get_item())) begin
67  `uvm_fatal("CAST", "Unable to typecast seq item back to cl_tb_seq_item");
68  end
69  if(remaining_item.int_a != 6) begin
70  `uvm_error("MD5_HASH_COLL", $sformatf("int_a of remaining item was %0d, expected 6", remaining_item.int_a))
71  end else begin
72  this.scb_env.syoscb[0].flush_queues_all();
73  void'(q.delete_iterator(iter));
74  end
75 endfunction: hash_collision_test
76 
77 task cl_scb_test_md5_hash_collisions::main_phase(uvm_phase phase);
78  phase.raise_objection(this);
79  super.main_phase(phase);
80 
81  this.syoscb_cfgs.syoscb_cfg[0].set_ordered_next(1'b0);
82  this.hash_collision_test();
83  `uvm_info("MD5_HASH_COLL", "Hash collision comparisons passed for ordered_next=0", UVM_NONE)
84  this.syoscb_cfgs.syoscb_cfg[0].set_ordered_next(1'b1);
85  this.hash_collision_test();
86  `uvm_info("MD5_HASH_COLL", "Hash collision comparisons passed for ordered_next=1", UVM_NONE)
87 
88  phase.drop_objection(this);
89 endtask: main_phase
Test to verify that comparisons still work correctly on hash items with multiple entries where hash c...
Queue iterator base class defining the iterator API used for iterating over queues.
Class which represents the base concept of a queue.

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:37:49
Find a documentation bug? Report bugs to: scoreboard@syosil.com