Support using either .lyt or .lyp files for KLayout display properties in sc-show.
@@ -15,7 +15,16 @@ sc_stackup = sc_cfg['pdk']['stackup']['value'][0]
sc_mainlib = sc_cfg['asic']['targetlib']['value'][0]
sc_libtype = sc_cfg['library'][sc_mainlib]['arch']['value']
-tech_file = sc_cfg['pdk']['layermap']['klayout'][sc_stackup]['def']['gds']['value'][0]
+# The layermap may be provided as part of a KLayout tech file (.lyt),
+# or in the standalone format (.lyp).
+tech_filename = sc_cfg['pdk']['layermap']['klayout'][sc_stackup]['def']['gds']['value'][0]
+tech_file = None
+if tech_filename[-4:] == '.lyt':
+ # 'lyp_path' will be read out of the .lyt file later.
+ tech_file = tech_filename
+elif tech_filename[-4:] == '.lyp':
+ # Tech file will not be imported, only layermap properties.
+ lyp_path = tech_filename
macro_lefs = []
if 'macrolib' in sc_cfg['asic']:
@@ -23,8 +32,15 @@ if 'macrolib' in sc_cfg['asic']:
for lib in sc_macrolibs:
macro_lefs.append(sc_cfg['library'][lib]['lef']['value'][0])
+# Tech / library LEF files are optional.
+try:
tech_lef = sc_cfg['pdk']['aprtech']['klayout'][sc_stackup][sc_libtype]['lef']['value'][0]
+except:
+ tech_lef = None
+try:
lib_lef = sc_cfg['library'][sc_mainlib]['lef']['value'][0]
+except:
+ lib_lef = None
# Load KLayout technology file
tech = pya.Technology()
@@ -71,6 +87,7 @@ if tech_file and os.path.isfile(tech_file):
tech_file_dir = os.path.dirname(tech_file)
lyp_path = tech_file_dir + '/' + tech.layer_properties_file
+if lyp_path:
# Set layer properties -- setting second argument to True ensures things like
# KLayout's extra outline, blockage, and obstruction layers appear.
layout_view.load_layer_props(lyp_path, True)
