Fixed the preproc.py script to be able to handle non-ASCII data,
as some files like the klayout files are using UTF-8 encoding, and
the last update to a klayout file broke the open_pdks install.  For
now, this is an option to the preprocessor script ('-utf'), but it
could and probably should just be the default setting.  Likewise
modified the staging install script so that substitutions can be
made on files containing the occasional non-ASCII characters.  Also
in this update:  Corrections to the handling of RERAM in the magic
techfile.
diff --git a/common/preproc.py b/common/preproc.py
index 9612921..15f0ecf 100755
--- a/common/preproc.py
+++ b/common/preproc.py
@@ -164,7 +164,7 @@
             newkeys.append(keyword)
     return newkeys
 
-def runpp(keys, keyrex, defines, ccomm, incdirs, inputfile, ofile):
+def runpp(keys, keyrex, defines, ccomm, utf, incdirs, inputfile, ofile):
 
     includerex = re.compile('^[ \t]*#include[ \t]+"*([^ \t\n\r"]+)')
     definerex = re.compile('^[ \t]*#define[ \t]+([^ \t]+)[ \t]+(.+)')
@@ -196,7 +196,10 @@
 
     ifile = False
     try:
-        ifile = open(inputfile, 'r')
+        if not utf:
+            ifile = open(inputfile, 'r')
+        else:
+            ifile = open(inputfile, 'r', encoding='utf-8', errors='replace')
     except FileNotFoundError:
         for dir in incdirs:
             try:
@@ -488,7 +491,10 @@
                 break
                 
         # Output the line
-        print(line, file=ofile, end='')
+        if not utf:
+            print(line, file=ofile, end='')
+        else:
+            ofile.write(line.encode('utf-8'))
 
     if ifblock != -1 or ifstack != []:
         print("Error:  input file ended with an unterminated #if block.", file=sys.stderr)
@@ -535,6 +541,7 @@
     incdirs = []
     ccomm = False
     quiet = False
+    utf = False
     for item in options:
         result = item.split('=')
         if result[0] == '-help':
@@ -544,6 +551,8 @@
             ccomm = True
         elif result[0] == '-quiet':
             quiet = True
+        elif result[0] == '-utf8':
+            utf = True
         elif result[0][0:2] == '-I':
             incdirs.append(result[0][2:])
         elif result[0][0:2] == '-D':
@@ -557,7 +566,7 @@
             keys.append(keyword)
             keys = sortkeys(keys)
         else:
-            print('Bad option ' + item + ', options are -help, -quiet, -ccomm, -D<def> -I<dir>\n')
+            print('Bad option ' + item + ', options are -help, -quiet, -ccomm, -utf8, -D<def> -I<dir>\n')
             sys.exit(1)
 
     if not os.path.isfile(inputfile):
@@ -567,7 +576,10 @@
             sys.exit(0)
 
     if outputfile:
-        ofile = open(outputfile, 'w')
+        if not utf:
+            ofile = open(outputfile, 'w')
+        else:
+            ofile = open(outputfile, 'wb')
     else:
         ofile = sys.stdout
 
@@ -581,7 +593,7 @@
 
     keys = sortkeys(keys)
 
-    runpp(keys, keyrex, defines, ccomm, incdirs, inputfile, ofile)
+    runpp(keys, keyrex, defines, ccomm, utf, incdirs, inputfile, ofile)
     if ofile != sys.stdout:
         ofile.close()
 
diff --git a/common/staging_install.py b/common/staging_install.py
index 7f4f15e..ac977f7 100755
--- a/common/staging_install.py
+++ b/common/staging_install.py
@@ -117,9 +117,9 @@
         elif os.path.isdir(filepath):
             total += filter_recursive(filepath, stagingdir, finaldir)
         else:
-            with open(filepath, 'r') as ifile:
+            with open(filepath, 'r', encoding='utf-8', errors='replace') as ifile:
                 try:
-                    flines = ifile.read().splitlines()
+                    flines = ifile.readlines()
                 except UnicodeDecodeError:
                     print('Failure to read file ' + filepath + '; non-ASCII content.')
                     continue
@@ -128,11 +128,11 @@
             makeuserwritable(filepath)
 
             modified = False
-            with open(filepath, 'w') as ofile:
+            with open(filepath, 'wb') as ofile:
                 for line in flines:
                     newline = line.replace(stagingdir, finaldir)
                     newline = newline.replace(stagingparent, localparent)
-                    print(newline, file=ofile)
+                    ofile.write(newline.encode('utf-8'))
                     if newline != line:
                         modified = True
 
diff --git a/scripts/configure b/scripts/configure
index 45ef4e1..5ccc6d5 100755
--- a/scripts/configure
+++ b/scripts/configure
@@ -637,7 +637,6 @@
 docdir
 oldincludedir
 includedir
-runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -719,7 +718,6 @@
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
-runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -972,15 +970,6 @@
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
-  -runstatedir | --runstatedir | --runstatedi | --runstated \
-  | --runstate | --runstat | --runsta | --runst | --runs \
-  | --run | --ru | --r)
-    ac_prev=runstatedir ;;
-  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
-  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
-  | --run=* | --ru=* | --r=*)
-    runstatedir=$ac_optarg ;;
-
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1118,7 +1107,7 @@
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir runstatedir
+		libdir localedir mandir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1271,7 +1260,6 @@
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
-  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -1841,7 +1829,7 @@
   $as_echo_n "(cached) " >&6
 else
 
