Modified sky130.tech magic techfile to add nwell and pwell as
masterslice layers to the LEF input setup; this should resolve
issues with the VNB and VPB pins in standard cells. Along with
that, committed a script to correct the layers assigned to VNB
and VPB in the original sources.
diff --git a/VERSION b/VERSION
index b0f3d96..66c4c22 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.0.8
+1.0.9
diff --git a/sky130/custom/scripts/vpb_vnb_convert.py b/sky130/custom/scripts/vpb_vnb_convert.py
new file mode 100755
index 0000000..db781e3
--- /dev/null
+++ b/sky130/custom/scripts/vpb_vnb_convert.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python3
+#
+# Convert VNB and VPB layers in a LEF file from "li1" or "met1" to
+# "pwell" and "nwell" masterslice layers, as they should be.
+#
+
+import os
+import sys
+import re
+
+if len(sys.argv) < 3:
+ print("Usage: vpb_vnb_convert.py <lef_file_in> <lef_file_out>")
+ sys.exit(1)
+
+lef_file_in = sys.argv[1]
+lef_file_out = sys.argv[2]
+
+print("Input: " + lef_file_in)
+print("Output: " + lef_file_out)
+
+with open(lef_file_in, 'r') as ifile:
+ leflines = ifile.read().splitlines()
+
+layrex = re.compile('[ \t]*LAYER[ \t]+([^ \t]+)[ \t]+;')
+pinrex = re.compile('[ \t]*PIN[ \t]+([^ \t\n]+)')
+endrex = re.compile('[ \t]*END[ \t]+([^ \t\n]+)')
+subrex = re.compile('([ \t]*LAYER[ \t]+)([^ \t]+)([ \t]+;)')
+
+vpbpin = False
+vnbpin = False
+
+linesout = []
+
+for line in leflines:
+ lineout = line
+
+ lmatch = layrex.match(line)
+ pmatch = pinrex.match(line)
+ ematch = endrex.match(line)
+
+ if pmatch:
+ pinname = pmatch.group(1)
+
+ if pinname == 'VNB':
+ vnbpin = True
+ elif pinname == 'VPB':
+ vpbpin = True
+
+ elif ematch:
+ pinname = ''
+ vnbpin = False
+ vpbpin = False
+
+ elif lmatch:
+ if vpbpin:
+ lineout = subrex.sub(r'\1nwell\3', line)
+ elif vnbpin:
+ lineout = subrex.sub(r'\1pwell\3', line)
+
+ linesout.append(lineout)
+
+with open(lef_file_out, 'w') as ofile:
+ for line in linesout:
+ print(line, file=ofile)
diff --git a/sky130/magic/sky130.tech b/sky130/magic/sky130.tech
index 1bbf877..7f23296 100644
--- a/sky130/magic/sky130.tech
+++ b/sky130/magic/sky130.tech
@@ -3446,9 +3446,8 @@
lef
- masterslice pwell substrate
- masterslice nwell nwell
- masterslice poly poly
+ masterslice pwell pwell PWELL substrate
+ masterslice nwell nwell NWELL
routing li li1 LI1 LI li