SyoSil ApS UVM Scoreboard  1.0.3.0
All Classes Functions Variables Typedefs Pages
cl_scb_test_io_std_simple_mutexed.svh
1 /// Simple IO compare test using the function based API and mutexed add_item calls.
2 // Unable to provoke situations where the mutex is unreachable, since all simulators
3 // run threads to completion, as item insertion happens in 0 time.
4 // Mutex has been proven to work by inserting an artificial delay inside add_item_mutexed,
5 // but obviously this cannot be included in the source files.
6 class cl_scb_test_io_std_simple_mutexed extends cl_scb_test_single_scb;
7  //-------------------------------------
8  // UVM Macros
9  //-------------------------------------
10  `uvm_component_utils(cl_scb_test_io_std_simple_mutexed)
11 
12  //-------------------------------------
13  // Constructor
14  //-------------------------------------
15  extern function new(string name = "cl_scb_test_io_std_simple_mutexed", uvm_component parent = null);
16 
17  //-------------------------------------
18  // UVM Phase methods
19  //-------------------------------------
20  extern function void pre_build();
21  extern function void build_phase(uvm_phase phase);
22  extern task main_phase(uvm_phase phase);
23  extern task access_queue(string queue, string producer, int start);
25 
26 function cl_scb_test_io_std_simple_mutexed::new(string name = "cl_scb_test_io_std_simple_mutexed",
27  uvm_component parent = null);
28  super.new(name, parent);
29 endfunction : new
30 
31 function void cl_scb_test_io_std_simple_mutexed::pre_build();
32  super.pre_build();
33  this.syoscb_cfgs.syoscb_cfg[0].set_mutexed_add_item_enable(1'b1);
34 endfunction: pre_build
35 
36 function void cl_scb_test_io_std_simple_mutexed::build_phase(uvm_phase phase);
37  this.pre_build();
38  super.build_phase(phase);
39 endfunction: build_phase
40 
41 task cl_scb_test_io_std_simple_mutexed::main_phase(uvm_phase phase);
42  phase.raise_objection(this);
43 
44  super.main_phase(phase);
45 
46  fork
47  for(int i=0; i<100; i++) begin
48  this.access_queue("Q1", "P1", i*1000);
49  end
50 
51  for(int i=0; i<100; i++) begin
52  this.access_queue("Q2", "P1", i*1000);
53  end
54  join
55 
56  phase.drop_objection(this);
57 endtask: main_phase
58 
59 // Performs 100 acceses to queue/producer
60 // Sets the int_a field of the cl_tb_seq_item to start+i, where i<-[0:99]
61 task cl_scb_test_io_std_simple_mutexed::access_queue(string queue, string producer, int start);
62  cl_tb_seq_item item;
63  for(int i=0; i<100; i++) begin
64  int w;
65  void'(std::randomize(w) with {
66  w inside {0, 1000, 2000};
67  });
68 
69  item = cl_tb_seq_item::type_id::create("item");
70  item.int_a = i + start;
71  #w; //Wait for a random amount of time
72  this.scb_env.syoscb[0].add_item_mutexed(queue, producer, item);
73  end
74 endtask: access_queue
Simple IO compare test using the function based API and mutexed add_item calls.

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