Fix normal (non-array) hierarchy -auto-top.
[yosys.git] / tests / various / hierarchy.sh
1 #!/usr/bin/env bash
2 # Simple test of hierarchy -auto-top.
3
4 set -e
5
6 ../../yosys -q -s - <<- EOY 2>&1 | grep "Automatically selected TOP as design top module"
7 read_verilog << EOV
8 module TOP(a, y);
9 input a;
10 output [31:0] y;
11
12 aoi12 p [31:0] (a, y);
13 endmodule
14
15 module aoi12(a, y);
16 input a;
17 output y;
18 assign y = ~a;
19 endmodule
20 EOV
21 hierarchy -auto-top
22 EOY
23
24 ../../yosys -q -s - <<- EOY 2>&1 | grep "Automatically selected TOP as design top module"
25 read_verilog << EOV
26 module aoi12(a, y);
27 input a;
28 output y;
29 assign y = ~a;
30 endmodule
31
32 module TOP(a, y);
33 input a;
34 output [31:0] y;
35
36 aoi12 foo (a, y);
37 endmodule
38 EOV
39 hierarchy -auto-top
40 EOY
41
42 ../../yosys -q -s - <<- EOY 2>&1 | grep "Automatically selected noTop as design top module."
43 read_verilog << EOV
44 module aoi12(a, y);
45 input a;
46 output y;
47 assign y = ~a;
48 endmodule
49
50 module noTop(a, y);
51 input a;
52 output [31:0] y;
53 endmodule
54 EOV
55 hierarchy -auto-top
56 EOY