Added several patches and corrections to the device models:
Uncommented the poly resistor model definition (known issue for
some time), added subcircuit definitions for the high voltage
pdiff and ndiff resistors (including parasitic diode devices
at each terminal, as done for the low voltage pdiff/ndiff
resistors), and replaced the resistor names in the HVL digital
standard cell library (since there was no subcircuit model for
these, the names did not get remapped).
diff --git a/VERSION b/VERSION
index d9871d3..18168b2 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.0.151
+1.0.152
diff --git a/sky130/Makefile.in b/sky130/Makefile.in
index 362e601..11b4497 100644
--- a/sky130/Makefile.in
+++ b/sky130/Makefile.in
@@ -395,6 +395,8 @@
 	HDLL_TECHLEF = techLEF/sky130_fd_sc_hdll
 	MLXX_SCRIPTS = scripts/sky130_ml_xx_hd
 	PR_SPICE = spi/sky130_fd_pr
+	HVL_SPICE = spi/sky130_fd_sc_hvl
+	HVL_CDL = cdl/sky130_fd_sc_hvl
 else
 	IO_VERILOG = sky130_fd_io/verilog
 	HD_VERILOG = sky130_fd_sc_hd/verilog
@@ -408,6 +410,8 @@
 	HDLL_TECHLEF = sky130_fd_sc_hdll/techlef
 	MLXX_SCRIPTS = sky130_ml_xx_hd/scripts
 	PR_SPICE = sky130_fd_pr/spice
+	HVL_SPICE = sky130_fd_sc_hvl/spice
+	HVL_CDL = sky130_fd_sc_hvl/cdl
 endif
 
 all: all-a
@@ -721,6 +725,9 @@
 	# Custom:  Add diodes as subcircuits to the r+c models file
 	cat ./custom/models/diode.spice >> \
 		${STAGING_PATH}/${SKY130A}/libs.tech/ngspice/sky130_fd_pr__model__r+c.model.spice
+	# Custom:  Add resistors as subcircuits to the r+c models file
+	cat ./custom/models/resistor.spice >> \
+		${STAGING_PATH}/${SKY130A}/libs.tech/ngspice/sky130_fd_pr__model__r+c.model.spice
 
 	# Custom:  Patch the models to work around ngspice issue with the relative
 	# order of the "nf" and "mult" parameters.
@@ -735,6 +742,10 @@
 	patch -p4 -f -d ${STAGING_PATH}/${SKY130A}/libs.ref/${PR_SPICE} \
 		< custom/patches/sky130_fd_pr_3.patch \
 		2>&1 | tee -a ${SKY130A}_make.log || true
+	# Custom:  Patch the ngspice models to add the HV diffusion resistor subcircuits
+	patch -p2 -f -d ${STAGING_PATH}/${SKY130A}/libs.tech/ngspice \
+		< custom/patches/sky130_fd_pr_5.patch \
+		2>&1 | tee -a ${SKY130A}_make.log || true
 	# Custom:  Add "spinit" file
 	cat ./custom/models/spinit >> \
 		${STAGING_PATH}/${SKY130A}/libs.tech/ngspice/spinit
@@ -831,6 +842,13 @@
 	patch -p1 -f -d ${STAGING_PATH}/${SKY130A}/libs.ref/${HDLL_TECHLEF} \
 		< custom/patches/hdll_minenclosed.squeaky.patch \
 		2>&1 | tee -a ${SKY130A}_make.log || true
+	# Custom:  Patch the HVL library to correct the resistor device names
+	patch -p3 -f -d ${STAGING_PATH}/${SKY130A}/libs.ref/${HVL_SPICE} \
+		< custom/patches/sky130_fd_pr_4.patch \
+		2>&1 | tee -a ${SKY130A}_make.log || true
+	patch -p3 -f -d ${STAGING_PATH}/${SKY130A}/libs.ref/${HVL_CDL} \
+		< custom/patches/sky130_fd_pr_6.patch \
+		2>&1 | tee -a ${SKY130A}_make.log || true
 
 alpha-a:
 	# Install alphanumeric library.
