SyoSil ApS UVM Scoreboard  1.0.3.0
cl_scb_test_cmp_base.svh
1 /// Base class for field macro/manual do_compare comparison tests.
2 /// These tests serve to make sure that a mix of field macros and manual do_compare implementations evaluate correctly.
3 /// Does this by using objects of type 'a', which has a handle to a type 'b' object, which has a handle to an endpoint object.
4 /// This allows us to chain field macros/do_compare/mixed implementations
5 /// \param ATYPE Type of the top-level objects to instantiate
6 /// \param suffix A suffix to add to the test name. The final testname will be "cl_scb_test_cmp_<io/ooo>_<suffix>"
7 class cl_scb_test_cmp_base#(type ATYPE = cl_tb_cmp_a_f_seq_item#(cl_tb_cmp_b_f_seq_item#(cl_tb_seq_item)),
8  string suffix = "") extends cl_scb_test_single_scb;
9  //-------------------------------------
10  // UVM Macros
11  //-------------------------------------
12  `uvm_object_param_utils(cl_scb_test_cmp_base#(ATYPE))
13 
14  //-------------------------------------
15  // Constructor
16  //-------------------------------------
17  extern function new(string name = "cl_scb_test_cmp_base", uvm_component parent = null);
18 
19  //-------------------------------------
20  // UVM Phase methods
21  //-------------------------------------
22  extern task run_phase(uvm_phase phase);
23  extern function void end_of_elaboration_phase(uvm_phase phase);
24  extern function void check_phase(uvm_phase phase);
25 
26  //-------------------------------------
27  // Typedefs
28  //-------------------------------------
29  typedef cl_tb_arr_wrapper#(ATYPE) stim_wrapper;
30 
31  //-------------------------------------
32  // Class methods
33  //-------------------------------------
34  extern virtual function void drive_stimuli(string queue, string producer, stim_wrapper stim);
35 endclass: cl_scb_test_cmp_base
36 
37 function cl_scb_test_cmp_base::new(string name = "cl_scb_test_cmp_base", uvm_component parent = null);
38  super.new(name, parent);
39 endfunction: new
40 
41 function void cl_scb_test_cmp_base::end_of_elaboration_phase(uvm_phase phase);
42  super.end_of_elaboration_phase(phase);
43  //Will print where comparisons go wrong if a miscompare happens
44  this.syoscb_cfgs.syoscb_cfg[0].set_default_enable_comparer_report(1'b1);
45 endfunction: end_of_elaboration_phase
46 
47 task cl_scb_test_cmp_base::run_phase(uvm_phase phase);
48  stim_wrapper stim1, stim2;
49  int sz;
50 
51  phase.raise_objection(this);
52  super.run_phase(phase);
53  //Demote COMPARE_ERROR as we expect to have exactly one of these
54  uvm_root::get().set_report_severity_id_override(UVM_ERROR, "COMPARE_ERROR", UVM_INFO);
55 
56  //Generate randomized stim - we will copy the data from these into the actual transactions (see drive_stimuli)
57  stim1 = stim_wrapper::type_id::create("stim1");
58  stim2 = stim_wrapper::type_id::create("stim2");
59  if(!stim1.randomize() with {stim1.items.size() > 10;}) begin
60  `uvm_fatal("RND", "Unable to randomize stimulus wrapper")
61  end
62 
63  //We want to ensure that errors are detected, so we make the last items in each stim packet a no-match
64  //Will be an error for IO-compare, will just be a no-match for OOO compare
65  stim2.copy(stim1);
66  sz = stim2.items.size();
67  stim2.items[sz-1].ival += 1;
68  stim2.items[sz-2].iobj.ival += 1;
69  stim2.items[sz-3].iobj.iobj.int_a += 1;
70  stim2.items[sz-4].iobj.iobjs[0].int_a += 1;
71  stim2.items[sz-5].iobjs[0].ival += 1;
72  stim2.items[sz-6].iobjs[0].iobj.int_a += 1;
73  stim2.items[sz-7].iobjs[0].iobjs[0].int_a += 1;
74 
75  fork
76  this.drive_stimuli("Q1", "P1", stim1);
77  this.drive_stimuli("Q2", "P1", stim2);
78  join
79 
80  this.scb_env.syoscb[0].flush_queues();
81 
82  phase.drop_objection(this);
83 endtask: run_phase
84 
85 function void cl_scb_test_cmp_base::check_phase(uvm_phase phase);
86  int num_flush;
87  super.check_phase(phase);
88 
89  num_flush = this.scb_env.syoscb[0].get_total_cnt_flushed_items();
90 
91  //We expect to have flushed a total of 14 items
92  if(num_flush != 14) begin
93  `uvm_error("TEST", $sformatf("Number of flushed items was not 14 as expected, flushed %0d items instead", num_flush))
94  end
95 endfunction: check_phase
96 
97 function void cl_scb_test_cmp_base::drive_stimuli(string queue, string producer, stim_wrapper stim);
98  foreach(stim.items[i]) begin
99  scb_env.syoscb[0].add_item(queue, producer, stim.items[i]);
100  end
101 endfunction
Base class for field macro/manual do_compare comparison tests.
A "b" type item which used a field macros instead of manually implementing do_compare.
An "a" type item which used a field macros instead of manually implementing do_compare.

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