projects
/
yosys.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Added tests for attributes
[yosys.git]
/
tests
/
simple
/
scopes.v
1
module scopes_test_01(input [3:0] k, output reg [15:0] x, y);
2
function [15:0] func_01;
3
input [15:0] x, y;
4
begin
5
func_01 = x + y;
6
begin:blk
7
reg [15:0] x;
8
x = y;
9
func_01 = func_01 ^ x;
10
end
11
func_01 = func_01 ^ x;
12
end
13
endfunction
14
15
function [15:0] func_02;
16
input [15:0] x, y;
17
begin
18
func_02 = x - y;
19
begin:blk
20
reg [15:0] func_02;
21
func_02 = 0;
22
end
23
end
24
endfunction
25
26
task task_01;
27
input [3:0] a;
28
reg [15:0] y;
29
begin
30
y = a * 23;
31
x = x + y;
32
end
33
endtask
34
35
task task_02;
36
input [3:0] a;
37
begin:foo
38
reg [15:0] x, z;
39
x = y;
40
begin:bar
41
reg [15:0] x;
42
x = 77 + a;
43
z = -x;
44
end
45
y = x ^ z;
46
end
47
endtask
48
49
always @* begin
50
x = func_01(11, 22);
51
y = func_02(33, 44);
52
task_01(k);
53
task_02(k);
54
begin:foo
55
reg [15:0] y;
56
y = x;
57
y = y + k;
58
x = y;
59
end
60
x = func_01(y, x);
61
y = func_02(y, x);
62
end
63
endmodule