SyoSil ApS UVM Scoreboard  1.0.3.0
cl_scb_test_io_std_tlm_gp_test.svh
1 /// IO comparison test to ensure that the SYOSIL TLM GP comparison workaround works as expected.
2 /// See cl_syoscb_item for a description as to why this workaround is necessary
3 class cl_scb_test_io_std_tlm_gp_test extends cl_scb_test_single_scb;
4  //-------------------------------------
5  // Non randomizable variables
6  //-------------------------------------
7 
8 
9  //-------------------------------------
10  // UVM Macros
11  //-------------------------------------
12  `uvm_component_utils_begin(cl_scb_test_io_std_tlm_gp_test)
13 
14  `uvm_component_utils_end
15 
16  //-------------------------------------
17  // Constructor
18  //-------------------------------------
19  function new(string name = "cl_scb_test_io_std_tlm_gp_test", uvm_component parent = null);
20  super.new(name, parent);
21  endfunction: new
22 
23  //-------------------------------------
24  // Functions
25  //-------------------------------------
26  extern virtual function void pre_build();
27  extern task run_phase(uvm_phase phase);
28  extern virtual function void check_phase(uvm_phase phase);
29 
31 
32 function void cl_scb_test_io_std_tlm_gp_test::pre_build();
33  super.pre_build();
34 
35  this.syoscb_cfgs.syoscb_cfg[0].set_max_print_orphans(-1);
36 
37  //If defined, an error should occur. Demoting that error and orphan error to make the test pass
38  `ifdef SYOSIL_APPLY_TLM_GP_CMP_WORKAROUND
39  uvm_root::get().set_report_severity_id_override(UVM_ERROR, "COMPARE_ERROR", UVM_INFO);
40  `endif //Otherwise, no error should pop up
41 
42 endfunction: pre_build
43 
44 task cl_scb_test_io_std_tlm_gp_test::run_phase(uvm_phase phase);
45  uvm_tlm_generic_payload gp1, gp2;
46 
47  phase.raise_objection(this);
48  super.run_phase(phase);
49 
50  //Very simple test of the GP workaround.
51  //Create two randomized GP items which do not match, prompting a miscompare
52  gp1 = uvm_tlm_generic_payload::type_id::create("gp1");
53  gp2 = uvm_tlm_generic_payload::type_id::create("gp2");
54 
55  //If we do not randomize with fixed lengths, the test stalls on both cadence and mentor...
56  //Reason is unknown
57  if(!gp1.randomize() with { this.m_length == 5; }) begin
58  `uvm_fatal("RAND", "Unable to randomize gp1");
59  end
60  if(!gp2.randomize() with { this.m_length == 6; }) begin
61  `uvm_fatal("RAND", "Unable to randomize gp2");
62  end
63 
64  scb_env.syoscb[0].add_item("Q1", "P1", gp1);
65  scb_env.syoscb[0].add_item("Q2", "P1", gp2);
66 
67  this.scb_env.syoscb[0].flush_queues_all(); //Flush queues to avoid re-comparing due to greed
68 
69  phase.drop_objection(this);
70 endtask: run_phase
71 
72 function void cl_scb_test_io_std_tlm_gp_test::check_phase(uvm_phase phase);
73  super.check_phase(phase);
74 
75  //If defined, we expect one COMPARE_ERROR to have popped up
76  `ifdef SYOSIL_APPLY_TLM_GP_CMP_WORKAROUND
77  begin
78  uvm_report_server rs = uvm_report_server::get_server();
79  int num_cmp_err = rs.get_id_count("COMPARE_ERROR");
80 
81  if(num_cmp_err != 1) begin
82  `uvm_error("TEST", $sformatf("Number of COMPARE_ERRORs was not 1 as expected. Got %0d COMPARE_ERROR instead", num_cmp_err))
83  end
84  end
85  `endif
86  //If not defined, no errors are expected
87 endfunction: check_phase
IO comparison test to ensure that the SYOSIL TLM GP comparison workaround works as expected...

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