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 14

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 14 HanySalah
        illegal_bins invalid_mode       = {wrong_mode_text,wrong_mode_bin};
35 4 HanySalah
      }
36
    address:
37
      coverpoint trans.address;
38 14 HanySalah
 
39 4 HanySalah
  endgroup:trans_attrib
40
 
41
  covergroup text_mode_cov;
42
    command:
43
      coverpoint trans._command{
44 13 HanySalah
        bins          valid_command  ={read,2};
45 4 HanySalah
        illegal_bins  invalid_command={nop,invalid_read,invalid_write};
46
      }
47
    first_white_space_field:
48 14 HanySalah
      coverpoint trans._spacetype1{bins         validspace   ={single,tab};
49
                                   illegal_bins invalidspace ={wrong_space};}
50 4 HanySalah
    second_white_space_field:
51 14 HanySalah
      coverpoint trans._spacetype2{bins         validspace   ={single,tab};
52
                                   illegal_bins invalidspace ={wrong_space};}
53 4 HanySalah
    end_of_line_field:
54 14 HanySalah
      coverpoint trans._eoltype{bins         valideol={cr,lf};
55
                                illegal_bins eol ={wrong_eol};}
56 4 HanySalah
    prefix_character_type:
57
      coverpoint trans._chartype;
58 14 HanySalah
 
59 4 HanySalah
  endgroup:text_mode_cov
60
 
61
  covergroup binary_mode_cov;
62
    command:
63
      coverpoint trans._command{
64 13 HanySalah
        bins normal_command={read,2,nop};
65 14 HanySalah
        illegal_bins wrong_command ={invalid_read,invalid_write};
66 4 HanySalah
      }
67
    acknowledge_requirement:
68
      coverpoint trans._reqack;
69
    incremental_address_requirement:
70
      coverpoint trans._reqinc;
71
    Length_of_data:
72
      coverpoint trans.length_data{
73
        bins zero           = {0};
74
        bins valid          = {[1:256]};
75
        illegal_bins invalid= {[257:$]};
76
      }
77
  endgroup:binary_mode_cov
78
 
79
  function new (string name, uvm_component parent);
80
    super.new(name,parent);
81
 
82
    trans_attrib    = new();
83
    text_mode_cov   = new();
84
    binary_mode_cov = new();
85
  endfunction:new
86
 
87
  extern function void build_phase(uvm_phase phase);
88
 
89
  extern function void connect_phase (uvm_phase phase);
90 11 HanySalah
 
91
  extern task run_phase (uvm_phase);
92 4 HanySalah
 
93 13 HanySalah
  extern function void write (uart_transaction t);
94
 
95 11 HanySalah
 
96 4 HanySalah
endclass:uart_coverage
97
 
98
 
99
function void uart_coverage::build_phase (uvm_phase phase);
100
  super.build_phase(phase);
101
 
102
 
103
  trans  = uart_transaction::type_id::create("trans");
104
  _trans = uart_transaction::type_id::create("_trans");
105
 
106
endfunction:build_phase
107
 
108
function void uart_coverage::connect_phase(uvm_phase phase);
109
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 14 HanySalah
   trans_attrib.sample();
118
   uvm_resource_db#(int)::write_by_name("coverage_cloud","general_coverage",trans_attrib.get_coverage());
119 4 HanySalah
    if(trans._mode == text)
120
      begin
121
      text_mode_cov.sample();
122 11 HanySalah
      uvm_resource_db#(int)::write_by_name("coverage_cloud","text_coverage",text_mode_cov.get_coverage());
123 4 HanySalah
      end
124
    else if (trans._mode == binary)
125
      begin
126
      binary_mode_cov.sample();
127 14 HanySalah
      uvm_resource_db#(int)::write_by_name("coverage_cloud","binary_coverage",binary_mode_cov.get_coverage());
128 4 HanySalah
      end
129 13 HanySalah
endfunction // write

powered by: WebSVN 2.1.0

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