Skip to content

Commit

Permalink
Add regression tests for issue #1143.
Browse files Browse the repository at this point in the history
  • Loading branch information
martinwhitaker committed Jul 9, 2024
1 parent 82a1223 commit cb6544f
Show file tree
Hide file tree
Showing 9 changed files with 142 additions and 0 deletions.
29 changes: 29 additions & 0 deletions ivtest/ivltests/br_gh1143a.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module test;

function integer count(input integer value);

integer i;

begin
i = 0;
for ( ; i < value; i = i + 1) begin
end
count = i;
end

endfunction

localparam integer c = count(10);

integer v;

initial begin
v = count(20);
$display(c,,v);
if (c === 10 && v === 20)
$display("PASSED");
else
$display("FAILED");
end

endmodule
29 changes: 29 additions & 0 deletions ivtest/ivltests/br_gh1143b.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module test;

function integer count(input integer value);

integer i;

begin
for (i = 0; ; i = i + 1) begin
if (i == value) break;
end
count = i;
end

endfunction

localparam integer c = count(10);

integer v;

initial begin
v = count(20);
$display(c,,v);
if (c === 10 && v === 20)
$display("PASSED");
else
$display("FAILED");
end

endmodule
29 changes: 29 additions & 0 deletions ivtest/ivltests/br_gh1143c.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module test;

function integer count(input integer value);

integer i;

begin
for (i = 0 ; i < value; ) begin
i = i + 1;
end
count = i;
end

endfunction

localparam integer c = count(10);

integer v;

initial begin
v = count(20);
$display(c,,v);
if (c === 10 && v === 20)
$display("PASSED");
else
$display("FAILED");
end

endmodule
31 changes: 31 additions & 0 deletions ivtest/ivltests/br_gh1143d.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module test;

function integer count(input integer value);

integer i;

begin
i = 0;
for ( ; ; ) begin
if (i == value) break;
i = i + 1;
end
count = i;
end

endfunction

localparam integer c = count(10);

integer v;

initial begin
v = count(20);
$display(c,,v);
if (c === 10 && v === 20)
$display("PASSED");
else
$display("FAILED");
end

endmodule
4 changes: 4 additions & 0 deletions ivtest/regress-vvp.list
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ br_gh1099b vvp_tests/br_gh1099b.json
br_gh1099c vvp_tests/br_gh1099c.json
br_gh1104 vvp_tests/br_gh1104.json
br_gh1122 vvp_tests/br_gh1122.json
br_gh1143a vvp_tests/br_gh1143a.json
br_gh1143b vvp_tests/br_gh1143b.json
br_gh1143c vvp_tests/br_gh1143c.json
br_gh1143d vvp_tests/br_gh1143d.json
ca_time_real` vvp_tests/ca_time_real.json
case1 vvp_tests/case1.json
case2 vvp_tests/case2.json
Expand Down
5 changes: 5 additions & 0 deletions ivtest/vvp_tests/br_gh1143a.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type" : "normal",
"source" : "br_gh1143a.v",
"iverilog-args" : [ "-g2012" ]
}
5 changes: 5 additions & 0 deletions ivtest/vvp_tests/br_gh1143b.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type" : "normal",
"source" : "br_gh1143b.v",
"iverilog-args" : [ "-g2012" ]
}
5 changes: 5 additions & 0 deletions ivtest/vvp_tests/br_gh1143c.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type" : "normal",
"source" : "br_gh1143c.v",
"iverilog-args" : [ "-g2012" ]
}
5 changes: 5 additions & 0 deletions ivtest/vvp_tests/br_gh1143d.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type" : "normal",
"source" : "br_gh1143d.v",
"iverilog-args" : [ "-g2012" ]
}

0 comments on commit cb6544f

Please sign in to comment.