mirror of
https://github.com/MPSU/APS.git
synced 2025-09-15 09:10:10 +00:00
Рефактор Debug manual
This commit is contained in:
@@ -5,7 +5,7 @@ module max_min(
|
||||
output logic [ 3:0] min
|
||||
);
|
||||
|
||||
always_comb @(*) begin
|
||||
always_comb begin
|
||||
if(a > b) begin
|
||||
max = a;
|
||||
min = b;
|
||||
|
@@ -10,8 +10,9 @@ vector_abs dut(
|
||||
.abs(res)
|
||||
);
|
||||
integer err_count = 0;
|
||||
task checker(input [31:0]a, b, res);
|
||||
begin : checker
|
||||
|
||||
task check_result(input logic [31:0]a, b, res);
|
||||
begin : check_result
|
||||
reg [31:0] ref_res;
|
||||
ref_res = a < b? a/2 + b : a + b/2;
|
||||
if (res !== ref_res) begin
|
||||
@@ -30,22 +31,22 @@ initial begin : test
|
||||
$timeformat(-9,0,"ns");
|
||||
a = 0; b = 0;
|
||||
#5;
|
||||
checker(a,b,res);
|
||||
check_result(a,b,res);
|
||||
|
||||
|
||||
a = 1; b = 1;
|
||||
#5;
|
||||
checker(a,b,res);
|
||||
check_result(a,b,res);
|
||||
|
||||
a = 3; b = 4;
|
||||
#5;
|
||||
checker(a,b,res);
|
||||
check_result(a,b,res);
|
||||
|
||||
|
||||
for(i = 0; i < 100; i=i+1) begin
|
||||
a = $random()&32'hff; b = $random()&32'hff;
|
||||
#5;
|
||||
checker(a,b,res);
|
||||
check_result(a,b,res);
|
||||
end
|
||||
|
||||
$display("Test has been finished with %d errors", err_count);
|
||||
@@ -54,4 +55,4 @@ initial begin : test
|
||||
end
|
||||
$finish();
|
||||
end
|
||||
endmodule
|
||||
endmodule
|
||||
|
Reference in New Issue
Block a user