File: const_func_block_var.v

package info (click to toggle)
yosys 0.52-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 69,796 kB
  • sloc: ansic: 696,955; cpp: 239,736; python: 14,617; yacc: 3,529; sh: 2,175; makefile: 1,945; lex: 697; perl: 445; javascript: 323; tcl: 162; vhdl: 115
file content (26 lines) | stat: -rw-r--r-- 514 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module top(out);
	function integer operation;
		input integer num;
		localparam incr = 1;
		localparam mult = 1;
		begin
			operation = 0;
			begin : op_i
				integer i;
				for (i = 0; i * mult < 2; i = i + incr)
				begin : op_j
					integer j;
					localparam other_mult = 2;
					for (j = i; j < i * other_mult; j = j + incr)
						num = num + incr;
				end
				num = num * 2;
			end
			operation = num;
		end
	endfunction

	localparam res = operation(4);
	output wire [31:0] out;
	assign out = res;
endmodule