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 13

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 13 HanySalah
 
24
class uart_coverage extends uvm_subscriber#(uart_transaction);
25 4 HanySalah
 
26
  `uvm_component_utils(uart_coverage)
27
 
28
  uart_transaction        trans,_trans;
29
 
30
  covergroup trans_attrib;
31
    communication_mode:
32
      coverpoint trans._mode{
33
        bins valid_mode         = {text,binary};
34
        bins invalid_mode       = {wrong_mode_text,wrong_mode_bin};
35
      }
36
    address:
37
      coverpoint trans.address;
38
    false_data:
39
      coverpoint trans.false_data_en;
40
    unknown_prefix:
41
      coverpoint trans.wrong_prefix;
42
  endgroup:trans_attrib
43
 
44
  covergroup text_mode_cov;
45
    command:
46
      coverpoint trans._command{
47 13 HanySalah
        bins          valid_command  ={read,2};
48 4 HanySalah
        illegal_bins  invalid_command={nop,invalid_read,invalid_write};
49
      }
50
    first_white_space_field:
51
      coverpoint trans._spacetype1;
52
    second_white_space_field:
53
      coverpoint trans._spacetype2;
54
    end_of_line_field:
55
      coverpoint trans._eoltype;
56
    prefix_character_type:
57
      coverpoint trans._chartype;
58
  endgroup:text_mode_cov
59
 
60
  covergroup binary_mode_cov;
61
    command:
62
      coverpoint trans._command{
63 13 HanySalah
        bins normal_command={read,2,nop};
64 4 HanySalah
        bins wrong_command ={invalid_read,invalid_write};
65
      }
66
    acknowledge_requirement:
67
      coverpoint trans._reqack;
68
    incremental_address_requirement:
69
      coverpoint trans._reqinc;
70
    Length_of_data:
71
      coverpoint trans.length_data{
72
        bins zero           = {0};
73
        bins valid          = {[1:256]};
74
        illegal_bins invalid= {[257:$]};
75
      }
76
  endgroup:binary_mode_cov
77
 
78
  function new (string name, uvm_component parent);
79
    super.new(name,parent);
80
 
81
    trans_attrib    = new();
82
    text_mode_cov   = new();
83
    binary_mode_cov = new();
84
  endfunction:new
85
 
86
  extern function void build_phase(uvm_phase phase);
87
 
88
  extern function void connect_phase (uvm_phase phase);
89 11 HanySalah
 
90
  extern task run_phase (uvm_phase);
91 4 HanySalah
 
92 13 HanySalah
  extern function void write (uart_transaction t);
93
 
94 11 HanySalah
 
95 4 HanySalah
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
endfunction:build_phase
106
 
107
function void uart_coverage::connect_phase(uvm_phase phase);
108 13 HanySalah
//  cov_mon.connect(mon_fifo.analysis_export);
109 4 HanySalah
endfunction:connect_phase
110
 
111
task uart_coverage::run_phase(uvm_phase phase);
112 13 HanySalah
 
113
endtask:run_phase
114
 
115
function void uart_coverage::write(uart_transaction t);
116
   $cast(trans,t.clone());
117
       trans_attrib.sample();
118 4 HanySalah
    if(trans._mode == text)
119
      begin
120
      text_mode_cov.sample();
121 11 HanySalah
      uvm_resource_db#(int)::write_by_name("coverage_cloud","text_coverage",text_mode_cov.get_coverage());
122 4 HanySalah
      end
123
    else if (trans._mode == binary)
124
      begin
125
      binary_mode_cov.sample();
126
      end
127 13 HanySalah
endfunction // write

powered by: WebSVN 2.1.0

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