Modified GF180MCU-GDS tech file to add some missing layers that
weren't being handled, and to add one alternate layer number for
"boundary" to the main GF180MCU tech file.  Added a patching
script to sky130 to fix the incorrect "related_bias_pin" entries
in the liberty files, which were inserted by the original audit
scripts that produced the open source version of the PDK.
diff --git a/VERSION b/VERSION
index 21bb8ce..f0f99b9 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.0.334
+1.0.335
diff --git a/gf180mcu/magic/gf180mcu.tech b/gf180mcu/magic/gf180mcu.tech
index ba9b5a9..9849fcd 100644
--- a/gf180mcu/magic/gf180mcu.tech
+++ b/gf180mcu/magic/gf180mcu.tech
@@ -2518,7 +2518,7 @@
  layer glass GLASS
  labels GLASS
 
- templayer cellbound BOUND
+ templayer cellbound BOUND,PRBOUND
  boundary
 
  layer lvstext TTEXT
@@ -2608,6 +2608,7 @@
  calma BJTDEF 118 5
  calma MOSCAP 166 5
  calma BOUND 0 0
+ calma PRBOUND 63 *
  calma FILLOBS  111 5
  calma FILLOBS2 152 5
  calma TTEXT    230 *
diff --git a/gf180mcu/magic/gf180mcugds.tech b/gf180mcu/magic/gf180mcugds.tech
index df96381..4dedfa0 100644
--- a/gf180mcu/magic/gf180mcugds.tech
+++ b/gf180mcu/magic/gf180mcugds.tech
@@ -45,6 +45,10 @@
  l34
  l35
  l36
+ l37
+ l38
+ l39
+ l40
 end
 
 types
@@ -84,6 +88,10 @@
  l34 DIODE,l34
  l35 RESDEF,l35
  l36 CAPDEF,l36
+ l37 V5DEF,l37
+ l38 SRAMDEF,l38
+ l39 BOUND,l39
+ l40 PWELL,l40
 end
 
 contact
@@ -127,6 +135,10 @@
  l34   pdop_stripes
  l35   pselect2
  l36   implant3
+ l37   implant1
+ l38   implant2
+ l39   subcircuit
+ l40   pwell
 end
 
 compose
@@ -144,6 +156,10 @@
  labels NWELL 
  calma 21 0
 
+ layer  PWELL PWELL
+ labels PWELL 
+ calma 204 0
+
  layer  COMP COMP
  labels COMP 
  calma 22 0
@@ -152,6 +168,14 @@
  labels DUALGATE 
  calma 55 0
 
+ layer  V5DEF V5DEF
+ labels V5DEF 
+ calma 112 1
+
+ layer  SRAMDEF SRAMDEF
+ labels SRAMDEF 
+ calma 108 5
+
  layer  POLY2 POLY2
  labels POLY2 
  calma 30 0
@@ -172,6 +196,10 @@
  labels PPLUS 
  calma 31 0
 
+ layer  BOUND BOUND
+ labels BOUND 
+ calma 63 63
+
  layer  CONTACT CONTACT
  labels CONTACT 
  calma 33 0
@@ -298,6 +326,10 @@
  labels NWELL 
  calma NWELL 21 0
 
+ layer  PWELL PWELL
+ labels PWELL 
+ calma PWELL 204 0
+
  layer  COMP COMP
  labels COMP 
  calma COMP 22 0
@@ -306,6 +338,14 @@
  labels DUALGATE 
  calma DUALGATE 55 0
 
+ layer  V5DEF V5DEF
+ labels V5DEF 
+ calma V5DEF 112 1
+
+ layer  SRAMDEF SRAMDEF
+ labels SRAMDEF 
+ calma SRAMDEF 108 5
+
  layer  POLY2 POLY2
  labels POLY2 
  calma POLY2 30 0
@@ -318,6 +358,10 @@
  labels ESD 
  calma ESD 24 0
 
+ layer  BOUND BOUND
+ labels BOUND 
+ calma BOUND 63 *
+
  layer  SAB SAB
  labels SAB 
  calma SAB 49 0
@@ -494,4 +538,8 @@
  planeorder l34 33
  planeorder l35 34
  planeorder l36 35
