APB UVM Agent  0.0.1
apb_coverage_monitor.svh
Go to the documentation of this file.
1 //------------------------------------------------------------
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 /**
22 * Collects basic functional coverage information observed by an APB agent.
23 *
24 * An instance of the coverage monitor will be part of the agent only if its
25 * configuration knob, apb_agent_config::has_functional_coverage, is set.
26 *
27 * The coverage monitor extends uvm_subscriber so it can be connected to
28 * apb_monitor.
29 */
30 class apb_coverage_monitor extends uvm_subscriber #(apb_seq_item);
31 
32 // UVM Factory Registration Macro
33 //
34 `uvm_component_utils(apb_coverage_monitor);
35 
36 
37 //------------------------------------------
38 // Cover Group(s)
39 //------------------------------------------
40 
41 //! Covers that both read and write transactions were observed.
42 covergroup apb_cov;
43 OPCODE: coverpoint analysis_txn.we {
44  bins write = {1};
45  bins read = {0};
46 }
47 // To do:
48 // Monitor is not returning delay info
49 endgroup
50 
51 //------------------------------------------
52 // Component Members
53 //------------------------------------------
54 //! Transaction instance to be covered. This merely a reference to the last
55 //! transaction received from the APB monitor this coverage monitor instance
56 //! connects to.
58 
59 //------------------------------------------
60 // Methods
61 //------------------------------------------
62 
63 // Standard UVM Methods:
64 
65 /**
66 * Conventional UVM component constructor.
67 */
68 extern function new(string name = "apb_coverage_monitor", uvm_component parent = null);
69 
70 /**
71 * Samples coverage on the received transaction.
72 *
73 * This method implements the UVM subsciber's *observe* method.
74 */
75 extern function void write(
76  //! Transaction on which to sample the coverage.
77  T t
78 );
79 
80 /**
81 * Reports collected coverage during the corresponding phase of UVM test execution.
82 */
83 extern function void report_phase(
84  //! Reference to the corresponding phase instance.
85  uvm_phase phase
86 );
87 
88 endclass: apb_coverage_monitor
89 
90 function apb_coverage_monitor::new(string name = "apb_coverage_monitor", uvm_component parent = null);
91  super.new(name, parent);
92  apb_cov = new();
93 endfunction
94 
95 function void apb_coverage_monitor::write(T t);
96  analysis_txn = t;
97  apb_cov.sample();
98 endfunction:write
99 
100 function void apb_coverage_monitor::report_phase(uvm_phase phase);
101 // Might be a good place to do some reporting on no of analysis transactions sent etc
102 
103 endfunction: report_phase
Base APB transaction.
void write(T t)
Samples coverage on the received transaction.
apb_seq_item analysis_txn
Transaction instance to be covered.
void report_phase(uvm_phase phase)
Reports collected coverage during the corresponding phase of UVM test execution.
uvm_component_utils(apb_coverage_monitor)
new(string name="apb_coverage_monitor", uvm_component parent=null)
Conventional UVM component constructor.
covergroup apb_cov()
Covers that both read and write transactions were observed.
Collects basic functional coverage information observed by an APB agent.