File: scopes.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 (63 lines) | stat: -rw-r--r-- 903 bytes parent folder | download | duplicates (5)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
module scopes_test_01(input [3:0] k, output reg [15:0] x, y);
	function [15:0] func_01;
		input [15:0] x, y;
		begin
			func_01 = x + y;
			begin:blk
				reg [15:0] x;
				x = y;
				func_01 = func_01 ^ x;
			end
			func_01 = func_01 ^ x;
		end
	endfunction

	function [15:0] func_02;
		input [15:0] x, y;
		begin
			func_02 = x - y;
			begin:blk
				reg [15:0] func_02;
				func_02 = 0;
			end
		end
	endfunction

	task task_01;
		input [3:0] a;
		reg [15:0] y;
		begin
			y = a * 23;
			x = x + y;
		end
	endtask

	task task_02;
		input [3:0] a;
		begin:foo
			reg [15:0] x, z;
			x = y;
			begin:bar
				reg [15:0] x;
				x = 77 + a;
				z = -x;
			end
			y = x ^ z;
		end
	endtask

	always @* begin
		x = func_01(11, 22);
		y = func_02(33, 44);
		task_01(k);
		task_02(k);
		begin:foo
			reg [15:0] y;
			y = x;
			y = y + k;
			x = y;
		end
		x = func_01(y, x);
		y = func_02(y, x);
	end
endmodule