SyoSil ApS UVM Scoreboard  1.0.3.0
cl_scb_test_iop_std_simple.svh
1 // Simple IOP compare test using the function based API
2 
3 class cl_scb_test_iop_std_simple extends cl_scb_test_single_scb;
4  //-------------------------------------
5  // UVM Macros
6  //-------------------------------------
7  `uvm_component_utils(cl_scb_test_iop_std_simple)
8 
9  //-------------------------------------
10  // Constructor
11  //-------------------------------------
12  extern function new(string name = "cl_scb_test_iop_std_simple", uvm_component parent = null);
13  extern virtual function void pre_build();
14  //-------------------------------------
15  // UVM Phase methods
16  //-------------------------------------
17  extern task run_phase(uvm_phase phase);
18  extern function void extract_phase(uvm_phase phase);
19 
20 endclass : cl_scb_test_iop_std_simple
21 
22 function cl_scb_test_iop_std_simple::new(string name = "cl_scb_test_iop_std_simple",
23  uvm_component parent = null);
24  super.new(name, parent);
25 endfunction : new
26 
27 function void cl_scb_test_iop_std_simple::pre_build();
28  super.pre_build();
29 
30  this.syoscb_cfgs.syoscb_cfg[0].set_compare_type(pk_syoscb::SYOSCB_COMPARE_IOP);
31  this.syoscb_cfgs.syoscb_cfg[0].set_print_cfg(1'b1);
32 endfunction : pre_build
33 
34 task cl_scb_test_iop_std_simple::run_phase(uvm_phase phase);
35  phase.raise_objection(this);
36 
37  super.run_phase(phase);
38  //First comparisons: Ensure that comparisons are in-order by producer
39  fork
40  //Insert 20 items into Q1
41  for(int unsigned i=0; i<10; i++) begin
42  cl_tb_seq_item item1;
43  item1 = cl_tb_seq_item::type_id::create("item1");
44  item1.int_a = i;
45  scb_env.syoscb[0].add_item("Q1", "P1", item1);
46  end
47 
48  for(int unsigned i=0; i<10; i++) begin
49  cl_tb_seq_item item1;
50  item1 = cl_tb_seq_item::type_id::create("item1");
51  item1.int_a = i;
52  scb_env.syoscb[0].add_item("Q1", "P2", item1);
53  end
54 
55  //Insert same 20 items into Q2 in opposite producer order
56  for(int unsigned i=0; i<10; i++) begin
57  cl_tb_seq_item item1;
58  item1 = cl_tb_seq_item::type_id::create("item1");
59  item1.int_a = i;
60  scb_env.syoscb[0].add_item("Q2", "P2", item1);
61  end
62 
63  for(int unsigned i=0; i<10; i++) begin
64  cl_tb_seq_item item1;
65  item1 = cl_tb_seq_item::type_id::create("item1");
66  item1.int_a = i;
67  scb_env.syoscb[0].add_item("Q2", "P1", item1);
68  end
69  join
70 
71  //At this point, those items should have matched no matter which queue is primary queue
72  begin
73  int cnt = this.scb_env.syoscb[0].get_total_queue_size();
74  if(cnt != 0) begin
75  `uvm_error("ERR", $sformatf("Did not have 0 items remaining after initial matches, had %0d", cnt))
76  end
77  end
78 
79  //Ensure that we really are comparing items in-order
80  //Demote errors of type COMPARE_ERROR, as this should fail
81  uvm_root::get().set_report_severity_id_override(UVM_ERROR, "COMPARE_ERROR", UVM_INFO);
82  //Add items with int_a=0, int_a=1 to Q1 (in that order)
83  for(int i=0; i<2; i++) begin
84  cl_tb_seq_item item1;
85  item1 = cl_tb_seq_item::type_id::create("item1");
86  item1.int_a = i;
87  scb_env.syoscb[0].add_item("Q1", "P1", item1);
88  end
89 
90 
91  //Add items with int_a=1, int_a=0 to Q2 (in that order)
92  for(int i=1; i>=0; i--) begin
93  cl_tb_seq_item item1;
94  item1 = cl_tb_seq_item::type_id::create("item1");
95  item1.int_a = i;
96  scb_env.syoscb[0].add_item("Q2", "P1", item1);
97  end
98 
99  phase.drop_objection(this);
100 endtask: run_phase
101 
102 function void cl_scb_test_iop_std_simple::extract_phase(uvm_phase phase);
103  int cnt;
104  super.extract_phase(phase);
105 
106  //After inserting 40 items that match, the 4 items inserted at the end
107  //should provoke 2 miscompares in run_phase (on both insertions into Q2),
108  //as well as a third miscompare in extract_phase
109  if(uvm_report_server::get_server().get_id_count("COMPARE_ERROR") != 3) begin
110  `uvm_error("ERR", $sformatf("Did not provoke 3x compare error, iop comparisons are broken. Got %0d errors", cnt))
111  end else begin
112  //If the errors did show up, we can happily flush queues
113  this.scb_env.syoscb[0].flush_queues_all();
114  end
115 
116 endfunction: extract_phase

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