OpenCores
URL https://opencores.org/ocsvn/lpffir/lpffir/trunk

Subversion Repositories lpffir

[/] [lpffir/] [trunk/] [uvm/] [tools/] [uvm_syoscb/] [tb/] [cl_scbtest_env.svh] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 vladimirar
//----------------------------------------------------------------------
2
//   Copyright 2014-2015 SyoSil ApS
3
//   All Rights Reserved Worldwide
4
//
5
//   Licensed under the Apache License, Version 2.0 (the
6
//   "License"); you may not use this file except in
7
//   compliance with the License.  You may obtain a copy of
8
//   the License at
9
//
10
//       http://www.apache.org/licenses/LICENSE-2.0
11
//
12
//   Unless required by applicable law or agreed to in
13
//   writing, software distributed under the License is
14
//   distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
15
//   CONDITIONS OF ANY KIND, either express or implied.  See
16
//   the License for the specific language governing
17
//   permissions and limitations under the License.
18
//----------------------------------------------------------------------
19
class cl_scbtest_env extends uvm_env;
20
  //-------------------------------------
21
  // Non randomizable variables
22
  //-------------------------------------
23
  cl_syoscb     syoscb[];
24
  cl_syoscb_cfg syoscb_cfg[];
25
 
26
  //-------------------------------------
27
  // UVM Macros
28
  //-------------------------------------
29
  `uvm_component_utils_begin(cl_scbtest_env)
30
    `uvm_field_array_object(syoscb,     UVM_ALL_ON)
31
    `uvm_field_array_object(syoscb_cfg, UVM_ALL_ON)
32
  `uvm_component_utils_end
33
 
34
  //-------------------------------------
35
  // Constructor
36
  //-------------------------------------
37
  extern function new(string name, uvm_component parent);
38
 
39
  //-------------------------------------
40
  // UVM Phase methods
41
  //-------------------------------------
42
  extern virtual function void build_phase(uvm_phase phase);
43
  extern virtual function void connect_phase(uvm_phase phase);
44
endclass: cl_scbtest_env
45
 
46
function cl_scbtest_env::new(string name, uvm_component parent);
47
  super.new(name, parent);
48
endfunction: new
49
 
50
function void cl_scbtest_env::build_phase(uvm_phase phase);
51
  super.build_phase(phase);
52
 
53
  this.syoscb = new[2];
54
  this.syoscb_cfg = new[2];
55
 
56
  for(int unsigned i= 0; i<2; i++) begin
57
    this.syoscb_cfg[i] = cl_syoscb_cfg::type_id::create($sformatf("syoscb_cfg%0d", i));
58
 
59
    // Set queues Q1 and Q2
60
    this.syoscb_cfg[i].set_queues({"Q1", "Q2"});
61
 
62
    // Set the maximum queue size for Q1 to 100 elements
63
    this.syoscb_cfg[i].set_max_queue_size("Q1", 100);
64
 
65
    // Set the primary queue
66
    if(!this.syoscb_cfg[i].set_primary_queue("Q1")) begin
67
      `uvm_fatal("CFG_ERROR", "syoscb_cfg.set_primary_queue call failed!")
68
    end
69
 
70
    // Set producer "P1" for queues: "Q1" and "Q2"
71
    if(!this.syoscb_cfg[i].set_producer("P1", {"Q1", "Q2"})) begin
72
      `uvm_fatal("CFG_ERROR", "syoscb_cfg.set_producer call failed!")
73
    end
74
 
75
    // Set producer "P2" for queues: "Q1" and "Q2"
76
    if(!this.syoscb_cfg[i].set_producer("P2", {"Q1", "Q2"})) begin
77
         `uvm_fatal("CFG_ERROR", "syoscb_cfg.set_producer call failed!")
78
    end
79
 
80
    uvm_config_db #(cl_syoscb_cfg)::set(this, $sformatf("syoscb%0d", i), "cfg", this.syoscb_cfg[i]);
81
 
82
    this.syoscb[i] = cl_syoscb::type_id::create($sformatf("syoscb%0d", i), this);
83
    this.syoscb_cfg[i].set_scb_name($sformatf("syoscb%0d", i));
84
  end
85
endfunction: build_phase
86
 
87
function void cl_scbtest_env::connect_phase(uvm_phase phase);
88
  super.connect_phase(phase);
89
endfunction: connect_phase

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.