Skip to content

Commit

Permalink
py: Import ihp_seal_ring pya script to add sealring to GDS
Browse files Browse the repository at this point in the history
Signed-off-by: Sylvain Munaut <[email protected]>
  • Loading branch information
smunaut committed Oct 30, 2024
1 parent f802763 commit 8dca575
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions py/ihp_seal_ring.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/usr/bin/env python3

#
# Adds seal ring to an iHP design using KLayout PCELL
# Copyright (c) 2024 htfab <[email protected]>
# Copyright (c) 2024 Sylvain Munaut <[email protected]>
#

import os
import sys

import click

import pya

# Add KLayout tech in path
TECH_DIR = os.path.join( os.getenv('PDK_ROOT'), os.getenv('PDK'), 'libs.tech/klayout' )
sys.path.append(f'{TECH_DIR}/python')
sys.path.append(f'{TECH_DIR}/python/pycell4klayout-api/source/python')

# Import PCell stuff
import sg13g2_pycell_lib
assert 'SG13_dev' in pya.Library.library_names()


@click.command()
@click.option("--input-gds")
@click.option("--output-gds")
@click.option("--die-width", type=float)
@click.option("--die-height", type=float)
def cli(input_gds, output_gds, die_width, die_height):

# Load input layout
layout = pya.Layout()
layout.read(input_gds)
top = layout.top_cell()

# Create the PCell
params = {
'l': f'{die_width-50.0:f}u',
'w': f'{die_height-50.0:f}u',
}

sealring_pcell = layout.create_cell('sealring', 'SG13_dev', params)
sealring_pcell_i = sealring_pcell.cell_index()
sealring_static_i = layout.convert_cell_to_static(sealring_pcell_i)
sealring_static = layout.cell(sealring_static_i)
layout.delete_cell(sealring_pcell_i)
layout.rename_cell(sealring_static_i, 'sealring')

# Insert seal ring cell
top.insert(pya.CellInstArray(sealring_static, pya.Trans(0, 0)))

# Save output layout
layout.write(output_gds)


if __name__ == "__main__":
cli()




0 comments on commit 8dca575

Please sign in to comment.