Рефактор Debug manual

This commit is contained in:
Andrei Solodovnikov
2024-01-31 13:14:29 +03:00
parent da42b209ef
commit 01d262c860
37 changed files with 155 additions and 65 deletions

View File

@@ -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;

View File

@@ -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