//-------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------
|
//
|
//
|
// UART2BUS VERIFICATION
|
// UART2BUS VERIFICATION
|
//
|
//
|
//-------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------
|
// CREATOR : HANY SALAH
|
// CREATOR : HANY SALAH
|
// PROJECT : UART2BUS UVM TEST BENCH
|
// PROJECT : UART2BUS UVM TEST BENCH
|
// UNIT : AGENT
|
// UNIT : AGENT
|
//-------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------
|
// TITLE : UART Coverage
|
// TITLE : UART Coverage
|
// DESCRIPTION: THIS BLOCK INCLUDES ALL THE COVERPINS THAT ARE SAMPLED EACH STIMULUS
|
// DESCRIPTION: THIS BLOCK INCLUDES ALL THE COVERPINS THAT ARE SAMPLED EACH STIMULUS
|
//-------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------
|
// LOG DETAILS
|
// LOG DETAILS
|
//-------------
|
//-------------
|
// VERSION NAME DATE DESCRIPTION
|
// VERSION NAME DATE DESCRIPTION
|
// 1 HANY SALAH 08022016 FILE CREATION
|
// 1 HANY SALAH 08022016 FILE CREATION
|
// 2 HANY SALAH 11022016 IMPROVE BLOCK DESCRIPTION & ADD CODE COMMENTS
|
// 2 HANY SALAH 11022016 IMPROVE BLOCK DESCRIPTION & ADD CODE COMMENTS
|
//-------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------
|
// 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_subscriber#(uart_transaction);
|
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;
|
|
|
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};
|
illegal_bins invalid_mode = {wrong_mode_text,wrong_mode_bin};
|
}
|
}
|
address:
|
address:
|
coverpoint trans.address;
|
coverpoint trans.address;
|
false_data:
|
|
coverpoint trans.false_data_en;
|
|
unknown_prefix:
|
|
coverpoint trans.wrong_prefix;
|
|
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,2};
|
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{bins validspace ={single,tab};
|
|
illegal_bins invalidspace ={wrong_space};}
|
second_white_space_field:
|
second_white_space_field:
|
coverpoint trans._spacetype2;
|
coverpoint trans._spacetype2{bins validspace ={single,tab};
|
|
illegal_bins invalidspace ={wrong_space};}
|
end_of_line_field:
|
end_of_line_field:
|
coverpoint trans._eoltype;
|
coverpoint trans._eoltype{bins valideol={cr,lf};
|
|
illegal_bins eol ={wrong_eol};}
|
prefix_character_type:
|
prefix_character_type:
|
coverpoint trans._chartype;
|
coverpoint trans._chartype;
|
|
|
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,2,nop};
|
bins normal_command={read,2,nop};
|
bins wrong_command ={invalid_read,invalid_write};
|
illegal_bins wrong_command ={invalid_read,invalid_write};
|
}
|
}
|
acknowledge_requirement:
|
acknowledge_requirement:
|
coverpoint trans._reqack;
|
coverpoint trans._reqack;
|
incremental_address_requirement:
|
incremental_address_requirement:
|
coverpoint trans._reqinc;
|
coverpoint trans._reqinc;
|
Length_of_data:
|
Length_of_data:
|
coverpoint trans.length_data{
|
coverpoint trans.length_data{
|
bins zero = {0};
|
bins zero = {0};
|
bins valid = {[1:256]};
|
bins valid = {[1:256]};
|
illegal_bins invalid= {[257:$]};
|
illegal_bins invalid= {[257:$]};
|
}
|
}
|
endgroup:binary_mode_cov
|
endgroup:binary_mode_cov
|
|
|
function new (string name, uvm_component parent);
|
function new (string name, uvm_component parent);
|
super.new(name,parent);
|
super.new(name,parent);
|
|
|
trans_attrib = new();
|
trans_attrib = new();
|
text_mode_cov = new();
|
text_mode_cov = new();
|
binary_mode_cov = new();
|
binary_mode_cov = new();
|
endfunction:new
|
endfunction:new
|
|
|
extern function void build_phase(uvm_phase phase);
|
extern function void build_phase(uvm_phase phase);
|
|
|
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);
|
extern function void write (uart_transaction t);
|
|
|
|
|
endclass:uart_coverage
|
endclass:uart_coverage
|
|
|
|
|
function void uart_coverage::build_phase (uvm_phase phase);
|
function void uart_coverage::build_phase (uvm_phase phase);
|
super.build_phase(phase);
|
super.build_phase(phase);
|
|
|
|
|
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");
|
|
|
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);
|
|
endfunction:connect_phase
|
endfunction:connect_phase
|
|
|
task uart_coverage::run_phase(uvm_phase phase);
|
task uart_coverage::run_phase(uvm_phase phase);
|
|
|
endtask:run_phase
|
endtask:run_phase
|
|
|
function void uart_coverage::write(uart_transaction t);
|
function void uart_coverage::write(uart_transaction t);
|
$cast(trans,t.clone());
|
$cast(trans,t.clone());
|
trans_attrib.sample();
|
trans_attrib.sample();
|
|
uvm_resource_db#(int)::write_by_name("coverage_cloud","general_coverage",trans_attrib.get_coverage());
|
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();
|
|
uvm_resource_db#(int)::write_by_name("coverage_cloud","binary_coverage",binary_mode_cov.get_coverage());
|
end
|
end
|
endfunction // write
|
endfunction // write
|
|
|