OpenCores
URL https://opencores.org/ocsvn/avalon-wishbone-bridge/avalon-wishbone-bridge/trunk

Subversion Repositories avalon-wishbone-bridge

[/] [avalon-wishbone-bridge/] [trunk/] [UVM/] [env_config.svh] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 sumanta.ch
//------------------------------------------------------------
2
//   Copyright 2010 Mentor Graphics Corporation
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
`ifndef env_config
20
`define env_config
21
 
22
//
23
// Class Description:
24
//
25
//
26
class env_config extends uvm_object;
27
 
28
localparam string s_my_config_id = "env_config";
29
localparam string s_no_config_id = "no config";
30
localparam string s_my_config_type_error_id = "config type error";
31
 
32
// UVM Factory Registration Macro
33
//
34
`uvm_object_utils(env_config)
35
 
36
//------------------------------------------
37
// Data Members
38
//------------------------------------------
39
wb_slave_agent_config slave_agent_cfg;
40
 
41
//------------------------------------------
42
// Methods
43
//------------------------------------------
44
extern static function env_config get_config( uvm_component c);
45
extern function new(string name = "env_config");
46
 
47
endclass: env_config
48
 
49
function env_config::new(string name = "env_config");
50
  super.new(name);
51
  slave_agent_cfg = wb_slave_agent_config::type_id::create("wb_slave_agent_config");
52
endfunction
53
 
54
//
55
// Function: get_config
56
//
57
// This method gets the my_config associated with component c. We check for
58
// the two kinds of error which may occur with this kind of
59
// operation.
60
//
61
function env_config env_config::get_config( uvm_component c );
62
  uvm_object o;
63
  env_config t;
64
 
65
  if( !c.get_config_object( s_my_config_id , o , 0 ) ) begin
66
    c.uvm_report_error( s_no_config_id ,
67
                        $sformatf("no config associated with %s" ,
68
                                  s_my_config_id ) ,
69
                        UVM_NONE , `uvm_file , `uvm_line  );
70
    return null;
71
  end
72
 
73
  if( !$cast( t , o ) ) begin
74
    c.uvm_report_error( s_my_config_type_error_id ,
75
                        $sformatf("config %s associated with config %s is not of type my_config" ,
76
                                   o.sprint() , s_my_config_id ) ,
77
                        UVM_NONE , `uvm_file , `uvm_line );
78
  end
79
 
80
  return t;
81
endfunction
82
 
83
`endif // env_config

powered by: WebSVN 2.1.0

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