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_monitor.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_monitor extends uvm_component;
25
 
26
// UVM Factory Registration Macro
27
//
28
`uvm_component_utils(wb_slave_monitor);
29
 
30
// Virtual Interface
31
virtual wb_if #(32,64,2)  WB;
32
 
33
//------------------------------------------
34
// Data Members
35
//------------------------------------------
36
wb_slave_agent_config m_cfg;
37
 
38
//------------------------------------------
39
// Component Members
40
//------------------------------------------
41
uvm_analysis_port #(wb_slave_seq_item) ap;
42
 
43
//------------------------------------------
44
// Methods
45
//------------------------------------------
46
 
47
// Standard UVM Methods:
48
 
49
extern function new(string name = "wb_slave_monitor", uvm_component parent = null);
50
extern function void build_phase(uvm_phase phase);
51
extern task run_phase(uvm_phase phase);
52
extern function void report_phase(uvm_phase phase);
53
 
54
endclass: wb_slave_monitor
55
 
56
function wb_slave_monitor::new(string name = "wb_slave_monitor", uvm_component parent = null);
57
  super.new(name, parent);
58
endfunction
59
 
60
function void wb_slave_monitor::build_phase(uvm_phase phase);
61
  ap = new("ap", this);
62
  m_cfg = wb_slave_agent_config::get_config(this);
63
  WB = m_cfg.WB;
64
endfunction: build_phase
65
 
66
task wb_slave_monitor::run_phase(uvm_phase phase);
67
  wb_slave_seq_item #(32,64,2)  item;
68
  wb_slave_seq_item #(32,64,2) cloned_item;
69
 
70
  item = wb_slave_seq_item#(32,64,2)::type_id::create("item");
71
 
72
//phase.raise_objection(this);
73
  forever begin
74
    // Detect the protocol event on the TBAI virtual interface
75
    @(posedge WB.clk);
76
    if(WB.cyc && WB.stb)
77
    // Assign the relevant values to the analysis item fields
78
      begin
79
        item.addr = WB.adr;
80
        item.rw = WB.we;
81
        if(WB.we)
82
          begin
83
            item.wdata = WB.dat_o;
84
          end
85
        else
86
          begin
87
            item.rdata = WB.dat_i;
88
          end
89
        // Clone and publish the cloned item to the subscribers
90
        $cast(cloned_item, item.clone());
91
        ap.write(cloned_item);
92
      end
93
  end
94
//phase.drop_objection(this);
95
endtask: run_phase
96
 
97
function void wb_slave_monitor::report_phase(uvm_phase phase);
98
// Might be a good place to do some reporting on no of analysis transactions sent etc
99
 
100
endfunction: report_phase

powered by: WebSVN 2.1.0

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