diff --git a/sky130/custom/models/resistor.spice b/sky130/custom/models/resistor.spice
new file mode 100644
index 0000000..5be03fb
--- /dev/null
+++ b/sky130/custom/models/resistor.spice
@@ -0,0 +1,13 @@
+* Subcircuit definition HV diffusion resistors
+
+.subckt sky130_fd_pr__res_generic_nd__hv t1 t2 b w=1 l=1
+r0 t1 t2 sky130_fd_pr__res_generic_nd__hv w = {w} l = {l}
+d0 b t1 sky130_fd_pr__diode_pw2nd_11v0 area='w*l*0.5' pj='w+l'
+d1 b t2 sky130_fd_pr__diode_pw2nd_11v0 area='w*l*0.5' pj='w+l'
+.ends sky130_fd_pr__res_generic_nd__hv
+
+.subckt sky130_fd_pr__res_generic_pd__hv t1 t2 b w=1 l=1
+r0 t1 t2 sky130_fd_pr__res_generic_pd__hv w = {w} l = {l}
+d0 t1 b sky130_fd_pr__diode_pd2nw_11v0 area='w*l*0.5' pj='w+l'
+d1 t1 b sky130_fd_pr__diode_pd2nw_11v0 area='w*l*0.5' pj='w+l'
+.ends sky130_fd_pr__res_generic_pd__hv
diff --git a/sky130/custom/patches/sky130_fd_pr_4.patch b/sky130/custom/patches/sky130_fd_pr_4.patch
new file mode 100644
index 0000000..8408926
--- /dev/null
+++ b/sky130/custom/patches/sky130_fd_pr_4.patch
@@ -0,0 +1,14 @@
+diff -Naur libs.ref/sky130_fd_sc_hvl/spice/sky130_fd_sc_hvl.spice libs.ref.fixed/sky130_fd_sc_hvl/spice/sky130_fd_sc_hvl.spice
+--- libs.ref/sky130_fd_sc_hvl/spice/sky130_fd_sc_hvl.spice	2021-04-27 15:36:47.000000000 -0400
++++ libs.ref.fixed/sky130_fd_sc_hvl/spice/sky130_fd_sc_hvl.spice	2021-04-29 13:47:15.748574423 -0400
+@@ -1860,8 +1860,8 @@
+ .subckt sky130_fd_sc_hvl__schmittbuf_1 A VGND VNB VPB VPWR X
+ X0 a_117_181# A a_231_463# VPB sky130_fd_pr__pfet_g5v0d10v5 w=750000u l=500000u
+ X1 a_117_181# A a_217_207# VNB sky130_fd_pr__nfet_g5v0d10v5 w=420000u l=500000u
+-X2 a_78_463# VGND VNB mrdn_hv w=290000u l=1.355e+06u
+-X3 a_64_207# VPWR VPB mrdp_hv w=290000u l=3.11e+06u
++X2 a_78_463# VGND VNB sky130_fd_pr__res_generic_nd__hv w=290000u l=1.355e+06u
++X3 a_64_207# VPWR VPB sky130_fd_pr__res_generic_pd__hv w=290000u l=3.11e+06u
+ X4 a_231_463# A VPWR VPB sky130_fd_pr__pfet_g5v0d10v5 w=750000u l=500000u
+ X5 a_64_207# a_117_181# a_217_207# VNB sky130_fd_pr__nfet_g5v0d10v5 w=420000u l=500000u
+ X6 VGND a_117_181# X VNB sky130_fd_pr__nfet_g5v0d10v5 w=750000u l=500000u
diff --git a/sky130/custom/patches/sky130_fd_pr_5.patch b/sky130/custom/patches/sky130_fd_pr_5.patch
new file mode 100644
index 0000000..a2ad431
--- /dev/null
+++ b/sky130/custom/patches/sky130_fd_pr_5.patch
@@ -0,0 +1,12 @@
+diff -Naur libs.tech/ngspice/sky130_fd_pr__model__r+c.model.spice libs.tech.fixed/ngspice/sky130_fd_pr__model__r+c.model.spice
+--- libs.tech/ngspice/sky130_fd_pr__model__r+c.model.spice	2021-04-27 22:18:42.839340172 -0400
++++ libs.tech.fixed/ngspice/sky130_fd_pr__model__r+c.model.spice	2021-04-29 13:48:44.752431446 -0400
+@@ -131,7 +131,7 @@
+ .model sky130_fd_pr__res_generic_pd r tc1r = {tc1rsp} tc2r = {tc2rsp} rsh = {rdp} dw = {"-tol_pfom/2-pfom_dw/2"} tnom = 30.0
+ .model sky130_fd_pr__res_generic_nd__hv r tc1r = {tc1rsn_h} tc2r = {tc2rsn_h} rsh = {rdn_hv} dw = {"-tol_nfom/2-nfom_dw/2"} tnom = 30.0
+ .model sky130_fd_pr__res_generic_pd__hv r tc1r = {tc1rsp_h} tc2r = {tc2rsp_h} rsh = {rdp_hv} dw = {"-tol_pfom/2-pfom_dw/2"} tnom = 30.0
+-*.model sky130_fd_pr__res_generic_po       r tc1r=tc1rsgpu   tc2r=tc2rsgpu   rsh=rp1   dw="-tol_poly/2-poly_dw/2" tnom=30
++.model sky130_fd_pr__res_generic_po       r tc1r=tc1rsgpu   tc2r=tc2rsgpu   rsh=rp1   dw="-tol_poly/2-poly_dw/2" tnom=30
+ .model sky130_fd_pr__res_generic_nw r tc1r = {tc1rsnw} tc2r = {tc2rsnw} rsh = {rnw} dw = {"-tol_nw/2"} tnom = 30.0
+ .model sky130_fd_pr__res_generic_l1 r tc1r = {tc1rl1} tc2r = {tc2rl1} rsh = {rl1} dw = {"-tol_li/2-li_dw/2"} tnom = 30.0
+ .model sky130_fd_pr__res_generic_m1 r tc1r = {tc1rm1} tc2r = {tc2rm1} rsh = {rm1} dw = {"-tol_m1/2-m1_dw/2"} tnom = 30.0
diff --git a/sky130/custom/patches/sky130_fd_pr_6.patch b/sky130/custom/patches/sky130_fd_pr_6.patch
new file mode 100644
index 0000000..ea402c4
--- /dev/null
+++ b/sky130/custom/patches/sky130_fd_pr_6.patch
@@ -0,0 +1,14 @@
+diff -Naur libs.ref/sky130_fd_sc_hvl/cdl/sky130_fd_sc_hvl.cdl libs.ref.fixed/sky130_fd_sc_hvl/cdl/sky130_fd_sc_hvl.cdl
+--- libs.ref/sky130_fd_sc_hvl/cdl/sky130_fd_sc_hvl.cdl	2021-04-29 14:04:04.666906207 -0400
++++ libs.ref.fixed/sky130_fd_sc_hvl/cdl/sky130_fd_sc_hvl.cdl	2021-04-29 14:42:56.278560406 -0400
+@@ -2228,8 +2228,8 @@
+
+ .SUBCKT sky130_fd_sc_hvl__schmittbuf_1 A VGND VNB VPB VPWR X
+ *.PININFO A:I VGND:I VNB:I VPB:I VPWR:I X:O
+-rI39 net069 VGND mrdn_hv m=1 w=0.29 l=1.355 isHV=TRUE
+-rI38 VPWR net32 mrdp_hv m=1 w=0.29 l=3.11 isHV=TRUE
++rI39 net069 VGND sky130_fd_pr__res_generic_nd__hv m=1 w=0.29 l=1.355 isHV=TRUE
++rI38 VPWR net32 sky130_fd_pr__res_generic_pd__hv m=1 w=0.29 l=3.11 isHV=TRUE
+ MI5 net32 net36 net40 VNB nfet_g5v0d10v5 m=1 w=0.42 l=0.5 mult=1
+ + sa=0.265 sb=0.265 sd=0.28 topography=normal area=0.063 perim=1.14
+ MMN0 net36 A net40 VNB nfet_g5v0d10v5 m=1 w=0.42 l=0.5 mult=1 sa=0.265