Commit 7f2fe54b by Zachary Snow

fix jump statement conversion

parent fb5fd393
......@@ -31,9 +31,15 @@ module top;
$display("test1: %b %b", 3'b0z1, test1(3'b0z1));
end
integer arr [] = { 32'd60, 32'd61, 32'd63 };
function test2;
input integer inp;
return inp inside { [16:23], [32:47] };
// TODO: Add support for array value ranges.
test2 = 0;
for (integer i = 0; i < 3; ++i)
if (inp == arr[i])
return 1'b1;
return test2 || inp inside { [16:23], [32:47] };
endfunction
initial begin
for (integer i = 0; i < 64; ++i)
......
......@@ -33,9 +33,17 @@ module top;
$display("test1: %b %b", 3'b0z1, test1(3'b0z1));
end
wire [0:2][31:0] arr;
assign arr = { 32'd60, 32'd61, 32'd63 };
function test2;
input integer inp;
test2 = (16 <= inp && inp <= 23) || (32 <= inp && inp <= 47);
integer i;
begin
test2 = 0;
for (i = 0; i < 3; ++i)
test2 = test2 || (inp == arr[i]);
test2 = test2 || (16 <= inp && inp <= 23) || (32 <= inp && inp <= 47);
end
endfunction
initial begin : foobar
integer i;
......
......@@ -3,25 +3,25 @@ module top;
task skip1;
$display("HELLO skip1");
return;
$display("UNREACHABLE");
$display("UNREACHABLE ", `__LINE__);
endtask
function void skip2;
$display("HELLO skip2");
return;
$display("UNREACHABLE");
$display("UNREACHABLE ", `__LINE__);
endfunction
function int skip3;
$display("HELLO skip3");
return 1;
$display("UNREACHABLE");
$display("UNREACHABLE ", `__LINE__);
endfunction
task skip4;
for (int i = 0; i < 10; ++i) begin
$display("HELLO skip4");
return;
$display("UNREACHABLE");
$display("UNREACHABLE ", `__LINE__);
end
$display("UNREACHABLE");
$display("UNREACHABLE ", `__LINE__);
endtask
task skip5;
for (int i = 0; i < 10; ++i) begin
......@@ -29,11 +29,36 @@ module top;
for (int j = 0; j < 10; ++j) begin
$display("HELLO skip5-2");
return;
$display("UNREACHABLE");
$display("UNREACHABLE ", `__LINE__);
end
$display("UNREACHABLE");
$display("UNREACHABLE ", `__LINE__);
end
$display("UNREACHABLE");
$display("UNREACHABLE ", `__LINE__);
endtask
task skip6;
for (int i = 0; i < 0; ++i) begin
$display("UNREACHABLE ", `__LINE__);
return;
end
$display("HELLO skip6");
endtask
task skip7;
begin
parameter x = 1;
$display("HELLO skip7");
if (x == 1) return;
$display("UNREACHABLE ", `__LINE__);
end
$display("UNREACHABLE ", `__LINE__);
endtask
task skip8;
begin
parameter x = 1;
$display("HELLO skip8-1");
if (x == 2) return;
$display("HELLO skip8-2");
end
$display("HELLO skip8-3");
endtask
initial begin
skip1;
......@@ -41,20 +66,23 @@ module top;
$display(skip3());
skip4;
skip5;
skip6;
skip7;
skip8;
end
initial
for (int i = 0; i < 10; ++i) begin
$display("Loop Y:", i);
continue;
$display("UNREACHABLE");
$display("UNREACHABLE ", `__LINE__);
end
initial
for (int i = 0; i < 10; ++i) begin
$display("Loop Z:", i);
break;
$display("UNREACHABLE");
$display("UNREACHABLE ", `__LINE__);
end
initial
......@@ -73,7 +101,7 @@ module top;
else begin
$display("Loop B-3:", i);
continue;
$display("UNREACHABLE");
$display("UNREACHABLE ", `__LINE__);
end
$display("Loop B:", i);
end
......
......@@ -22,12 +22,28 @@ module top;
$display("HELLO skip5-2");
end
endtask
task skip6;
$display("HELLO skip6");
endtask
task skip7;
$display("HELLO skip7");
endtask
task skip8;
begin
$display("HELLO skip8-1");
$display("HELLO skip8-2");
$display("HELLO skip8-3");
end
endtask
initial begin
skip1;
skip2;
$display(skip3(0));
skip4;
skip5;
skip6;
skip7;
skip8;
end
initial begin : loop_y
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment