11 `uvm_component_utils_begin(cl_scb_test_io_std_insert_item)
13 `uvm_component_utils_end
18 function new(string name = "cl_scb_test_io_std_insert_item", uvm_component parent = null);
19 super.new(name, parent);
25 extern task main_phase(uvm_phase phase);
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;
35 phase.raise_objection(this);
36 super.main_phase(phase);
39 for(int i=0; i<10; i++) begin
40 cl_tb_seq_item ctsi = cl_tb_seq_item::type_id::create("ctsi");
42 this.scb_env.syoscb[0].add_item("Q1", "P1", ctsi);
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");
52 ctsi_9001.int_a = 9001;
53 ctsi_neg42.int_a = -42;
55 if(!q.insert_item("P1", ctsi_100, 0)) begin
56 `uvm_fatal("ERR", "Unable to insert item at index 0")
59 if(!q.insert_item("P1", ctsi_9001, 5)) begin
60 `uvm_fatal("ERR", "Unable to insert item in the middle of queue")
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")
67 new_ordering = '{100, 0, 1, 2, 3, 9001, 4, 5, 6, 7, 8, 9, -42};
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")
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);
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")
87 phase.drop_objection(this);
IO test that validates the behavior of cl_syoscb_queue_base::insert_item.
Class which represents the base concept of a queue.