aboutsummaryrefslogtreecommitdiffstats
path: root/tests/verilog
diff options
context:
space:
mode:
Diffstat (limited to 'tests/verilog')
-rw-r--r--tests/verilog/for_decl_no_init.ys9
-rw-r--r--tests/verilog/for_decl_no_sv.ys9
-rw-r--r--tests/verilog/for_decl_shadow.sv32
-rw-r--r--tests/verilog/for_decl_shadow.ys6
4 files changed, 56 insertions, 0 deletions
diff --git a/tests/verilog/for_decl_no_init.ys b/tests/verilog/for_decl_no_init.ys
new file mode 100644
index 000000000..68c1584e0
--- /dev/null
+++ b/tests/verilog/for_decl_no_init.ys
@@ -0,0 +1,9 @@
+logger -expect error "For loop variable declaration is missing initialization!" 1
+read_verilog -sv <<EOT
+module top;
+ integer z;
+ initial
+ for (integer i; i < 10; i = i + 1)
+ z = i;
+endmodule
+EOT
diff --git a/tests/verilog/for_decl_no_sv.ys b/tests/verilog/for_decl_no_sv.ys
new file mode 100644
index 000000000..34edddff7
--- /dev/null
+++ b/tests/verilog/for_decl_no_sv.ys
@@ -0,0 +1,9 @@
+logger -expect error "For loop inline variable declaration is only supported in SystemVerilog mode!" 1
+read_verilog <<EOT
+module top;
+ integer z;
+ initial
+ for (integer i = 1; i < 10; i = i + 1)
+ z = i;
+endmodule
+EOT
diff --git a/tests/verilog/for_decl_shadow.sv b/tests/verilog/for_decl_shadow.sv
new file mode 100644
index 000000000..f6948f97e
--- /dev/null
+++ b/tests/verilog/for_decl_shadow.sv
@@ -0,0 +1,32 @@
+module gate(x);
+ output reg [15:0] x;
+ if (1) begin : gen
+ integer x;
+ initial begin
+ for (integer x = 5; x < 10; x++)
+ if (x == 5)
+ gen.x = 0;
+ else
+ gen.x += 2 ** x;
+ x = x * 2;
+ end
+ end
+ initial x = gen.x;
+endmodule
+
+module gold(x);
+ output reg [15:0] x;
+ if (1) begin : gen
+ integer x;
+ integer z;
+ initial begin
+ for (z = 5; z < 10; z++)
+ if (z == 5)
+ x = 0;
+ else
+ x += 2 ** z;
+ x = x * 2;
+ end
+ end
+ initial x = gen.x;
+endmodule
diff --git a/tests/verilog/for_decl_shadow.ys b/tests/verilog/for_decl_shadow.ys
new file mode 100644
index 000000000..d2dca715e
--- /dev/null
+++ b/tests/verilog/for_decl_shadow.ys
@@ -0,0 +1,6 @@
+read_verilog -sv for_decl_shadow.sv
+hierarchy
+proc
+equiv_make gold gate equiv
+equiv_simple
+equiv_status -assert