// ********************************************************************************
|
// ********************************************************************************
|
//
|
//
|
// Module: tb_gldbl
|
// Module: tb_gldbl
|
//
|
//
|
// Functional Description:
|
// Functional Description:
|
//
|
//
|
// This module has tasks for global statistics,test-pass/fail messages
|
// This module has tasks for global statistics,test-pass/fail messages
|
//
|
//
|
// ********************************************************************************
|
// ********************************************************************************
|
|
|
module tb_glbl;
|
module tb_glbl;
|
reg [31:0] err_count;
|
reg [31:0] err_count;
|
reg [31:0] warn_count;
|
reg [31:0] warn_count;
|
|
|
|
|
task init;
|
task init;
|
begin
|
begin
|
err_count = 32'h0;
|
err_count = 32'h0;
|
warn_count = 32'h0;
|
warn_count = 32'h0;
|
end
|
end
|
endtask
|
endtask
|
|
|
task test_pass;
|
task test_pass;
|
begin
|
begin
|
$display ("\n=========");
|
$display ("\n=========");
|
$display ("Test Status: TEST PASSED");
|
$display ("Test Status: TEST PASSED");
|
$display ("=========\n");
|
$display ("=========\n");
|
end
|
end
|
endtask
|
endtask
|
|
|
task test_fail;
|
task test_fail;
|
begin
|
begin
|
$display ("\n=========");
|
$display ("\n=========");
|
$display ("Test Status: TEST FAILED");
|
$display ("Test Status: TEST FAILED");
|
$display ("=========\n");
|
$display ("=========\n");
|
end
|
end
|
endtask
|
endtask
|
|
|
|
|
task test_err;
|
task test_err;
|
begin
|
begin
|
err_count = err_count + 1;
|
err_count = err_count + 1;
|
$display ("A200 TB => %t ns ERROR :: %m ERROR detected %d ",$time, err_count );
|
$display ("TB => %t ns ERROR :: %m ERROR detected %d ",$time, err_count );
|
end
|
end
|
endtask
|
endtask
|
|
|
task test_warn;
|
task test_warn;
|
begin
|
begin
|
warn_count = warn_count + 1;
|
warn_count = warn_count + 1;
|
$display ("A200 TB => %t ns WARNING :: %m Warning %d ",$time, warn_count );
|
$display ("TB => %t ns WARNING :: %m Warning %d ",$time, warn_count );
|
end
|
end
|
endtask
|
endtask
|
|
|
task test_stats;
|
task test_stats;
|
begin
|
begin
|
$display ("\n-------------------------------------------------");
|
$display ("\n-------------------------------------------------");
|
$display ("Test Status");
|
$display ("Test Status");
|
$display ("warnings: %0d, errors: %0d",warn_count,err_count);
|
$display ("warnings: %0d, errors: %0d",warn_count,err_count);
|
end
|
end
|
endtask
|
endtask
|
|
|
task test_finish;
|
task test_finish;
|
begin
|
begin
|
test_stats;
|
test_stats;
|
if (err_count > 0) begin
|
if (err_count > 0) begin
|
test_fail;
|
test_fail;
|
end else begin
|
end else begin
|
test_pass;
|
test_pass;
|
end
|
end
|
#1 $finish;
|
#1 $finish;
|
end
|
end
|
endtask
|
endtask
|
|
|
endmodule
|
endmodule
|
|
|