SyoSil ApS UVM Scoreboard  1.0.3.0
All Classes Functions Variables Typedefs Pages
cl_scb_test_ooo_heavy_base.svh
1 class random_index;
2 
3  randc int int_a;
4 
5  function new ();
6  endfunction: new
7 
8 endclass: random_index
9 
10 /// Heavy OOO compare test using the function based API
11 class cl_scb_test_ooo_heavy_base extends cl_scb_test_single_scb;
12 
13  typedef enum {Q1FULL,Q1COMPLEX} t_scenario;
14  typedef enum {SMALL,LARGE} t_size;
15 
16  int N;
17  t_scenario scenario;
18  t_size item_size;
19 
20  //-------------------------------------
21  // UVM Macros
22  //-------------------------------------
23  `uvm_component_utils(cl_scb_test_ooo_heavy_base)
24 
25  //-------------------------------------
26  // Constructor
27  //-------------------------------------
28  extern function new(string name = "cl_scb_test_ooo_heavy_base", uvm_component parent = null);
29 
30  //-------------------------------------
31  // UVM Phase methods
32  //-------------------------------------
33  extern virtual function void pre_build();
34  extern function void build_phase(uvm_phase phase);
35  extern task run_phase(uvm_phase phase);
36 
37  extern function void do_q1full();
38 
40 
41 function cl_scb_test_ooo_heavy_base::new(string name = "cl_scb_test_ooo_heavy_base",
42  uvm_component parent = null);
43  super.new(name, parent);
44 endfunction : new
45 
46 function void cl_scb_test_ooo_heavy_base::pre_build();
47  super.pre_build();
48 
49  this.syoscb_cfgs.syoscb_cfg[0].set_compare_type(pk_syoscb::SYOSCB_COMPARE_OOO);
50 endfunction: pre_build
51 
52 function void cl_scb_test_ooo_heavy_base::build_phase(uvm_phase phase);
53  int size;
54  int sc;
55 
56  this.pre_build();
57  super.build_phase(phase);
58  void'(uvm_config_db#(uvm_bitstream_t)::get(this,"","events",this.N));
59  void'(uvm_config_db#(uvm_bitstream_t)::get(this,"","size",size));
60  void'(uvm_config_db#(uvm_bitstream_t)::get(this,"","sc",sc));
61  this.item_size = t_size'(size);
62  this.scenario = t_scenario'(sc);
63 endfunction: build_phase
64 
65 task cl_scb_test_ooo_heavy_base::run_phase(uvm_phase phase);
66  phase.raise_objection(this);
67 
68  super.run_phase(phase);
69 
70  case (this.scenario)
71  Q1FULL: begin
72  this.do_q1full();
73  end
74  default: begin
75  `uvm_fatal("SCENARIO_ERROR", $sformatf("Unknown scenario:%s",this.scenario.name()));
76  end
77  endcase
78 
79  phase.drop_objection(this);
80 endtask: run_phase
81 
82 function void cl_scb_test_ooo_heavy_base::do_q1full();
83  cl_tb_seq_item items[];
84  int idxs[];
85  cl_tb_seq_item cur_item;
86  random_index idx_q2;
87 
88  idxs = new[this.N];
89  items = new[this.N];
90 
91  cur_item = cl_tb_seq_item::type_id::create("cur_item");
92 
93  if (item_size == SMALL) begin
94  cur_item.use_data = 0;
95  end else begin
96  cur_item.use_data = 1;
97  end
98 
99  for(int i=0; i<this.N; i++) begin
100  cl_tb_seq_item item_clone;
101 
102  if(!cur_item.randomize()) begin
103  `uvm_fatal("QUEUE_ERROR", $sformatf("Randomization fail for item %d",i));
104  end
105 
106  if (i%1000==0) begin
107  `uvm_info("Inserts", $sformatf("%d: ", i), UVM_NONE);
108  end
109 
110  if(!$cast(item_clone, cur_item.clone())) begin
111  `uvm_fatal("QUEUE_ERROR", $sformatf("[%d]: Unable to cast cloned item to uvm_sequence_item",i));
112  end
113 
114  scb_env.syoscb[0].add_item("Q1", "P1", cur_item);
115  items[i]=item_clone;
116 
117  end
118 
119  idx_q2 = new();
120 
121  for(int i=0; i<this.N ; i++) begin
122 
123  if(!idx_q2.randomize() with {int_a>=0;
124  int_a<local::this.N;}) begin
125  `uvm_fatal("QUEUE_ERROR", $sformatf("Randomization fail for index of item %d",i));
126  end
127 
128  scb_env.syoscb[0].add_item("Q2", "P1", items[idx_q2.int_a]);
129 
130  if (i%1000==0) begin
131  `uvm_info("Compares",$sformatf("%d: ", i), UVM_NONE);
132  end
133  end
134 
135 endfunction : do_q1full
Heavy OOO compare test using the function based API.

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