SyoSil ApS UVM Scoreboard  1.0.3.0
cl_scb_test_io_std_insert_item.svh
1 /// IO test that validates the behavior of cl_syoscb_queue_base#insert_item
2 class cl_scb_test_io_std_insert_item 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_io_std_insert_item)
12 
13  `uvm_component_utils_end
14 
15  //-------------------------------------
16  // Constructor
17  //-------------------------------------
18  function new(string name = "cl_scb_test_io_std_insert_item", uvm_component parent = null);
19  super.new(name, parent);
20  endfunction: new
21 
22  //-------------------------------------
23  // Functions
24  //-------------------------------------
25  extern task main_phase(uvm_phase phase);
26 
27 
29 
30 task cl_scb_test_io_std_insert_item::main_phase(uvm_phase phase);
31  cl_tb_seq_item ctsi_100, ctsi_9001, ctsi_neg42;
33  int new_ordering[];
34 
35  phase.raise_objection(this);
36  super.main_phase(phase);
37 
38  //Add some items to Q1
39  for(int i=0; i<10; i++) begin
40  cl_tb_seq_item ctsi = cl_tb_seq_item::type_id::create("ctsi");
41  ctsi.int_a = i;
42  this.scb_env.syoscb[0].add_item("Q1", "P1", ctsi);
43  end
44 
45  //Insert some items - we expect the order to get changed up
46  q = this.syoscb_cfgs.syoscb_cfg[0].get_queue("Q1");
47  ctsi_100 = cl_tb_seq_item::type_id::create("ctsi_100");
48  ctsi_9001 = cl_tb_seq_item::type_id::create("ctsi_9001");
49  ctsi_neg42 = cl_tb_seq_item::type_id::create("ctsi_neg42");
50 
51  ctsi_100.int_a = 100;
52  ctsi_9001.int_a = 9001;
53  ctsi_neg42.int_a = -42;
54 
55  if(!q.insert_item("P1", ctsi_100, 0)) begin
56  `uvm_fatal("ERR", "Unable to insert item at index 0")
57  end
58 
59  if(!q.insert_item("P1", ctsi_9001, 5)) begin
60  `uvm_fatal("ERR", "Unable to insert item in the middle of queue")
61  end
62 
63  if(!q.insert_item("P1", ctsi_neg42, q.get_size())) begin
64  `uvm_fatal("ERR", "Unable to insert item at the end of queue")
65  end
66  //Order should now be as follows
67  new_ordering = '{100, 0, 1, 2, 3, 9001, 4, 5, 6, 7, 8, 9, -42};
68 
69  //Check that it disallows indices that are too large
70  if(q.insert_item("P1", ctsi_neg42, q.get_size()+1)) begin
71  `uvm_fatal("ERR", "Was able to insert item past end of queue, should not be allowed")
72  end
73 
74  //Add items to get matches
75  foreach(new_ordering[i]) begin
76  cl_tb_seq_item ctsi = cl_tb_seq_item::type_id::create("ctsi");
77  ctsi.int_a = new_ordering[i];
78  this.scb_env.syoscb[0].add_item("Q2", "P1", ctsi);
79  end
80 
81  //Verify that both queues have the same number of insertions
82  if(this.syoscb_cfgs.syoscb_cfg[0].get_queue("Q1").get_cnt_add_item() !=
83  this.syoscb_cfgs.syoscb_cfg[0].get_queue("Q2").get_cnt_add_item()) begin
84  `uvm_fatal("ERR", "Number of items added to Q1 and Q2 is not the same")
85  end
86 
87  phase.drop_objection(this);
88 endtask: main_phase
IO test that validates the behavior of cl_syoscb_queue_base::insert_item.
Class which represents the base concept of a queue.

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