Skip to content

Commit

Permalink
add scripts to remove output drivers
Browse files Browse the repository at this point in the history
  • Loading branch information
watbulb committed Sep 8, 2024
1 parent e024e53 commit 2fcc35b
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ $(TARGET_MACRO):
# Conversion targets
#
$(GDS_MACROS_SRC):
./gds_add_pnb.py $@
./script/gds_add_pnb.py $@

$(GDS_MACRO_PATH)/%.gds: $(MAG_MACRO_PATH)/%.mag
$(info MAG -> GDS)
echo "gds write \"$@\"" | magic -rcfile $(PDK_MAGICRC) -noconsole -dnull $<
./gds_add_pnb.py $@
./script/gds_add_pnb.py $@

$(LEF_MACRO_PATH)/%.lef: $(MAG_MACRO_PATH)/%.mag
$(info MAG -> LEF)
Expand Down
Binary file modified gds/final/tt_um_macro_test_wrapper.gds
Binary file not shown.
File renamed without changes.
39 changes: 39 additions & 0 deletions script/gds_rm_outputs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env python3
import sys, os
import gdspy

BOUNDARY_LAYER = 235 # prBndry
BOUNDARY_DATATYPE = 4 # boundary

if __name__ == '__main__':

# Check args
if len(sys.argv) < 2:
print(f"{sys.argv[0]} <file.gds>")
print("warning: this script modifies the file in-place")
exit(1)

# Check filepath
filepath: str = sys.argv.pop()
if not os.path.isfile(filepath):
raise FileNotFoundError("unable to locate GDS file specified")

target_cellname: str = os.path.basename(filepath.split(".")[0])

# Load GDS
gdsii = gdspy.GdsLibrary(infile=filepath)
if not target_cellname in gdsii.cells:
raise RuntimeError("cannot locate a cell in the GDS file matching the filename")

# Delete output driver cells
target_cell: gdspy.Cell = gdsii.cells[target_cellname]
if "sky130_fd_sc_hd__buf_2" in gdsii.cells:
del gdsii.cells["sky130_fd_sc_hd__buf_2"]
print("removing: sky130_fd_sc_hd__buf_2")
if "sky130_fd_sc_hd__conb_1" in gdsii.cells:
del gdsii.cells["sky130_fd_sc_hd__conb_1"]
print("removing: sky130_fd_sc_hd__conb_1")

gdsii.write_gds(filepath)
print("Success")

File renamed without changes.

0 comments on commit 2fcc35b

Please sign in to comment.