+ planeorder l37 36
+ planeorder l38 37
+ planeorder l39 38
+ planeorder l40 39
 end
diff --git a/sky130/Makefile.in b/sky130/Makefile.in
index da6e800..5ed5d4b 100644
--- a/sky130/Makefile.in
+++ b/sky130/Makefile.in
@@ -1343,6 +1343,7 @@
 		-doc %l/latest/cells/*/*.pdf \
 		-lib %l/latest/timing/*.lib filter=custom/scripts/add_wireloads.py \
 			filter=custom/scripts/fix_default_fanout_load.py \
+			filter=custom/scripts/fix_related_bias_pins.py \
 		-gds %l/latest/cells/*/*.gds compile-only \
 			no-copy=custom/sky130_fd_sc_hd/gds/sky130_fd*.gds \
 			include=custom/sky130_fd_sc_hd/gds/sky130_ef*.gds \
@@ -1398,6 +1399,7 @@
 		-doc %l/latest/cells/*/*.pdf \
 		-lib %l/latest/timing/*.lib filter=custom/scripts/add_wireloads.py \
 			filter=custom/scripts/fix_default_fanout_load.py \
+			filter=custom/scripts/fix_related_bias_pins.py \
 		-gds %l/latest/cells/*/*.gds compile-only \
 			options=custom/scripts/gds_import_setup.tcl \
 			sort=../common/sort_pdkfiles.py \
@@ -1438,6 +1440,7 @@
 		-doc %l/latest/cells/*/*.pdf \
 		-lib %l/latest/timing/*.lib filter=custom/scripts/add_wireloads.py \
 			filter=custom/scripts/fix_default_fanout_load.py \
+			filter=custom/scripts/fix_related_bias_pins.py \
 		-gds %l/latest/cells/*/*.gds compile-only \
 			include=custom/sky130_fd_sc_hvl/gds/sky130_ef*.gds \
 			options=custom/scripts/gds_import_setup.tcl \
@@ -1485,6 +1488,7 @@
 		-doc %l/latest/cells/*/*.pdf \
 		-lib %l/latest/timing/*.lib filter=custom/scripts/add_wireloads.py \
 			filter=custom/scripts/fix_default_fanout_load.py \
+			filter=custom/scripts/fix_related_bias_pins.py \
 		-gds %l/latest/cells/*/*.gds compile-only \
 			options=custom/scripts/gds_import_setup.tcl \
 			sort=../common/sort_pdkfiles.py \
@@ -1524,6 +1528,7 @@
 		-doc %l/latest/cells/*/*.pdf \
 		-lib %l/latest/timing/*.lib filter=custom/scripts/add_wireloads.py \
 			filter=custom/scripts/fix_default_fanout_load.py \
+			filter=custom/scripts/fix_related_bias_pins.py \
 		-gds %l/latest/cells/*/*.gds compile-only \
 			no-copy=custom/sky130_fd_sc_hs/gds/sky130_fd*.gds \
 			options=custom/scripts/gds_import_setup.tcl \
@@ -1560,6 +1565,7 @@
 		-doc %l/latest/cells/*/*.pdf \
 		-lib %l/latest/timing/*.lib filter=custom/scripts/add_wireloads.py \
 			filter=custom/scripts/fix_default_fanout_load.py \
+			filter=custom/scripts/fix_related_bias_pins.py \
 		-gds %l/latest/cells/*/*.gds compile-only \
 			options=custom/scripts/gds_import_setup.tcl \
 			sort=../common/sort_pdkfiles.py \
@@ -1595,6 +1601,7 @@
 		-doc %l/latest/cells/*/*.pdf \
 		-lib %l/latest/timing/*.lib filter=custom/scripts/add_wireloads.py \
 			filter=custom/scripts/fix_default_fanout_load.py \
+			filter=custom/scripts/fix_related_bias_pins.py \
 		-gds %l/latest/cells/*/*.gds compile-only \
 			options=custom/scripts/gds_import_setup.tcl \
 			sort=../common/sort_pdkfiles.py \
