|
12 | 12 | tech.load(tech_file) |
13 | 13 | layoutOptions = tech.load_layout_options |
14 | 14 | if len(layer_map) > 0: |
15 | | - layoutOptions.lefdef_config.map_file = layer_map |
| 15 | + layoutOptions.lefdef_config.map_file = layer_map |
16 | 16 |
|
17 | 17 | # Load def file |
18 | 18 | main_layout = pya.Layout() |
|
21 | 21 |
|
22 | 22 | print("[INFO] Reporting cells after loading DEF ...") |
23 | 23 | for i in main_layout.each_cell(): |
24 | | - print("[INFO] '{0}'".format(i.name)) |
| 24 | + print("[INFO] '{0}'".format(i.name)) |
25 | 25 |
|
26 | 26 | # Clear cells |
27 | 27 | top_cell_index = main_layout.cell(design_name).cell_index() |
|
30 | 30 | # - KLayout is prepending VIA_ when reading DEF that instantiates LEF's via |
31 | 31 | print("[INFO] Clearing cells...") |
32 | 32 | for i in main_layout.each_cell(): |
33 | | - if i.cell_index() != top_cell_index: |
34 | | - if not i.name.startswith("VIA_"): |
35 | | - i.clear() |
| 33 | + if i.cell_index() != top_cell_index: |
| 34 | + if not i.name.startswith("VIA_"): |
| 35 | + i.clear() |
36 | 36 |
|
37 | 37 | # Load in the gds to merge |
38 | 38 | print("[INFO] Merging GDS/OAS files...") |
39 | | -with open(gds_flist, 'rb') as file: |
| 39 | +with open(gds_flist, "rb") as file: |
40 | 40 | in_files_list = file.read() |
41 | 41 | for fil in in_files_list.split(): |
42 | | - print("\t{0}".format(fil)) |
43 | | - main_layout.read(fil) |
| 42 | + print("\t{0}".format(fil)) |
| 43 | + main_layout.read(fil) |
44 | 44 |
|
45 | 45 | # Copy the top level only to a new layout |
46 | 46 | print("[INFO] Copying toplevel cell '{0}'".format(design_name)) |
|
52 | 52 | print("[INFO] Checking for missing cell from GDS/OAS...") |
53 | 53 | missing_cell = False |
54 | 54 | regex = None |
55 | | -if 'GDS_ALLOW_EMPTY' in os.environ: |
| 55 | +if "GDS_ALLOW_EMPTY" in os.environ: |
56 | 56 | print("[INFO] Found GDS_ALLOW_EMPTY variable.") |
57 | | - regex = os.getenv('GDS_ALLOW_EMPTY') |
| 57 | + regex = os.getenv("GDS_ALLOW_EMPTY") |
58 | 58 | for i in top_only_layout.each_cell(): |
59 | | - if i.is_empty(): |
60 | | - missing_cell = True |
61 | | - if regex is not None and re.match(regex, i.name): |
62 | | - print("[WARNING] LEF Cell '{0}' ignored. Matches GDS_ALLOW_EMPTY.".format(i.name)) |
63 | | - else: |
64 | | - print("[ERROR] LEF Cell '{0}' has no matching GDS/OAS cell." |
65 | | - " Cell will be empty.".format(i.name)) |
66 | | - errors += 1 |
| 59 | + if i.is_empty(): |
| 60 | + missing_cell = True |
| 61 | + if regex is not None and re.match(regex, i.name): |
| 62 | + print( |
| 63 | + "[WARNING] LEF Cell '{0}' ignored. Matches GDS_ALLOW_EMPTY.".format( |
| 64 | + i.name |
| 65 | + ) |
| 66 | + ) |
| 67 | + else: |
| 68 | + print( |
| 69 | + "[ERROR] LEF Cell '{0}' has no matching GDS/OAS cell." |
| 70 | + " Cell will be empty.".format(i.name) |
| 71 | + ) |
| 72 | + errors += 1 |
67 | 73 |
|
68 | 74 | if not missing_cell: |
69 | | - print("[INFO] All LEF cells have matching GDS/OAS cells") |
| 75 | + print("[INFO] All LEF cells have matching GDS/OAS cells") |
70 | 76 |
|
71 | 77 | print("[INFO] Checking for orphan cell in the final layout...") |
72 | 78 | orphan_cell = False |
73 | 79 | for i in top_only_layout.each_cell(): |
74 | | - if i.name != design_name and i.parent_cells() == 0: |
75 | | - orphan_cell = True |
76 | | - print("[ERROR] Found orphan cell '{0}'".format(i.name)) |
77 | | - errors += 1 |
| 80 | + if i.name != design_name and i.parent_cells() == 0: |
| 81 | + orphan_cell = True |
| 82 | + print("[ERROR] Found orphan cell '{0}'".format(i.name)) |
| 83 | + errors += 1 |
78 | 84 |
|
79 | 85 | if not orphan_cell: |
80 | | - print("[INFO] No orphan cells") |
| 86 | + print("[INFO] No orphan cells") |
81 | 87 |
|
82 | 88 |
|
83 | 89 | # Write out the GDS |
|
0 commit comments