Line 18... |
Line 18... |
//-------------
|
//-------------
|
// VERSION NAME DATE DESCRIPTION
|
// VERSION NAME DATE DESCRIPTION
|
// 1 HANY SALAH 10012016 FILE CREATION
|
// 1 HANY SALAH 10012016 FILE CREATION
|
// 2 HANY SALAH 20012016 ADD BINARY MODE TESTS AND INVALID TESTS
|
// 2 HANY SALAH 20012016 ADD BINARY MODE TESTS AND INVALID TESTS
|
// 3 HANY SALAH 12022016 IMPROVE BLOCK DESCRIPTION & ADD COMMENTS
|
// 3 HANY SALAH 12022016 IMPROVE BLOCK DESCRIPTION & ADD COMMENTS
|
|
// 4 HANY SALAH 26062017 ADD COVERAGE DRIVEN TEST
|
//-------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------
|
// 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
|
//-------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------
|
|
|
Line 64... |
Line 65... |
|
|
int matched ;
|
int matched ;
|
|
|
uvm_report_server report_server;
|
uvm_report_server report_server;
|
|
|
|
int hit_text_cov=90;
|
|
int hit_bin_cov=90;
|
|
int hit_mode_cov=90;
|
|
|
`uvm_component_utils_begin(uart_base_test)
|
`uvm_component_utils_begin(uart_base_test)
|
`uvm_field_int(matched,UVM_ALL_ON)
|
`uvm_field_int(matched,UVM_ALL_ON)
|
`uvm_component_utils_end
|
`uvm_component_utils_end
|
|
|
function new (string name,uvm_component parent);
|
function new (string name,uvm_component parent);
|
Line 85... |
Line 90... |
report_server = new();
|
report_server = new();
|
env_configuration();
|
env_configuration();
|
TE_configuration();
|
TE_configuration();
|
uvm_config_db#(uart_config)::set(this,"*","UART_CONFIGURATION",_config);
|
uvm_config_db#(uart_config)::set(this,"*","UART_CONFIGURATION",_config);
|
uvm_resource_db #(int)::set("coverage_cloud","text_coverage",0,null);
|
uvm_resource_db #(int)::set("coverage_cloud","text_coverage",0,null);
|
|
uvm_resource_db #(int)::set("coverage_cloud","binary_coverage",0,null);
|
|
uvm_resource_db #(int)::set("coverage_cloud","general_coverage",0,null);
|
endfunction:build_phase
|
endfunction:build_phase
|
|
|
function void connect_phase (uvm_phase phase);
|
function void connect_phase (uvm_phase phase);
|
super.connect_phase(phase);
|
super.connect_phase(phase);
|
endfunction:connect_phase
|
endfunction:connect_phase
|
Line 633... |
Line 640... |
//
|
//
|
// Coverage Driven Test
|
// Coverage Driven Test
|
//
|
//
|
//-------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------
|
|
|
class all_tests extends uart_base_test;
|
class cover_driven_test extends uart_base_test;
|
|
|
rand int unsigned testnumber;
|
rand int unsigned testnumber;
|
|
|
bit coverage_hit=1'b0;
|
bit coverage_hit=1'b0;
|
|
|
int iteration=0;
|
int iteration=0;
|
|
|
parameter MAX_ITER=10000;
|
parameter MAX_ITER=500;
|
|
|
// Text write tests
|
// Text write tests
|
seq_1p1 seq1;
|
seq_1p1 seq1;
|
seq_1p2 seq2;
|
seq_1p2 seq2;
|
seq_1p3 seq3;
|
seq_1p3 seq3;
|
Line 702... |
Line 709... |
// GRANT test
|
// GRANT test
|
seq_7p1 seq44;
|
seq_7p1 seq44;
|
seq_7p2 seq45;
|
seq_7p2 seq45;
|
|
|
|
|
`uvm_component_utils(all_tests)
|
`uvm_component_utils(cover_driven_test)
|
|
|
constraint validtest{testnumber inside{[0:45]};
|
constraint validtest{testnumber inside{[0:45]};
|
testnumber != 13;}
|
testnumber != 13;
|
|
testnumber != 9;
|
|
testnumber != 19;
|
|
testnumber != 21;
|
|
testnumber != 24;}
|
|
|
function new (string name,uvm_component parent);
|
function new (string name,uvm_component parent);
|
super.new(name,parent);
|
super.new(name,parent);
|
endfunction // new
|
endfunction // new
|
|
|
Line 765... |
Line 776... |
|
|
task run_phase (uvm_phase phase);
|
task run_phase (uvm_phase phase);
|
super.run_phase(phase);
|
super.run_phase(phase);
|
phase.raise_objection(this);
|
phase.raise_objection(this);
|
while(coverage_hit==1'b0 && (iteration < MAX_ITER) ) begin
|
while(coverage_hit==1'b0 && (iteration < MAX_ITER) ) begin
|
|
// while(iteration < 1000) begin
|
iteration++;
|
iteration++;
|
randomize();
|
randomize();
|
case(testnumber)
|
case(testnumber)
|
0:
|
0:
|
begin
|
begin
|
Line 963... |
Line 975... |
end // while (coverage_hit==1'b0)
|
end // while (coverage_hit==1'b0)
|
phase.drop_objection(this);
|
phase.drop_objection(this);
|
endtask // run_phase
|
endtask // run_phase
|
|
|
function void evaluate_coverage();
|
function void evaluate_coverage();
|
int text_coverage;
|
int text_cov;
|
uvm_resource_db#(int)::read_by_name("coverage_cloud","text_coverage",text_coverage);
|
int bin_cov;
|
if(text_coverage >= 80) coverage_hit=1'b1;
|
int mode_cov;
|
|
uvm_resource_db#(int)::read_by_name("coverage_cloud","text_coverage",text_cov);
|
|
uvm_resource_db#(int)::read_by_name("coverage_cloud","general_coverage",mode_cov);
|
|
uvm_resource_db#(int)::read_by_name("coverage_cloud","binary_coverage",bin_cov);
|
|
if((text_cov >= hit_text_cov) &&
|
|
(bin_cov >= hit_bin_cov) &&
|
|
(mode_cov >= hit_mode_cov)) coverage_hit=1'b1;
|
endfunction // evaluate_coverage
|
endfunction // evaluate_coverage
|
|
|
function void report_phase(uvm_phase phase);
|
function void report_phase(uvm_phase phase);
|
int coverage;
|
int text_cov;
|
|
int mode_cov;
|
|
int bin_cov;
|
super.report_phase(phase);
|
super.report_phase(phase);
|
if(!(iteration
|
if(!(iteration
|
begin
|
begin
|
uvm_resource_db#(int)::read_by_name("coverage_cloud","text_coverage",coverage);
|
uvm_resource_db#(int)::read_by_name("coverage_cloud","text_coverage",text_cov);
|
`uvm_warning("SIM",$sformatf("coverage not hit and reached %0d",coverage));
|
uvm_resource_db#(int)::read_by_name("coverage_cloud","binary_coverage",bin_cov);
|
|
uvm_resource_db#(int)::read_by_name("coverage_cloud","general_coverage",mode_cov);
|
|
`uvm_warning("SIM",$sformatf("coverage not hit and reached \n textcov:%0d\nmodecov:%0d\nbincov:%0d",text_cov,mode_cov,bin_cov));
|
|
end
|
|
else begin
|
|
`uvm_info("SIM",$sformatf("Simulation hit the coverage successfully by %0d transactions",iteration),UVM_NONE);
|
end
|
end
|
endfunction // report_phase
|
endfunction // report_phase
|
|
|
endclass // all_tests
|
endclass // cover_driven_test
|
endclass // cover_driven_test
|
endclass // cover_driven_test
|