SyoSil ApS UVM Scoreboard  1.0.3.0
cl_scb_test_ooo_std_trigger_greed.svh
1 /// OOO Compare test for validating that OOO compares respect the current greed level
2 class cl_scb_test_ooo_std_trigger_greed extends cl_scb_test_single_scb;
3  //-------------------------------------
4  // Non randomizable variables
5  //-------------------------------------
6 
7 
8  //-------------------------------------
9  // UVM Macros
10  //-------------------------------------
11  `uvm_component_utils_begin(cl_scb_test_ooo_std_trigger_greed)
12 
13  `uvm_component_utils_end
14 
15  //-------------------------------------
16  // Constructor
17  //-------------------------------------
18  function new(string name = "cl_scb_test_ooo_std_trigger_greed", uvm_component parent = null);
19  super.new(name, parent);
20  endfunction: new
21 
22  //-------------------------------------
23  // Functions
24  //-------------------------------------
25  extern function void pre_build();
26  extern function void add_19();
27  extern task main_phase(uvm_phase phase);
28  extern function void report_phase(uvm_phase phase);
29 
30 
32 
33 function void cl_scb_test_ooo_std_trigger_greed::pre_build();
34  super.pre_build();
35 
36  this.syoscb_cfgs.syoscb_cfg[0].set_compare_type(pk_syoscb::SYOSCB_COMPARE_OOO);
37  //Set end greed off to ensure that remaining items are handled as errors
38  this.syoscb_cfgs.syoscb_cfg[0].set_end_greediness(pk_syoscb::SYOSCB_COMPARE_NOT_GREEDY);
39  this.syoscb_cfgs.syoscb_cfg[0].set_max_print_orphans(-1);
40 
41 endfunction: pre_build
42 
43 //Disables comparisons, adds 19 items to the SCB, re-enables comparisons prepping it for us to add the final item
44 function void cl_scb_test_ooo_std_trigger_greed::add_19();
45  //Disable comparison to allow us to have multiple matches in queues
46  this.scb_env.syoscb[0].compare_control(1'b0);
47  for(int i=0; i<10; i++) begin
48  cl_tb_seq_item ctsi = cl_tb_seq_item::type_id::create("ctsi");
49  ctsi.int_a = i;
50  this.scb_env.syoscb[0].add_item("Q1", "P1", ctsi);
51  end
52 
53  //Add 9 items that also match
54  for(int i=8; i>=0; i--) begin
55  cl_tb_seq_item ctsi = cl_tb_seq_item::type_id::create("ctsi");
56  ctsi.int_a = i;
57  this.scb_env.syoscb[0].add_item("Q2", "P1", ctsi);
58  end
59 
60  if(this.scb_env.syoscb[0].get_total_queue_size() != 19) begin
61  `uvm_fatal("TEST", $sformatf("Did not have 19 items total in queues, have %0d", this.scb_env.syoscb[0].get_total_queue_size()))
62  end
63 
64  //Re-enable comparison, add the final item
65  this.scb_env.syoscb[0].compare_control(1'b1);
66 endfunction: add_19
67 
68 task cl_scb_test_ooo_std_trigger_greed::main_phase(uvm_phase phase);
69  phase.raise_objection(this);
70  super.main_phase(phase);
71 
72  //Demote QUEUE_ERROR message to make the test pass
73  this.scb_env.syoscb[0].set_report_severity_id_override(UVM_ERROR, "QUEUE_ERROR", UVM_INFO);
74 
75  //First: Check that trigger greed = GREEDY correctly drains all matches
76  this.syoscb_cfgs.syoscb_cfg[0].set_trigger_greediness(pk_syoscb::SYOSCB_COMPARE_GREEDY);
77  this.add_19();
78 
79  //Add final item
80  begin
81  cl_tb_seq_item ctsi = cl_tb_seq_item::type_id::create("ctsi");
82  ctsi.int_a = 9;
83  this.scb_env.syoscb[0].add_item("Q2", "P1", ctsi);
84  end
85 
86  //Should have 0 items due to greed levels
87  if(this.scb_env.syoscb[0].get_total_queue_size() != 0) begin
88  `uvm_error("TEST", $sformatf("After GREEDY, SCB now has %0d items", this.scb_env.syoscb[0].get_total_queue_size()))
89  end
90 
91 
92  //Second, that that trigger greed = NOT GREEDY does not drain all matches
93  this.syoscb_cfgs.syoscb_cfg[0].set_trigger_greediness(pk_syoscb::SYOSCB_COMPARE_NOT_GREEDY);
94  this.add_19();
95 
96  //Add final item
97  begin
98  cl_tb_seq_item ctsi = cl_tb_seq_item::type_id::create("ctsi");
99  ctsi.int_a = 9;
100  this.scb_env.syoscb[0].add_item("Q2", "P1", ctsi);
101  end
102  //Should have 18 items now
103  if(this.scb_env.syoscb[0].get_total_queue_size() != 18) begin
104  `uvm_warning("TEST", $sformatf("After NOT_GREEDY, SCB now has %0d items", this.scb_env.syoscb[0].get_total_queue_size()))
105  end
106 
107  phase.drop_objection(this);
108 endtask: main_phase
109 
110 function void cl_scb_test_ooo_std_trigger_greed::report_phase(uvm_phase phase);
111  int queue_size, id_count;
112  super.report_phase(phase);
113 
114  queue_size = this.scb_env.syoscb[0].get_total_queue_size();
115  id_count = uvm_report_server::get_server().get_id_count("QUEUE_ERROR");
116 
117  //Ensure that a total of 18 orphans still exists, and that a QUEUE_ERROR message was generated
118  if(queue_size != 18) begin
119  `uvm_error("TEST", $sformatf("There were not 18 orphans total as expected, have %0d", queue_size))
120  end else if(id_count != 1) begin
121  `uvm_error("TEST", $sformatf("Did not generate a QUEUE_ERROR message. count=%0d", id_count))
122  end else begin
123  `uvm_info("TEST", "All good", UVM_LOW)
124  end
125 endfunction: report_phase
OOO Compare test for validating that OOO compares respect the current greed level.

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