File: func_block.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 (33 lines) | stat: -rw-r--r-- 736 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
27
28
29
30
31
32
33
`default_nettype none

module func_block_top(inp, out1, out2, out3);
	input wire [31:0] inp;

	function automatic [31:0] func1;
		input [31:0] inp;
		reg [31:0] idx;
		for (idx = 0; idx < 32; idx = idx + 1) begin : blk
			func1[idx] = (idx & 1'b1) ^ inp[idx];
		end
	endfunction

	function automatic [31:0] func2;
		input [31:0] inp;
		reg [31:0] idx;
		for (idx = 0; idx < 32; idx = idx + 1) begin : blk
			func2[idx] = (idx & 1'b1) ^ inp[idx];
		end
	endfunction

	function automatic [31:0] func3;
		localparam A = 32 - 1;
		parameter B = 1 - 0;
		input [31:0] inp;
		func3[A:B] = inp[A:B];
	endfunction

	output wire [31:0] out1, out2, out3;
	assign out1 = func1(inp);
	assign out2 = func2(inp);
	assign out3 = func3(inp);
endmodule