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 4

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
 
93
 
94
  extern task run_phase (uvm_phase);
95
endclass:uart_coverage
96
 
97
 
98
function void uart_coverage::build_phase (uvm_phase phase);
99
  super.build_phase(phase);
100
 
101
 
102
  trans  = uart_transaction::type_id::create("trans");
103
  _trans = uart_transaction::type_id::create("_trans");
104
 
105
  cov_mon = new ("cov_mon",this);
106
  mon_fifo = new ("mon_fifo",this);
107
 
108
endfunction:build_phase
109
 
110
function void uart_coverage::connect_phase(uvm_phase phase);
111
  cov_mon.connect(mon_fifo.analysis_export);
112
endfunction:connect_phase
113
 
114
task uart_coverage::run_phase(uvm_phase phase);
115
  forever
116
    begin
117
    mon_fifo.get(_trans);
118
    $cast(trans,_trans.clone());
119
    trans_attrib.sample();
120
    if(trans._mode == text)
121
      begin
122
      text_mode_cov.sample();
123
      end
124
    else if (trans._mode == binary)
125
      begin
126
      binary_mode_cov.sample();
127
      end
128
    end
129
endtask:run_phase

powered by: WebSVN 2.1.0

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