Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasc-ubc committed Jan 7, 2018
1 parent e30c025 commit e1f9987
Show file tree
Hide file tree
Showing 6 changed files with 427 additions and 427 deletions.
Original file line number Diff line number Diff line change
@@ -1,155 +1,155 @@
<?xml version="1.0" encoding="utf-8"?>
<klayout-macro>
<description>Verification: Layout check (graphical)</description>
<version>0.1.2</version>
<category>pymacros</category>
<prolog/>
<epilog/>
<doc/>
<autorun>false</autorun>
<autorun-early>false</autorun-early>
<shortcut>V</shortcut>
<show-in-menu>true</show-in-menu>
<group-name/>
<menu-path>siepic_menu.verification_submenu.end</menu-path>
<interpreter>python</interpreter>
<dsl-interpreter-name/>
<text># Python script
# SiEPIC_EBeam_Verification

"""
This file is part of the SiEPIC_EBeam_PDK
by Lukas Chrostowski (c) 2015

This Python file implements layout verification and netlist extraction
displays results in Marker Database Browser, using Results Database (rdb)

Version history:

Lukas Chrostowski 2015/11/11
- Optical_net class
- find all LayerSi paths and waveguides, and save optical net vertices
- find all PinRec paths
- find all DevRec polygons and boxes
- check_waveguides
- waveguide bend minimum
- paths with corners (more than 2 points)
- bend radius less than specified
- error marker layer and class; clear errors

Lukas Chrostowski 2015/11/12
- determining where pins/waveguides overlap to generate a netlist
- initial Spice output for components including waveguides and nets.
- check nets &amp; components
- incorrect number of nets connected to a component (disconnected, or too many)

Lukas Chrostowski 2015/11/15
- fix for Python 3.4: print("xxx")
- moved some functions from here, to the common "SiEPIC_EBeam_functions file, so they are accessible elsewhere.
- added pin# text label on PinRec layer; sort pins in Spice output using these names.

Lukas Chrostowski 2015/11/16
- fixes for component pin_type = Optical IO / FbrTgt being incorrectly handled; added Optical_pin.pin_type

Lukas Chrostowski 2015/11/17
- debugging &amp; fixing Verification problems

Lukas Chrostowski 2015/11/18
- removed need for numpy.array

Lukas Chrostowski 2015/11/19
- moved some functions to SiEPIC_EBeam_functions

Lukas Chrostowski 2015/11/21
- adding Results Database (rdb) and Marker Database Browser, for error viewing



"""

# ************************************************************************
# ************************************************************************
# Main script:
# ************************************************************************
# ************************************************************************


# Configure variables to draw structures in the presently selected cell:
lv = pya.Application.instance().main_window().current_view()
if lv == None:
raise Exception("No view selected")
# Find the currently selected layout.
layout = pya.Application.instance().main_window().current_view().active_cellview().layout()
if layout == None:
raise Exception("No layout")
cv = pya.Application.instance().main_window().current_view().active_cellview()
# find the currently selected cell:
topcell = pya.Application.instance().main_window().current_view().active_cellview().cell
if topcell == None:
raise Exception("No cell")
# fetch the database parameters
dbu = layout.dbu

# Define layers based on PDK_functions:
LayerSiN = layout.layer(LayerSi)
LayerTextN = layout.layer(LayerText)
LayerPinRecN = layout.layer(LayerPinRec)
LayerDevRecN = layout.layer(LayerDevRec)
LayerFbrTgtN = layout.layer(LayerFbrTgt)
LayerErrorN = layout.layer(LayerError)
LayerINTERCONNECTN = layout.layer(LayerINTERCONNECT)


# initialize the arrays to keep track of layout objects
reset_Optical_classes()
optical_components = []
optical_waveguides = []
optical_pins = []
optical_nets = []
layout_errors=[]

# Create a Results Database
rdb_i = lv.create_rdb("SiEPIC_Verification")
rdb = lv.rdb(rdb_i)
rdb.top_cell_name = topcell.name
rdb_cell = rdb.create_cell(topcell.name)


if 'wtext' in globals():
# don't use the text window for output.
del(wtext)

# Search the layout for the components and waveguides:
# Search the arrays to identify all the nets:
optical_waveguides, optical_components = netlist_extraction(topcell)[:2]


# ********* Verification *********
# Check the layout for errors, using the above arrays:
print("")
print("Checking layout for errors: ")
# Check components - overlapping
number_errors = check_components(rdb, topcell, LayerDevRecN)
# Check waveguides for waveguide-specific problems:
number_errors += check_waveguides(rdb, optical_waveguides, topcell, LayerErrorN)
# Check connectivity between components and waveguides:
number_errors += check_connectivity(rdb, optical_components, topcell, LayerErrorN)
lv.add_missing_layers()
print("*** Number of errors found: %s." % len(layout_errors) )
print("*** Number of errors found: %s." % number_errors )


print("")
print("Done. ")
print("")


#displays results in Marker Database Browser, using Results Database (rdb)
if number_errors&gt;0:
v = pya.MessageBox.warning("Errors", "%s layout errors detected. \nPlease review errors using the 'Marker Database Browser'." % number_errors, pya.MessageBox.Ok)
lv.show_rdb(rdb_i, cv.cell_index)
else:
v = pya.MessageBox.warning("Errors", "No layout errors detected.", pya.MessageBox.Ok)

