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

Subversion Repositories avalon-wishbone-bridge

[/] [avalon-wishbone-bridge/] [trunk/] [UVM/] [wb_slave_agent/] [wb_slave_agent_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
 
20
//
21
// Class Description:
22
//
23
//
24
class wb_slave_agent_config extends uvm_object;
25
 
26
localparam string s_my_config_id = "wb_slave_agent_config";
27
localparam string s_no_config_id = "no config";
28
localparam string s_my_config_type_error_id = "config type error";
29
 
30
// UVM Factory Registration Macro
31
//
32
`uvm_object_utils(wb_slave_agent_config)
33
 
34
// Virtual Interface
35
virtual wb_if#(32, 64, 2) WB;
36
 
37
//------------------------------------------
38
// Data Members
39
//------------------------------------------
40
// Is the agent active or passive
41
uvm_active_passive_enum active = UVM_ACTIVE;
42
 
43
logic[31:0] start_address[15:0];
44
logic[31:0] range[15:0];
45
 
46
int wb_index = 0;
47
//------------------------------------------
48
// Methods
49
//------------------------------------------
50
extern static function wb_slave_agent_config get_config( uvm_component c );
51
// Standard UVM Methods:
52
extern function new(string name = "wb_slave_agent_config");
53
 
54
endclass: wb_slave_agent_config
55
 
56
function wb_slave_agent_config::new(string name = "wb_slave_agent_config");
57
  super.new(name);
58
endfunction
59
 
60
//
61
// Function: get_config
62
//
63
// This method gets the my_config associated with component c. We check for
64
// the two kinds of error which may occur with this kind of
65
// operation.
66
//
67
function wb_slave_agent_config wb_slave_agent_config::get_config( uvm_component c );
68
  uvm_object o;
69
  wb_slave_agent_config t;
70
 
71
  if( !c.get_config_object( s_my_config_id , o , 0 ) ) begin
72
    c.uvm_report_error( s_no_config_id ,
73
                        $sformatf("no config associated with %s" ,
74
                                  s_my_config_id ) ,
75
                        UVM_NONE , `uvm_file , `uvm_line  );
76
    return null;
77
  end
78
 
79
  if( !$cast( t , o ) ) begin
80
    c.uvm_report_error( s_my_config_type_error_id ,
81
                        $sformatf("config %s associated with config %s is not of type my_config" ,
82
                                   o.sprint() , s_my_config_id ) ,
83
                        UVM_NONE , `uvm_file , `uvm_line );
84
  end
85
 
86
  return t;
87
endfunction

powered by: WebSVN 2.1.0

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