aboutsummaryrefslogtreecommitdiffstats
path: root/tests/various/const_func_block_var.v
diff options
context:
space:
mode:
authorZachary Snow <zach@zachjs.com>2020-07-25 10:16:12 -0600
committerZachary Snow <zach@zachjs.com>2020-07-25 10:16:12 -0600
commitf69daf4830b2c101cc0380a18bf5c86692888f12 (patch)
tree2deed8c8987a724c16dd476e1deb1dfbeb939b74 /tests/various/const_func_block_var.v
parentdafe04d5590412cc8a95bee31810d96a358af3dd (diff)
downloadyosys-f69daf4830b2c101cc0380a18bf5c86692888f12.tar.gz
yosys-f69daf4830b2c101cc0380a18bf5c86692888f12.tar.bz2
yosys-f69daf4830b2c101cc0380a18bf5c86692888f12.zip
Allow blocks with declarations within constant functions
Diffstat (limited to 'tests/various/const_func_block_var.v')
-rw-r--r--tests/various/const_func_block_var.v23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/various/const_func_block_var.v b/tests/various/const_func_block_var.v
new file mode 100644
index 000000000..98e83aa5b
--- /dev/null
+++ b/tests/various/const_func_block_var.v
@@ -0,0 +1,23 @@
+module top(out);
+ function integer operation;
+ input integer num;
+ begin
+ operation = 0;
+ begin : op_i
+ integer i;
+ for (i = 0; i < 2; i = i + 1)
+ begin : op_j
+ integer j;
+ for (j = i; j < i * 2; j = j + 1)
+ num = num + 1;
+ end
+ num = num * 2;
+ end
+ operation = num;
+ end
+ endfunction
+
+ localparam res = operation(4);
+ output wire [31:0] out;
+ assign out = res;
+endmodule