diff --git a/sky130/custom/scripts/fix_related_bias_pins.py b/sky130/custom/scripts/fix_related_bias_pins.py
new file mode 100755
index 0000000..9948008
--- /dev/null
+++ b/sky130/custom/scripts/fix_related_bias_pins.py
@@ -0,0 +1,104 @@
+#!/usr/bin/env python3
+#
+# fix_related_bias_pins.py ---
+#
+# All of the sky130 standard cell liberty files share an error
+# introduced by the audit script, which added "related_bias_pin"
+# entries for each cell.  All of them are wrong in that they
+# have VPB as the related bias for VGND and VNB as the related
+# bias for VPWR.  These need to be swapped.
+#
+# This script is a filter to be run by setting the name of this script as
+# the value to "filter=" for the lib install in the sky130 Makefile.
+
+import re
+import os
+import sys
+
+def filter(inname, outname):
+
+    # Read input
+    try:
+        with open(inname, 'r') as inFile:
+            stext = inFile.read()
+            slines = stext.splitlines()
+    except:
+        print('fix_related_bias_pins.py: failed to open ' + inname + ' for reading.', file=sys.stderr)
+        return 1
+
+    # Process input with regexp
+
+    fixedlines = []
+    modified = False
+    current_pin = ''
+
+    related_re = re.compile('\s*related_bias_pin\s*:\s*"(.+)"\s*;')
+    pg_re = re.compile('\s*pg_pin\s*\(\s*"(.+)"\s*\)\s*{')
+
+    for line in slines:
+        pmatch = pg_re.match(line)
+        if pmatch:
+            current_pin = pmatch.group(1)
+
+        rmatch = related_re.match(line)
+        if rmatch:
+            pin_str = rmatch.group(1)
+            if pin_str == 'VPB' and current_pin == 'VGND':
+                modified = True
+                line = line.replace(pin_str, 'VNB')
+            elif pin_str == 'VNB' and current_pin == 'VPWR':
+                modified = True
+                line = line.replace(pin_str, 'VPB')
+            else:
+                print('Warning: Unknown related bias pin ' + pin_str)
+            current_pin = ''
+
+        fixedlines.append(line)
+
+    # Write output
+    if outname == None:
+        for i in fixedlines:
+            print(i)
+    else:
+        # If the output is a symbolic link but no modifications have been made,
+        # then leave it alone.  If it was modified, then remove the symbolic
+        # link before writing.
+        if os.path.islink(outname):
+            if not modified:
+                return 0
+            else:
+                os.unlink(outname)
+        try:
+            with open(outname, 'w') as outFile:
+                for i in fixedlines:
+                    print(i, file=outFile)
+        except:
+            print('fix_related_bias_pins.py: failed to open ' + outname + ' for writing.', file=sys.stderr)
+            return 1
+
+
+if __name__ == '__main__':
+
+    # This script expects to get one or two arguments.  One argument is
+    # mandatory and is the input file.  The other argument is optional and
+    # is the output file.  The output file and input file may be the same
+    # name, in which case the original input is overwritten.
+
+    options = []
+    arguments = []
+    for item in sys.argv[1:]:
+        if item.find('-', 0) == 0:
+            options.append(item[1:])
+        else:
+            arguments.append(item)
+
+    if len(arguments) > 0:
+        infilename = arguments[0]
+
+    if len(arguments) > 1:
+        outfilename = arguments[1]
+    else:
+        outfilename = None
+
+    result = filter(infilename, outfilename)
+    sys.exit(result)
diff --git a/sky130/sky130.json b/sky130/sky130.json
index 5b08ba9..5767096 100644
--- a/sky130/sky130.json
+++ b/sky130/sky130.json
@@ -92,8 +92,8 @@
         "magic": "MAGIC_COMMIT"
     },
     "reference": {
-        "open_pdks": "cc0029b45c68137aa21323912f50d2fc17eeea13",
-        "magic": "5d51e10fb969b31e6e95b5fb78d21efeccc73c14",
+        "open_pdks": "82d61e2c9c265c0f0e994233cd2d024c90adb45f",
+        "magic": "7905e15ae3b66ed26349fb701b475ef93b566de5",
         "skywater_pdk": "f70d8ca46961ff92719d8870a18a076370b85f6c",
         "sky130_osu_sc_t12": "ac90ef0c622a9377a16b5218d9da3ac4169eeaaf",
         "sky130_osu_sc_t15": "95d1c19abb47e1b2945847acb4e817b1b8417c43",