From f69daf4830b2c101cc0380a18bf5c86692888f12 Mon Sep 17 00:00:00 2001 From: Zachary Snow Date: Sat, 25 Jul 2020 10:16:12 -0600 Subject: Allow blocks with declarations within constant functions --- tests/various/const_func_block_var.v | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/various/const_func_block_var.v (limited to 'tests/various/const_func_block_var.v') 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 -- cgit v1.2.3