OpenCores
URL https://opencores.org/ocsvn/lpffir/lpffir/trunk

Subversion Repositories lpffir

[/] [lpffir/] [trunk/] [uvm/] [rca_uvm/] [generated_tb/] [tb/] [rca/] [sv/] [rca_coverage.sv] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 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: rca_coverage.sv
7
//
8
//
9
// Version:   1.0
10
//
11
// Code created by Easier UVM Code Generator version 2016-04-18-EP on Tue Mar 19 21:50:30 2019
12
//=============================================================================
13
// Description: Coverage for agent rca
14
//=============================================================================
15
 
16
`ifndef RCA_COVERAGE_SV
17
`define RCA_COVERAGE_SV
18
 
19
// You can insert code here by setting agent_cover_inc_before_class in file rca.tpl
20
 
21
class rca_coverage extends uvm_subscriber #(trans);
22
 
23
  `uvm_component_utils(rca_coverage)
24
 
25
  rca_config m_config;
26
  bit        m_is_covered;
27
  trans      m_item;
28
 
29
  // You can replace covergroup m_cov by setting agent_cover_inc in file rca.tpl
30
  // or remove covergroup m_cov by setting agent_cover_generate_methods_inside_class = no in file rca.tpl
31
 
32
  covergroup m_cov;
33
    option.per_instance = 1;
34
    // You may insert additional coverpoints here ...
35
 
36
    cp_input1: coverpoint m_item.input1;
37
    //  Add bins here if required
38
 
39
    cp_input2: coverpoint m_item.input2;
40
    //  Add bins here if required
41
 
42
    cp_carryinput: coverpoint m_item.carryinput;
43
    //  Add bins here if required
44
 
45
    cp_carryoutput: coverpoint m_item.carryoutput;
46
    //  Add bins here if required
47
 
48
    cp_sum: coverpoint m_item.sum;
49
    //  Add bins here if required
50
 
51
  endgroup
52
 
53
  // You can remove new, write, and report_phase by setting agent_cover_generate_methods_inside_class = no in file rca.tpl
54
 
55
  extern function new(string name, uvm_component parent);
56
  extern function void write(input trans t);
57
  extern function void build_phase(uvm_phase phase);
58
  extern function void report_phase(uvm_phase phase);
59
 
60
  // You can insert code here by setting agent_cover_inc_inside_class in file rca.tpl
61
 
62
endclass : rca_coverage
63
 
64
 
65
// You can remove new, write, and report_phase by setting agent_cover_generate_methods_after_class = no in file rca.tpl
66
 
67
function rca_coverage::new(string name, uvm_component parent);
68
  super.new(name, parent);
69
  m_is_covered = 0;
70
  m_cov = new();
71
endfunction : new
72
 
73
 
74
function void rca_coverage::write(input trans t);
75
  m_item = t;
76
  if (m_config.coverage_enable)
77
  begin
78
    m_cov.sample();
79
    // Check coverage - could use m_cov.option.goal instead of 100 if your simulator supports it
80
    if (m_cov.get_inst_coverage() >= 100) m_is_covered = 1;
81
  end
82
endfunction : write
83
 
84
 
85
function void rca_coverage::build_phase(uvm_phase phase);
86
  if (!uvm_config_db #(rca_config)::get(this, "", "config", m_config))
87
    `uvm_error(get_type_name(), "rca config not found")
88
endfunction : build_phase
89
 
90
 
91
function void rca_coverage::report_phase(uvm_phase phase);
92
  if (m_config.coverage_enable)
93
    `uvm_info(get_type_name(), $sformatf("Coverage score = %3.1f%%", m_cov.get_inst_coverage()), UVM_MEDIUM)
94
  else
95
    `uvm_info(get_type_name(), "Coverage disabled for this agent", UVM_MEDIUM)
96
endfunction : report_phase
97
 
98
 
99
// You can insert code here by setting agent_cover_inc_after_class in file rca.tpl
100
 
101
`endif // RCA_COVERAGE_SV
102
 

powered by: WebSVN 2.1.0

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