1 |
11 |
vladimirar |
// You can insert code here by setting file_header_inc in file common.tpl
|
2 |
|
|
|
3 |
|
|
//=============================================================================
|
4 |
|
|
// Project : generated_tb
|
5 |
|
|
//
|
6 |
|
|
// File Name: data_output_coverage.sv
|
7 |
|
|
//
|
8 |
|
|
//
|
9 |
|
|
// Version: 1.0
|
10 |
|
|
//
|
11 |
|
|
// Code created by Easier UVM Code Generator version 2016-04-18-EP on Sat Apr 27 13:59:59 2019
|
12 |
|
|
//=============================================================================
|
13 |
|
|
// Description: Coverage for agent data_output
|
14 |
|
|
//=============================================================================
|
15 |
|
|
|
16 |
|
|
`ifndef DATA_OUTPUT_COVERAGE_SV
|
17 |
|
|
`define DATA_OUTPUT_COVERAGE_SV
|
18 |
|
|
|
19 |
|
|
// You can insert code here by setting agent_cover_inc_before_class in file data_output.tpl
|
20 |
|
|
|
21 |
|
|
class data_output_coverage extends uvm_subscriber #(output_tx);
|
22 |
|
|
|
23 |
|
|
`uvm_component_utils(data_output_coverage)
|
24 |
|
|
|
25 |
|
|
data_output_config m_config;
|
26 |
|
|
bit m_is_covered;
|
27 |
|
|
output_tx m_item;
|
28 |
|
|
|
29 |
|
|
// You can replace covergroup m_cov by setting agent_cover_inc in file data_output.tpl
|
30 |
|
|
// or remove covergroup m_cov by setting agent_cover_generate_methods_inside_class = no in file data_output.tpl
|
31 |
|
|
|
32 |
|
|
covergroup m_cov;
|
33 |
|
|
option.per_instance = 1;
|
34 |
|
|
// You may insert additional coverpoints here ...
|
35 |
|
|
|
36 |
|
|
cp_data: coverpoint m_item.data;
|
37 |
|
|
// Add bins here if required
|
38 |
|
|
|
39 |
|
|
endgroup
|
40 |
|
|
|
41 |
|
|
// You can remove new, write, and report_phase by setting agent_cover_generate_methods_inside_class = no in file data_output.tpl
|
42 |
|
|
|
43 |
|
|
extern function new(string name, uvm_component parent);
|
44 |
|
|
extern function void write(input output_tx t);
|
45 |
|
|
extern function void build_phase(uvm_phase phase);
|
46 |
|
|
extern function void report_phase(uvm_phase phase);
|
47 |
|
|
|
48 |
|
|
// You can insert code here by setting agent_cover_inc_inside_class in file data_output.tpl
|
49 |
|
|
|
50 |
|
|
endclass : data_output_coverage
|
51 |
|
|
|
52 |
|
|
|
53 |
|
|
// You can remove new, write, and report_phase by setting agent_cover_generate_methods_after_class = no in file data_output.tpl
|
54 |
|
|
|
55 |
|
|
function data_output_coverage::new(string name, uvm_component parent);
|
56 |
|
|
super.new(name, parent);
|
57 |
|
|
m_is_covered = 0;
|
58 |
|
|
m_cov = new();
|
59 |
|
|
endfunction : new
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
function void data_output_coverage::write(input output_tx t);
|
63 |
|
|
m_item = t;
|
64 |
|
|
if (m_config.coverage_enable)
|
65 |
|
|
begin
|
66 |
|
|
m_cov.sample();
|
67 |
|
|
// Check coverage - could use m_cov.option.goal instead of 100 if your simulator supports it
|
68 |
|
|
if (m_cov.get_inst_coverage() >= 100) m_is_covered = 1;
|
69 |
|
|
end
|
70 |
|
|
endfunction : write
|
71 |
|
|
|
72 |
|
|
|
73 |
|
|
function void data_output_coverage::build_phase(uvm_phase phase);
|
74 |
|
|
if (!uvm_config_db #(data_output_config)::get(this, "", "config", m_config))
|
75 |
|
|
`uvm_error(get_type_name(), "data_output config not found")
|
76 |
|
|
endfunction : build_phase
|
77 |
|
|
|
78 |
|
|
|
79 |
|
|
function void data_output_coverage::report_phase(uvm_phase phase);
|
80 |
|
|
if (m_config.coverage_enable)
|
81 |
|
|
`uvm_info(get_type_name(), $sformatf("Coverage score = %3.1f%%", m_cov.get_inst_coverage()), UVM_MEDIUM)
|
82 |
|
|
else
|
83 |
|
|
`uvm_info(get_type_name(), "Coverage disabled for this agent", UVM_MEDIUM)
|
84 |
|
|
endfunction : report_phase
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
// You can insert code here by setting agent_cover_inc_after_class in file data_output.tpl
|
88 |
|
|
|
89 |
|
|
`endif // DATA_OUTPUT_COVERAGE_SV
|
90 |
|
|
|