Skip to content

Commit

Permalink
Pin verification #215 (fix)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasc-ubc committed Jul 18, 2024
1 parent 0f4d0d2 commit 4cf1be8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 27 deletions.
51 changes: 25 additions & 26 deletions klayout_dot_config/python/SiEPIC/verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,32 +412,31 @@ def layout_check(cell=None, verbose=False, GUI=False, timing=False, file_rdb = N
# check all the component's pins to check if they are assigned a net:
r1 = pya.Region(c.polygon) # Component's DevRec region
for pin in c.pins:
if pin.type == _globals.PIN_TYPES.OPTICAL and pin.net.idx == None:
# disconnected optical pin
if verbose:
print(" - Found disconnected pin, type %s, at (%s)" % (pin.type, pin.center))
pin.display()
rdb_item = rdb.create_item(rdb_cell.rdb_id(), rdb_cat_id_discpin.rdb_id())
rdb_item.add_value(pya.RdbItemValue(pin.path.to_dtype(dbu)))

# Check for pin errors, facing the wrong way in the Component
# *****
pts = pin.path.get_points()[0]
px, py = pts.x, pts.y
test_box = pya.Box(px - 1, py - 1, px + 1, py + 1)
r2 = pya.Region(test_box)
polygon_and = [p for p in r1 & r2]
if not polygon_and:
# Pin's first point is not inside the DevRec
test_box = pya.Box(px - 5, py - 5, px + 5, py + 5)
rdb_item = rdb.create_item(rdb_cell.rdb_id(), rdb_cat_id_comp_pinerrors.rdb_id())
rdb_item.add_value(pya.RdbItemValue(pya.Polygon(test_box).to_dtype(dbu)))
rdb_item.add_value(pya.RdbItemValue(
"The components with the pin problem is: " + c.component))
if verbose:
print (str(test_box))


if pin.type == _globals.PIN_TYPES.OPTICAL:
if pin.net.idx == None:
# disconnected optical pin
if verbose:
print(" - Found disconnected pin, type %s, at (%s)" % (pin.type, pin.center))
pin.display()
rdb_item = rdb.create_item(rdb_cell.rdb_id(), rdb_cat_id_discpin.rdb_id())
rdb_item.add_value(pya.RdbItemValue(pin.path.to_dtype(dbu)))

# Check for pin errors, facing the wrong way in the Component
# *****
pts = pin.path.get_points()[0]
px, py = pts.x, pts.y
test_box = pya.Box(px - 1, py - 1, px + 1, py + 1)
r2 = pya.Region(test_box)
polygon_and = [p for p in r1 & r2]
if not polygon_and:
# Pin's first point is not inside the DevRec
test_box = pya.Box(px - 5, py - 5, px + 5, py + 5)
rdb_item = rdb.create_item(rdb_cell.rdb_id(), rdb_cat_id_comp_pinerrors.rdb_id())
rdb_item.add_value(pya.RdbItemValue(pya.Polygon(test_box).to_dtype(dbu)))
rdb_item.add_value(pya.RdbItemValue(
"The components with the pin problem is: " + c.component))
if verbose:
print (str(test_box))

# Verification: overlapping components (DevRec)
# automatically takes care of waveguides crossing other waveguides & components
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def example_circuit():
print (text)

# Verify
num_errors = layout_check(cell=cell, verbose=True, GUI=True)
num_errors = layout_check(cell=cell, verbose=False, GUI=True)
print('Number of errors: %s' % num_errors)

# Netlist
Expand Down

0 comments on commit 4cf1be8

Please sign in to comment.