SyoSil ApS UVM Scoreboard  1.0.3.0
cl_scb_test_io_std_comparer_printer.svh
1 /// Tests uvm_comparer and uvm_printer related features.
2 class cl_scb_test_io_std_comparer_printer extends cl_scb_test_single_scb;
3  //-------------------------------------
4  // UVM Macros
5  //-------------------------------------
6  `uvm_component_utils(cl_scb_test_io_std_comparer_printer)
7 
8  //-------------------------------------
9  // Constructor
10  //-------------------------------------
11  extern function new(string name = "cl_scb_test_io_std_comparer_printer",
12  uvm_component parent = null);
13  //-------------------------------------
14  // UVM Phase methods
15  //-------------------------------------
16  extern task run_phase(uvm_phase phase);
18 
19 function cl_scb_test_io_std_comparer_printer::new(string name = "cl_scb_test_io_std_comparer_printer",
20  uvm_component parent = null);
21  super.new(name, parent);
22 endfunction : new
23 
24 task cl_scb_test_io_std_comparer_printer::run_phase(uvm_phase phase);
25  cl_tb_seq_item item1;
26  cl_tb_seq_item item2;
27  uvm_comparer comparer;
28  uvm_root uvm_top;
29 
30  phase.raise_objection(this);
31 
32  // Demote errors as this test is used for testing compare errors
33  uvm_top = uvm_root::get();
34  uvm_top.set_report_severity_id_override(UVM_ERROR, "COMPARE_ERROR", UVM_INFO);
35 
36  super.run_phase(phase);
37 
38  this.scb_env.syoscb_cfgs.syoscb_cfg[0].set_default_printer_verbosity(1'b1); //Print all array items
39  this.scb_env.syoscb_cfgs.syoscb_cfg[0].set_default_enable_comparer_report(1'b1);
40  comparer = this.scb_env.syoscb_cfgs.syoscb_cfg[0].get_default_comparer();
42  this.scb_env.syoscb_cfgs.syoscb_cfg[0].set_default_comparer(comparer);
43 
44  //Create two random seq. items
45  item1 = cl_tb_seq_item::type_id::create("item1");
46  item1.use_data = 1'b1;
47  item1.min_data_size = 10;
48  item1.max_data_size = 10;
49 
50  if(!item1.randomize()) begin
51  `uvm_fatal("TEST_ERROR", "Unable to randomize")
52  end
53 
54  this.scb_env.syoscb[0].add_item("Q1", "P1", item1);
55 
56  item2 = cl_tb_seq_item::type_id::create("item2");
57  item2.use_data = 1'b1;
58  item2.min_data_size = 10;
59  item2.max_data_size = 10;
60 
61  if(!item2.randomize()) begin
62  `uvm_fatal("TEST_ERROR", "Unable to randomize")
63  end
64 
65  this.scb_env.syoscb[0].add_item("Q2", "P1", item2);
66 
67  this.scb_env.syoscb[0].flush_queues();
68 
69  //Create two items where only dynamic array entries are different
70  if(!item1.randomize() with {int_a == 2;}) begin
71  `uvm_fatal("TEST_ERROR", "Unable to randomize")
72  end
73 
74  this.scb_env.syoscb[0].add_item("Q1", "P1", item1);
75 
76  if(!item2.randomize() with {int_a == 2;}) begin
77  `uvm_fatal("TEST_ERROR", "Unable to randomize")
78  end
79 
80  this.scb_env.syoscb[0].add_item("Q2", "P1", item2);
81 
82  this.scb_env.syoscb[0].flush_queues();
83 
84  //Create two items where only dynamic_array[50] differs
85  item1.min_data_size = 100;
86  item1.max_data_size = 100;
87 
88  if(!item1.randomize() with {int_a == 2;}) begin
89  `uvm_fatal("TEST_ERROR", "Unable to randomize")
90  end
91 
92  this.scb_env.syoscb[0].add_item("Q1", "P1", item1);
93 
94  $cast(item2, item1.clone());
95  item2.data[50] = item1.data[50]+1;
96 
97  this.scb_env.syoscb[0].add_item("Q2", "P1", item2);
98 
99  this.scb_env.syoscb[0].flush_queues();
100 
101  phase.drop_objection(this);
102 endtask: run_phase
Tests uvm_comparer and uvm_printer related features.
static void set_show_max(uvm_comparer comparer, int unsigned sm)
Sets the value of the show_max knob in the given comparer.

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