aboutsummaryrefslogtreecommitdiffstats
path: root/tests/various/hierarchy.sh
blob: 9dbd1c89f3c13f66c33cb1603523af5ec58ca14f (plain)
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
#!/usr/bin/env bash
# Simple test of hierarchy -auto-top.

set -e

echo -n "  TOP first - "
../../yosys -s - <<- EOY | grep "Automatically selected TOP as design top module"
  read_verilog << EOV
    module TOP(a, y);
      input a;
      output [31:0] y;

      aoi12 p [31:0] (a, y);
    endmodule

    module aoi12(a, y);
      input a;
      output y;
      assign y = ~a;
    endmodule
  EOV
  hierarchy -auto-top
EOY

echo -n "  TOP last - "
../../yosys -s - <<- EOY | grep "Automatically selected TOP as design top module"
  read_verilog << EOV
    module aoi12(a, y);
      input a;
      output y;
      assign y = ~a;
    endmodule

    module TOP(a, y);
      input a;
      output [31:0] y;

      aoi12 foo (a, y);
    endmodule
  EOV
  hierarchy -auto-top
EOY

echo -n "  no explicit top - "
../../yosys -s - <<- EOY | grep "Automatically selected noTop as design top module."
  read_verilog << EOV
    module aoi12(a, y);
      input a;
      output y;
      assign y = ~a;
    endmodule

    module noTop(a, y);
      input a;
      output [31:0] y;
      assign y = a;
    endmodule
  EOV
  hierarchy -auto-top
EOY