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 wb_slave_agent
|
20 |
|
|
`define wb_slave_agent
|
21 |
|
|
|
22 |
|
|
//
|
23 |
|
|
// Class Description:
|
24 |
|
|
//
|
25 |
|
|
//
|
26 |
|
|
class wb_slave_agent#(AW =32, DW=64, TW= 2) extends uvm_component;
|
27 |
|
|
|
28 |
|
|
// UVM Factory Registration Macro
|
29 |
|
|
//
|
30 |
|
|
`uvm_component_utils(wb_slave_agent)
|
31 |
|
|
|
32 |
|
|
//------------------------------------------
|
33 |
|
|
// Data Members
|
34 |
|
|
//------------------------------------------
|
35 |
|
|
wb_slave_agent_config m_cfg;
|
36 |
|
|
//------------------------------------------
|
37 |
|
|
// Component Members
|
38 |
|
|
//------------------------------------------
|
39 |
|
|
uvm_analysis_port #(wb_slave_seq_item) ap;
|
40 |
|
|
wb_slave_monitor m_monitor;
|
41 |
|
|
wb_slave_sequencer m_sequencer;
|
42 |
|
|
wb_slave_driver #(AW,DW,TW) m_driver;
|
43 |
|
|
item_listener listener;
|
44 |
|
|
//------------------------------------------
|
45 |
|
|
// Methods
|
46 |
|
|
//------------------------------------------
|
47 |
|
|
|
48 |
|
|
// Standard UVM Methods:
|
49 |
|
|
extern function new(string name = "wb_slave_agent", uvm_component parent = null);
|
50 |
|
|
extern function void build_phase(uvm_phase phase);
|
51 |
|
|
extern function void connect_phase(uvm_phase phase);
|
52 |
|
|
|
53 |
|
|
endclass: wb_slave_agent
|
54 |
|
|
|
55 |
|
|
|
56 |
|
|
function wb_slave_agent::new(string name = "wb_slave_agent", uvm_component parent = null);
|
57 |
|
|
super.new(name, parent);
|
58 |
|
|
endfunction
|
59 |
|
|
|
60 |
|
|
function void wb_slave_agent::build_phase(uvm_phase phase);
|
61 |
|
|
m_cfg = wb_slave_agent_config::get_config(this);
|
62 |
|
|
// Monitor is always present
|
63 |
|
|
m_monitor = wb_slave_monitor::type_id::create("m_monitor", this);
|
64 |
|
|
// Only build the driver and sequencer if active
|
65 |
|
|
if(m_cfg.active == UVM_ACTIVE) begin
|
66 |
|
|
m_driver = wb_slave_driver#(32,64,2) ::type_id::create("m_driver", this);
|
67 |
|
|
m_sequencer = wb_slave_sequencer::type_id::create("m_sequencer", this);
|
68 |
|
|
end
|
69 |
|
|
listener = item_listener::type_id::create("item_listener", this);
|
70 |
|
|
endfunction: build_phase
|
71 |
|
|
|
72 |
|
|
function void wb_slave_agent::connect_phase(uvm_phase phase);
|
73 |
|
|
ap = m_monitor.ap;
|
74 |
|
|
ap.connect(listener.analysis_export);
|
75 |
|
|
// Only connect the driver and the sequencer if active
|
76 |
|
|
if(m_cfg.active == UVM_ACTIVE) begin
|
77 |
|
|
m_driver.seq_item_port.connect(m_sequencer.seq_item_export);
|
78 |
|
|
end
|
79 |
|
|
|
80 |
|
|
endfunction: connect_phase
|
81 |
|
|
|
82 |
|
|
`endif // wb_slave_agent
|