</text>
</klayout-macro>
<?xml version="1.0" encoding="utf-8"?>
<klayout-macro>
<description>Verification: Layout check (graphical)</description>
<version>0.1.2</version>
<category>pymacros</category>
<prolog/>
<epilog/>
<doc/>
<autorun>false</autorun>
<autorun-early>false</autorun-early>
<shortcut>V</shortcut>
<show-in-menu>true</show-in-menu>
<group-name/>
<menu-path>siepic_menu.verification_submenu.end</menu-path>
<interpreter>python</interpreter>
<dsl-interpreter-name/>
<text># Python script
# SiEPIC_EBeam_Verification

"""
This file is part of the SiEPIC_EBeam_PDK
by Lukas Chrostowski (c) 2015

This Python file implements layout verification and netlist extraction
displays results in Marker Database Browser, using Results Database (rdb)

Version history:

Lukas Chrostowski 2015/11/11
- Optical_net class
- find all LayerSi paths and waveguides, and save optical net vertices
- find all PinRec paths
- find all DevRec polygons and boxes
- check_waveguides
- waveguide bend minimum
- paths with corners (more than 2 points)
- bend radius less than specified
- error marker layer and class; clear errors

Lukas Chrostowski 2015/11/12
- determining where pins/waveguides overlap to generate a netlist
- initial Spice output for components including waveguides and nets.
- check nets &amp; components
- incorrect number of nets connected to a component (disconnected, or too many)

Lukas Chrostowski 2015/11/15
- fix for Python 3.4: print("xxx")
- moved some functions from here, to the common "SiEPIC_EBeam_functions file, so they are accessible elsewhere.
- added pin# text label on PinRec layer; sort pins in Spice output using these names.

Lukas Chrostowski 2015/11/16
- fixes for component pin_type = Optical IO / FbrTgt being incorrectly handled; added Optical_pin.pin_type

Lukas Chrostowski 2015/11/17
- debugging &amp; fixing Verification problems

Lukas Chrostowski 2015/11/18
- removed need for numpy.array

Lukas Chrostowski 2015/11/19
- moved some functions to SiEPIC_EBeam_functions

Lukas Chrostowski 2015/11/21
- adding Results Database (rdb) and Marker Database Browser, for error viewing



"""

# ************************************************************************
# ************************************************************************
# Main script:
# ************************************************************************
# ************************************************************************


# Configure variables to draw structures in the presently selected cell:
lv = pya.Application.instance().main_window().current_view()
if lv == None:
raise Exception("No view selected")
# Find the currently selected layout.
layout = pya.Application.instance().main_window().current_view().active_cellview().layout()
if layout == None:
raise Exception("No layout")
cv = pya.Application.instance().main_window().current_view().active_cellview()
# find the currently selected cell:
topcell = pya.Application.instance().main_window().current_view().active_cellview().cell
if topcell == None:
raise Exception("No cell")
# fetch the database parameters
dbu = layout.dbu

# Define layers based on PDK_functions:
LayerSiN = layout.layer(LayerSi)
LayerTextN = layout.layer(LayerText)
LayerPinRecN = layout.layer(LayerPinRec)
LayerDevRecN = layout.layer(LayerDevRec)
LayerFbrTgtN = layout.layer(LayerFbrTgt)
LayerErrorN = layout.layer(LayerError)
LayerINTERCONNECTN = layout.layer(LayerINTERCONNECT)


# initialize the arrays to keep track of layout objects
reset_Optical_classes()
optical_components = []
optical_waveguides = []
optical_pins = []
optical_nets = []
layout_errors=[]

# Create a Results Database
rdb_i = lv.create_rdb("SiEPIC_Verification")
rdb = lv.rdb(rdb_i)
rdb.top_cell_name = topcell.name
rdb_cell = rdb.create_cell(topcell.name)


if 'wtext' in globals():
# don't use the text window for output.
del(wtext)

# Search the layout for the components and waveguides:
# Search the arrays to identify all the nets:
optical_waveguides, optical_components = netlist_extraction(topcell)[:2]


# ********* Verification *********
# Check the layout for errors, using the above arrays:
print("")
print("Checking layout for errors: ")
# Check components - overlapping
number_errors = check_components(rdb, topcell, LayerDevRecN)
# Check waveguides for waveguide-specific problems:
number_errors += check_waveguides(rdb, optical_waveguides, topcell, LayerErrorN)
# Check connectivity between components and waveguides:
number_errors += check_connectivity(rdb, optical_components, topcell, LayerErrorN)
lv.add_missing_layers()
print("*** Number of errors found: %s." % len(layout_errors) )
print("*** Number of errors found: %s." % number_errors )


print("")
print("Done. ")
print("")


#displays results in Marker Database Browser, using Results Database (rdb)
if number_errors&gt;0:
v = pya.MessageBox.warning("Errors", "%s layout errors detected. \nPlease review errors using the 'Marker Database Browser'." % number_errors, pya.MessageBox.Ok)
lv.show_rdb(rdb_i, cv.cell_index)
else:
v = pya.MessageBox.warning("Errors", "No layout errors detected.", pya.MessageBox.Ok)

</text>
</klayout-macro>
Loading

0 comments on commit e1f9987

Please sign in to comment.