-	for am_cv_pathless_PYTHON in python python2 python3  python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3  python3.2 python3.1 python3.0  python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1  python2.0 none; do
+	for am_cv_pathless_PYTHON in python python2 python3 python3.3 python3.2 python3.1 python3.0 python2.7  python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do
 	  test "$am_cv_pathless_PYTHON" = none && break
 	  prog="import sys
 # split strings by '.' and convert to numeric.  Append some zeros
diff --git a/sky130/Makefile.in b/sky130/Makefile.in
index c7b24b3..f4e7bb3 100644
--- a/sky130/Makefile.in
+++ b/sky130/Makefile.in
@@ -732,9 +732,12 @@
 	mkdir -p ${KLAYOUT_STAGING_A}
 	rm -f ${KLAYOUT_STAGING_A}/${SKY130A}.lyp
 	rm -f ${KLAYOUT_STAGING_A}/${SKY130A}.lyt
-	${CPP} ${SKY130A_DEFS} klayout/${TECH}.lyp ${KLAYOUT_STAGING_A}/${SKY130A}.lyp
-	${CPP} ${SKY130A_DEFS} klayout/${TECH}.lyt ${KLAYOUT_STAGING_A}/${SKY130A}.lyt
-	cp klayout/${TECH}.lydrc ${KLAYOUT_STAGING_A}/${SKY130A}.lydrc
+	${CPP} -utf8 ${SKY130A_DEFS} klayout/${TECH}.lyp \
+		${KLAYOUT_STAGING_A}/${SKY130A}.lyp
+	${CPP} -utf8 ${SKY130A_DEFS} klayout/${TECH}.lyt \
+		${KLAYOUT_STAGING_A}/${SKY130A}.lyt
+	${CPP} -utf8 ${SKY130A_DEFS} klayout/${TECH}.lydrc \
+		${KLAYOUT_STAGING_A}/${SKY130A}.lydrc
 	#./custom/scripts/gen_run_drc.py -l ${KLAYOUT_STAGING_A}/${SKY130A}.lydrc \
 	#	-o ${KLAYOUT_STAGING_A}/${SKY130A}.drc
 
diff --git a/sky130/magic/sky130.tech b/sky130/magic/sky130.tech
index 7289548..74c730b 100644
--- a/sky130/magic/sky130.tech
+++ b/sky130/magic/sky130.tech
@@ -661,10 +661,31 @@
   compose  pfet  poly  pdiff
   compose  var   poly  nsd
 
+  decompose npass   poly ndiff
+  decompose npd     poly ndiff
+  decompose scnfet  poly ndiff
+  decompose nfetlvt poly ndiff
+  decompose nsonos  poly ndiff
+
+  decompose ppu       poly pdiff
+  decompose scpfet    poly pdiff
+  decompose scpfethvt poly pdiff
+  decompose pfethvt   poly pdiff
+  decompose pfetlvt   poly pdiff
+  decompose pfetmvt   poly pdiff
+  decompose corenvar  poly nsd
+  decompose corepvar  poly psd
+  decompose varhvt    poly nsd
+
   compose  mvnfet  poly  mvndiff
   compose  mvpfet  poly  mvpdiff
   compose  mvvar   poly  mvnsd
 
+  decompose nnfet     poly mvndiff
+  decompose mvnfetesd poly mvndiff
+  decompose mvnnfet   poly mvndiff
+  decompose mvpfetesd poly mvpdiff
+
   paint	 obsmcon locali	 via1
   paint	 obsmcon obsm1	 obsli,obsm1
   
@@ -698,6 +719,10 @@
   paint  coreli  psc    psc
   paint  coreli  viali  viali
 
+#ifdef RERAM
+  paint  reram  metal2  reram
+#endif (RERAM)
+
 #ifdef METAL5
   paint  m4      obsm4  m4
   paint  m5      obsm5  m5
@@ -1235,6 +1260,18 @@
  	squares-grid 55 150 170
  	calma 	68 44
 
+#ifdef RERAM
+#undef RERAM
+ layer VIA1 	reram
+ 	squares-grid 55 150 170
+ 	calma 	68 44
+
+ layer RERAM	reram
+ 	squares-grid 55 230 230
+	calma	201 20
+#define RERAM
+#endif (RERAM)
+
 #----------------------------------------------------------------
 # MET2
 #----------------------------------------------------------------
@@ -1264,14 +1301,6 @@
  	squares-grid 40 200 200
  	calma 	69 44
 
-#ifdef RERAM
-#undef RERAM
- layer RERAM	reram
- 	squares-grid 55 230 230
-	calma	201 20
-#define RERAM
-#endif (RERAM)
-
 #----------------------------------------------------------------
 # MET3
 #----------------------------------------------------------------
@@ -4568,7 +4597,7 @@
 # ReRAM
 #--------------------------------------------------
 
- width reram 340 "ReRAM width < %d (rr1.1)"
+ width reram 260 "ReRAM width < %d (rr1.1)"
  spacing reram reram 55 touching_illegal "ReRAM spacing < %d (rr1.2)"
  surround reram *m1,rm1 30 directional \
 	"Metal1 overlap of ReRAM < %d in one direction (via.5a - via.4a)"