aboutsummaryrefslogtreecommitdiffstats
path: root/tests/various/const_func_block_var.v
blob: 98e83aa5b7acd4a846fe8b07a852b4e39fac19f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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