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

Subversion Repositories uart2bus_testbench

[/] [uart2bus_testbench/] [trunk/] [tb/] [agent/] [coverage/] [uart_coverage.svh] - Diff between revs 11 and 13

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 11 Rev 13
Line 18... Line 18...
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
// ALL COPYRIGHTS ARE RESERVED FOR THE PRODUCER ONLY .THIS FILE IS PRODUCED FOR OPENCORES MEMBERS
// ALL COPYRIGHTS ARE RESERVED FOR THE PRODUCER ONLY .THIS FILE IS PRODUCED FOR OPENCORES MEMBERS
// ONLY AND IT IS PROHIBTED TO USE THIS MATERIAL WITHOUT THE CREATOR'S PERMISSION
// ONLY AND IT IS PROHIBTED TO USE THIS MATERIAL WITHOUT THE CREATOR'S PERMISSION
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
 
 
class uart_coverage extends uvm_component;
 
 
class uart_coverage extends uvm_subscriber#(uart_transaction);
 
 
  `uvm_component_utils(uart_coverage)
  `uvm_component_utils(uart_coverage)
 
 
  uart_transaction        trans,_trans;
  uart_transaction        trans,_trans;
 
 
  uvm_analysis_export #(uart_transaction)   cov_mon;
 
 
 
  uvm_tlm_analysis_fifo #(uart_transaction)   mon_fifo;
 
 
 
  covergroup trans_attrib;
  covergroup trans_attrib;
    communication_mode:
    communication_mode:
      coverpoint trans._mode{
      coverpoint trans._mode{
        bins valid_mode         = {text,binary};
        bins valid_mode         = {text,binary};
        bins invalid_mode       = {wrong_mode_text,wrong_mode_bin};
        bins invalid_mode       = {wrong_mode_text,wrong_mode_bin};
Line 45... Line 42...
  endgroup:trans_attrib
  endgroup:trans_attrib
 
 
  covergroup text_mode_cov;
  covergroup text_mode_cov;
    command:
    command:
      coverpoint trans._command{
      coverpoint trans._command{
        bins          valid_command  ={read,write};
        bins          valid_command  ={read,2};
        illegal_bins  invalid_command={nop,invalid_read,invalid_write};
        illegal_bins  invalid_command={nop,invalid_read,invalid_write};
      }
      }
    first_white_space_field:
    first_white_space_field:
      coverpoint trans._spacetype1;
      coverpoint trans._spacetype1;
    second_white_space_field:
    second_white_space_field:
Line 61... Line 58...
  endgroup:text_mode_cov
  endgroup:text_mode_cov
 
 
  covergroup binary_mode_cov;
  covergroup binary_mode_cov;
    command:
    command:
      coverpoint trans._command{
      coverpoint trans._command{
        bins normal_command={read,write,nop};
        bins normal_command={read,2,nop};
        bins wrong_command ={invalid_read,invalid_write};
        bins wrong_command ={invalid_read,invalid_write};
      }
      }
    acknowledge_requirement:
    acknowledge_requirement:
      coverpoint trans._reqack;
      coverpoint trans._reqack;
    incremental_address_requirement:
    incremental_address_requirement:
Line 90... Line 87...
 
 
  extern function void connect_phase (uvm_phase phase);
  extern function void connect_phase (uvm_phase phase);
 
 
  extern task run_phase (uvm_phase);
  extern task run_phase (uvm_phase);
 
 
 
  extern function void write (uart_transaction t);
 
 
 
 
endclass:uart_coverage
endclass:uart_coverage
 
 
 
 
Line 102... Line 100...
 
 
 
 
  trans  = uart_transaction::type_id::create("trans");
  trans  = uart_transaction::type_id::create("trans");
  _trans = uart_transaction::type_id::create("_trans");
  _trans = uart_transaction::type_id::create("_trans");
 
 
  cov_mon = new ("cov_mon",this);
 
  mon_fifo = new ("mon_fifo",this);
 
 
 
endfunction:build_phase
endfunction:build_phase
 
 
function void uart_coverage::connect_phase(uvm_phase phase);
function void uart_coverage::connect_phase(uvm_phase phase);
  cov_mon.connect(mon_fifo.analysis_export);
//  cov_mon.connect(mon_fifo.analysis_export);
endfunction:connect_phase
endfunction:connect_phase
 
 
task uart_coverage::run_phase(uvm_phase phase);
task uart_coverage::run_phase(uvm_phase phase);
  forever
 
    begin
endtask:run_phase
    mon_fifo.get(_trans);
 
    $cast(trans,_trans.clone());
function void uart_coverage::write(uart_transaction t);
 
   $cast(trans,t.clone());
    trans_attrib.sample();
    trans_attrib.sample();
    if(trans._mode == text)
    if(trans._mode == text)
      begin
      begin
      text_mode_cov.sample();
      text_mode_cov.sample();
      uvm_resource_db#(int)::write_by_name("coverage_cloud","text_coverage",text_mode_cov.get_coverage());
      uvm_resource_db#(int)::write_by_name("coverage_cloud","text_coverage",text_mode_cov.get_coverage());
      end
      end
    else if (trans._mode == binary)
    else if (trans._mode == binary)
      begin
      begin
      binary_mode_cov.sample();
      binary_mode_cov.sample();
      end
      end
    end
endfunction // write
endtask:run_phase
 
endfunction // write
 

powered by: WebSVN 2.1.0

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