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

Subversion Repositories uart2bus_testbench

[/] [uart2bus_testbench/] [trunk/] [tb/] [agent/] [coverage/] [uart_coverage.svh] - Blame information for rev 11

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 HanySalah
//-------------------------------------------------------------------------------------------------
2
//
3
//                             UART2BUS VERIFICATION
4
//
5
//-------------------------------------------------------------------------------------------------
6
// CREATOR    : HANY SALAH
7
// PROJECT    : UART2BUS UVM TEST BENCH
8
// UNIT       : AGENT
9
//-------------------------------------------------------------------------------------------------
10
// TITLE      : UART Coverage
11
// DESCRIPTION: THIS BLOCK INCLUDES ALL THE COVERPINS THAT ARE SAMPLED EACH STIMULUS
12
//-------------------------------------------------------------------------------------------------
13
// LOG DETAILS
14
//-------------
15
// VERSION      NAME        DATE        DESCRIPTION
16
//    1       HANY SALAH    08022016    FILE CREATION
17
//    2       HANY SALAH    11022016    IMPROVE BLOCK DESCRIPTION & ADD CODE COMMENTS
18
//-------------------------------------------------------------------------------------------------
19
// ALL COPYRIGHTS ARE RESERVED FOR THE PRODUCER ONLY .THIS FILE IS PRODUCED FOR OPENCORES MEMBERS
20
// ONLY AND IT IS PROHIBTED TO USE THIS MATERIAL WITHOUT THE CREATOR'S PERMISSION
21
//-------------------------------------------------------------------------------------------------
22
 
23
class uart_coverage extends uvm_component;
24
 
25
  `uvm_component_utils(uart_coverage)
26
 
27
  uart_transaction        trans,_trans;
28
 
29
  uvm_analysis_export #(uart_transaction)   cov_mon;
30
 
31
  uvm_tlm_analysis_fifo #(uart_transaction)   mon_fifo;
32
 
33
  covergroup trans_attrib;
34
    communication_mode:
35
      coverpoint trans._mode{
36
        bins valid_mode         = {text,binary};
37
        bins invalid_mode       = {wrong_mode_text,wrong_mode_bin};
38
      }
39
    address:
40
      coverpoint trans.address;
41
    false_data:
42
      coverpoint trans.false_data_en;
43
    unknown_prefix:
44
      coverpoint trans.wrong_prefix;
45
  endgroup:trans_attrib
46
 
47
  covergroup text_mode_cov;
48
    command:
49
      coverpoint trans._command{
50
        bins          valid_command  ={read,write};
51
        illegal_bins  invalid_command={nop,invalid_read,invalid_write};
52
      }
53
    first_white_space_field:
54
      coverpoint trans._spacetype1;
55
    second_white_space_field:
56
      coverpoint trans._spacetype2;
57
    end_of_line_field:
58
      coverpoint trans._eoltype;
59
    prefix_character_type:
60
      coverpoint trans._chartype;
61
  endgroup:text_mode_cov
62
 
63
  covergroup binary_mode_cov;
64
    command:
65
      coverpoint trans._command{
66
        bins normal_command={read,write,nop};
67
        bins wrong_command ={invalid_read,invalid_write};
68
      }
69
    acknowledge_requirement:
70
      coverpoint trans._reqack;
71
    incremental_address_requirement:
72
      coverpoint trans._reqinc;
73
    Length_of_data:
74
      coverpoint trans.length_data{
75
        bins zero           = {0};
76
        bins valid          = {[1:256]};
77
        illegal_bins invalid= {[257:$]};
78
      }
79
  endgroup:binary_mode_cov
80
 
81
  function new (string name, uvm_component parent);
82
    super.new(name,parent);
83
 
84
    trans_attrib    = new();
85
    text_mode_cov   = new();
86
    binary_mode_cov = new();
87
  endfunction:new
88
 
89
  extern function void build_phase(uvm_phase phase);
90
 
91
  extern function void connect_phase (uvm_phase phase);
92 11 HanySalah
 
93
  extern task run_phase (uvm_phase);
94 4 HanySalah
 
95 11 HanySalah
 
96
 
97 4 HanySalah
endclass:uart_coverage
98
 
99
 
100
function void uart_coverage::build_phase (uvm_phase phase);
101
  super.build_phase(phase);
102
 
103
 
104
  trans  = uart_transaction::type_id::create("trans");
105
  _trans = uart_transaction::type_id::create("_trans");
106
 
107
  cov_mon = new ("cov_mon",this);
108
  mon_fifo = new ("mon_fifo",this);
109
 
110
endfunction:build_phase
111
 
112
function void uart_coverage::connect_phase(uvm_phase phase);
113
  cov_mon.connect(mon_fifo.analysis_export);
114
endfunction:connect_phase
115
 
116
task uart_coverage::run_phase(uvm_phase phase);
117
  forever
118
    begin
119
    mon_fifo.get(_trans);
120
    $cast(trans,_trans.clone());
121
    trans_attrib.sample();
122
    if(trans._mode == text)
123
      begin
124
      text_mode_cov.sample();
125 11 HanySalah
      uvm_resource_db#(int)::write_by_name("coverage_cloud","text_coverage",text_mode_cov.get_coverage());
126 4 HanySalah
      end
127
    else if (trans._mode == binary)
128
      begin
129
      binary_mode_cov.sample();
130
      end
131
    end
132 11 HanySalah
endtask:run_phase

powered by: WebSVN 2.1.0

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