SyoSil ApS UVM Scoreboard  1.0.3.0
cl_scb_test_ooo_md5_validate.svh
1 /// Test to ensure that config knob cl_syoscb_cfg::hash_compare_check correctly controls MD5
2 /// validation behavior. Validation will verify whether items with the same hash match, or whether
3 /// no match found really is a no-match
4 class cl_scb_test_ooo_md5_validate extends cl_scb_test_single_scb;
5  //-------------------------------------
6  // Non randomizable variables
7  //-------------------------------------
8 
9 
10  //-------------------------------------
11  // UVM Macros
12  //-------------------------------------
13  `uvm_component_utils_begin(cl_scb_test_ooo_md5_validate)
14 
15  `uvm_component_utils_end
16 
17  //-------------------------------------
18  // Constructor
19  //-------------------------------------
20  function new(string name = "cl_scb_test_ooo_md5_validate", uvm_component parent = null);
21  super.new(name, parent);
22  endfunction: new
23 
24  //-------------------------------------
25  // Functions
26  //-------------------------------------
27  extern virtual function void pre_build();
28  extern task run_phase(uvm_phase phase);
29  extern virtual function void report_phase(uvm_phase phase);
30 
32 
33 function void cl_scb_test_ooo_md5_validate::pre_build();
34  super.pre_build();
35 
36  this.syoscb_cfgs.syoscb_cfg[0].set_hash_compare_check(pk_syoscb::SYOSCB_HASH_COMPARE_VALIDATE_ALL);
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_trigger_greediness(pk_syoscb::SYOSCB_COMPARE_GREEDY); //Greedy compare to get all proper comparisons
40 endfunction: pre_build
41 
42 task cl_scb_test_ooo_md5_validate::run_phase(uvm_phase phase);
43  uvm_root uvm_top;
44  phase.raise_objection(this);
45 
46  super.run_phase(phase);
47 
48  uvm_top = uvm_root::get();
49 
50  //Validate matches that are performed correctly
51  fork
52  for(int i=0; i<10; i++) begin
53  cl_tb_seq_item item = cl_tb_seq_item::type_id::create("item");
54  item.int_a = i;
55  scb_env.syoscb[0].add_item("Q1", "P1", item);
56  end
57 
58  for(int i=9; i>=0; i--) begin
59  cl_tb_seq_item item = cl_tb_seq_item::type_id::create("item");
60  item.int_a = i;
61  scb_env.syoscb[0].add_item("Q2", "P1", item);
62  end
63  join
64 
65  //Should raise error if digest is the same but contents are not the same
66  //We disable clone and insert matching items such that they get the same hash
67  //After insertion, change the data in one of the items
68  //The digest value should not change, but the contents should, promoting an error
69  //We demote that error since it is wanted
70  uvm_top.set_report_severity_id_override(UVM_ERROR, "MISCMP_HASH", UVM_INFO); //Demote the error that is triggered
71  this.syoscb_cfgs.syoscb_cfg[0].set_disable_clone(1'b1);
72  begin
73  cl_tb_seq_item item1, item2;
74  item1 = cl_tb_seq_item::type_id::create("item1");
75  item2 = cl_tb_seq_item::type_id::create("item2");
76 
77  item1.int_a = 42;
78  item2.int_a = 42;
79 
80  scb_env.syoscb[0].add_item("Q1", "P1", item1);
81  item1.int_a = 43;
82 
83  //Triggers comparison which should fail
84  scb_env.syoscb[0].add_item("Q2", "P1", item2);
85  end
86  //Flush queues to avoid orphan errors
87  this.scb_env.syoscb[0].flush_queues_all();
88 
89  //It should raise an error if a match is not found by digest, but contents are a match
90  //First, add 20 randomized items to secondary queue. This is to ensure that we correctly search the entire queue
91  fork
92  for(int i=0; i<20; i++) begin
93  cl_tb_seq_item item = cl_tb_seq_item::type_id::create("item");
94  if(!item.randomize()) begin
95  `uvm_fatal("RAND", "Unable to randomize seq item")
96  end
97  scb_env.syoscb[0].add_item("Q2", "P1", item);
98  end
99  join
100 
101  //Now, add items with different hashes that actually match
102  //Again, we do this by disabling clone and modifying an item after insertion
103  begin
104  cl_tb_seq_item item1, item2;
105  item1 = cl_tb_seq_item::type_id::create("item1");
106  item2 = cl_tb_seq_item::type_id::create("item2");
107 
108  item1.int_a = 42;
109  item2.int_a = 43;
110 
111  scb_env.syoscb[0].add_item("Q1", "P2", item1);
112  item1.int_a = 43;
113 
114  scb_env.syoscb[0].add_item("Q2", "P2", item2);
115  end
116 
117  //Flush queues to avoid orphans
118  this.scb_env.syoscb[0].flush_queues_all();
119 
120  uvm_top.set_report_severity_id_override(UVM_ERROR, "MISCMP_HASH", UVM_ERROR); //Reset to error level, no longer accepted
121  //Finally, insert two items which are entirely different, should not match
122  begin
123  cl_tb_seq_item item1, item2;
124  item1 = cl_tb_seq_item::type_id::create("item1");
125  item2 = cl_tb_seq_item::type_id::create("item2");
126 
127  if(!item1.randomize()) begin
128  `uvm_fatal("RAND", "Unable to randomize item1")
129  end
130 
131  if(!item2.randomize()) begin
132  `uvm_fatal("RAND", "Unable to randomize item1")
133  end
134 
135  scb_env.syoscb[0].add_item("Q1", "P2", item1);
136  scb_env.syoscb[0].add_item("Q2", "P2", item2);
137  end
138 
139  //Flush queues to avoid orphans
140  this.scb_env.syoscb[0].flush_queues_all();
141 
142  //Ensure that we received exactly two MISCMP_HASH reports
143  phase.drop_objection(this);
144 endtask: run_phase
145 
146 function void cl_scb_test_ooo_md5_validate::report_phase(uvm_phase phase);
147  uvm_report_server rs;
148  int cnt;
149 
150  super.report_phase(phase);
151 
152  //Verify that we actually got the two MISCMP_HASH that we wanted
153  rs = uvm_report_server::get_server();
154  cnt = rs.get_id_count("MISCMP_HASH");
155  if(rs.get_id_count("MISCMP_HASH") != 2) begin
156  `uvm_error("TEST", $sformatf("Did not get exactly two MISCMP_HASH messages as expected, got %0d", cnt));
157  end
158 endfunction: report_phase
Test to ensure that config knob cl_syoscb_cfg::hash_compare_check correctly controls MD5 validation b...

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