Skip to content

Commit eeec988

Browse files
authored
Merge pull request #3082 from Pinata-Consulting/defs2stream-log-terser
def2stream: log cleanup, terser and removed debug progress statements
2 parents 7c94980 + c9b430f commit eeec988

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

flow/util/def2stream.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,43 +20,40 @@
2020
for i in main_layout.each_cell():
2121
print("[INFO] '{0}'".format(i.name))
2222

23-
print("[INFO] Reading DEF ...")
2423
main_layout.read(in_def, layoutOptions)
2524

2625
# Clear cells
2726
top_cell_index = main_layout.cell(design_name).cell_index()
2827

2928
# remove orphan cell BUT preserve cell with VIA_
3029
# - KLayout is prepending VIA_ when reading DEF that instantiates LEF's via
31-
print("[INFO] Clearing cells...")
3230
for i in main_layout.each_cell():
3331
if i.cell_index() != top_cell_index:
3432
if not i.name.startswith("VIA_") and not i.name.endswith("_DEF_FILL"):
3533
i.clear()
3634

3735
# Load in the gds to merge
38-
print("[INFO] Merging GDS/OAS files...")
3936
for fil in in_files.split():
4037
print("\t{0}".format(fil))
4138
main_layout.read(fil)
4239

4340
# Copy the top level only to a new layout
44-
print("[INFO] Copying toplevel cell '{0}'".format(design_name))
4541
top_only_layout = pya.Layout()
4642
top_only_layout.dbu = main_layout.dbu
4743
top = top_only_layout.create_cell(design_name)
4844
top.copy_tree(main_layout.cell(design_name))
4945

50-
print("[INFO] Checking for missing cell from GDS/OAS...")
5146
missing_cell = False
52-
regex = None
53-
if "GDS_ALLOW_EMPTY" in os.environ:
54-
print("[INFO] Found GDS_ALLOW_EMPTY variable.")
55-
regex = os.getenv("GDS_ALLOW_EMPTY")
47+
allow_empty = os.environ.get("GDS_ALLOW_EMPTY", "")
48+
regex = re.compile(allow_empty) if allow_empty else None
49+
50+
if allow_empty:
51+
print(f"[INFO] GDS_ALLOW_EMPTY={allow_empty}")
52+
5653
for i in top_only_layout.each_cell():
5754
if i.is_empty():
5855
missing_cell = True
59-
if regex is not None and re.match(regex, i.name):
56+
if regex is not None and regex.match(i.name):
6057
print(
6158
"[WARNING] LEF Cell '{0}' ignored. Matches GDS_ALLOW_EMPTY.".format(
6259
i.name
@@ -72,7 +69,6 @@
7269
if not missing_cell:
7370
print("[INFO] All LEF cells have matching GDS/OAS cells")
7471

75-
print("[INFO] Checking for orphan cell in the final layout...")
7672
orphan_cell = False
7773
for i in top_only_layout.each_cell():
7874
if i.name != design_name and i.parent_cells() == 0:
@@ -81,14 +77,12 @@
8177
errors += 1
8278

8379
if not orphan_cell:
84-
print("[INFO] No orphan cells")
80+
print("[INFO] No orphan cells in the final layout")
8581

8682

8783
if seal_file:
8884
top_cell = top_only_layout.top_cell()
8985

90-
print("[INFO] Reading seal GDS/OAS file...")
91-
print("\t{0}".format(seal_file))
9286
top_only_layout.read(seal_file)
9387

9488
for cell in top_only_layout.top_cells():
@@ -101,7 +95,6 @@
10195
top.insert(pya.CellInstArray(cell.cell_index(), pya.Trans()))
10296

10397
# Write out the GDS
104-
print("[INFO] Writing out GDS/OAS '{0}'".format(out_file))
10598
top_only_layout.write(out_file)
10699

107100
sys.exit(errors)

0 commit comments

Comments
 (0)