SyoSil ApS UVM Scoreboard  1.0.3.0
cl_scb_test_io_std_sbs_print.svh
1 typedef class small_seq_item;
2 typedef class large_seq_item;
3 
4 /// Shows a number of different ways that the side-by-side miscompare table can be used
5 class cl_scb_test_io_std_sbs_print extends cl_scb_test_single_scb;
6  //-------------------------------------
7  // Non randomizable variables
8  //-------------------------------------
9 
10 
11  //-------------------------------------
12  // UVM Macros
13  //-------------------------------------
14  `uvm_component_utils_begin(cl_scb_test_io_std_sbs_print)
15 
16  `uvm_component_utils_end
17 
18  //-------------------------------------
19  // Constructor
20  //-------------------------------------
21  function new(string name = "cl_scb_test_io_std_sbs_print", uvm_component parent = null);
22  super.new(name, parent);
23  endfunction: new
24 
25  //-------------------------------------
26  // Functions
27  //-------------------------------------
28  extern task run_phase(uvm_phase phase);
29 
31 
32 class small_seq_item extends uvm_sequence_item;
33  rand int int_a;
34  rand int int_b;
35 
36  `uvm_object_utils_begin(small_seq_item)
37  `uvm_field_int(int_a, UVM_DEFAULT)
38  `uvm_field_int(int_b, UVM_DEFAULT)
39  `uvm_object_utils_end
40 
41  function new(string name = "small_seq_item");
42  super.new(name);
43  endfunction: new
44 
45 endclass: small_seq_item
46 
47 class large_seq_item extends uvm_sequence_item;
48  rand int int_a;
49  int int_b;
50  rand int int_arr[];
51 
52  constraint co_int_arr_size {int_arr.size() inside {[6:10]};}
53 
54  `uvm_object_utils_begin(large_seq_item)
55  `uvm_field_int(int_a, UVM_DEFAULT)
56  `uvm_field_int(int_b, UVM_DEFAULT)
57  `uvm_field_array_int(int_arr, UVM_DEFAULT)
58  `uvm_object_utils_end
59 
60  function new(string name = "large_seq_item");
61  super.new(name);
62  endfunction: new
63 
64 endclass: large_seq_item
65 
66 task cl_scb_test_io_std_sbs_print::run_phase(uvm_phase phase);
67  small_seq_item small1, small2, small3;
68  large_seq_item large1, large2;
69 
70  uvm_root uvm_top;
71  uvm_comparer comparer;
72 
73  phase.raise_objection(this);
74 
75  // Demote errors as this test is used for testing compare error prints
76  // and thus will trigger compare errors
77  uvm_top = uvm_root::get();
78  uvm_top.set_report_severity_id_override(UVM_ERROR, "COMPARE_ERROR", UVM_INFO);
79 
80  super.run_phase(phase);
81 
82  small1 = small_seq_item::type_id::create("small1");
83  small2 = small_seq_item::type_id::create("small2");
84  large1 = large_seq_item::type_id::create("large1");
85  large2 = large_seq_item::type_id::create("large2");
86 
87  comparer = this.scb_env.syoscb_cfgs.syoscb_cfg[0].get_default_comparer();
89  this.scb_env.syoscb_cfgs.syoscb_cfg[0].set_default_comparer(comparer);
90  this.scb_env.syoscb_cfgs.syoscb_cfg[0].set_default_enable_comparer_report(1'b1);
91 
92  if(!small1.randomize()) begin
93  `uvm_fatal("RND", "Unable to randomize small1");
94  end
95 
96  if(!small2.randomize()) begin
97  `uvm_fatal("RND", "Unable to randomize small2");
98  end
99 
100  if(!large1.randomize()) begin
101  `uvm_fatal("RND", "Unable to randomize large1");
102  end
103 
104  if(!large2.randomize() with {large2.int_arr.size() != large1.int_arr.size();}) begin
105  `uvm_fatal("RND", "Unable to randomize large2");
106  end
107 
108  $display("\n>>>Two items of the same type with different contents<<<");
109  fork
110  scb_env.syoscb[0].add_item("Q1", "P1", small1);
111  scb_env.syoscb[0].add_item("Q2", "P1", small2);
112  join
113  scb_env.syoscb[0].flush_queues_all();
114 
115  $display("\n>>>Two items of different types<<<");
116  fork
117  scb_env.syoscb[0].add_item("Q1", "P1", large1);
118  scb_env.syoscb[0].add_item("Q2", "P1", small1);
119  join
120  scb_env.syoscb[0].flush_queues_all();
121 
122  $display("\n>>>Two items of the same type, varying darray lengths<<<");
123  fork
124  scb_env.syoscb[0].add_item("Q1", "P1", large1);
125  scb_env.syoscb[0].add_item("Q2", "P1", large2);
126  join
127  scb_env.syoscb[0].flush_queues_all();
128 
129  $display("\n>>>Two items of the same type, same darray lengths<<<");
130  if(!large1.randomize()) begin
131  `uvm_fatal("RND", "Unable to randomize large1")
132  end
133 
134  if(!large2.randomize() with {large2.int_arr.size() == large1.int_arr.size();}) begin
135  `uvm_fatal("RND", "Unable to randomize large2")
136  end
137  fork
138  scb_env.syoscb[0].add_item("Q1", "P1", large1);
139  scb_env.syoscb[0].add_item("Q2", "P1", large2);
140  join
141  scb_env.syoscb[0].flush_queues_all();
142 
143 
144 
145 
146  phase.drop_objection(this);
147 endtask: run_phase
static void set_show_max(uvm_comparer comparer, int unsigned sm)
Sets the value of the show_max knob in the given comparer.
Shows a number of different ways that the side-by-side miscompare table can be used.

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