Merge remote-tracking branch 'origin/master'
diff --git a/spice_test_suite/diode_dev_vth.spice.in b/spice_test_suite/diode_dev_vth.spice.in
index 2246ea1..8a1ad72 100644
--- a/spice_test_suite/diode_dev_vth.spice.in
+++ b/spice_test_suite/diode_dev_vth.spice.in
@@ -15,7 +15,7 @@
 * Sweep Vdd from 0 to 2.0V
 dc Vdd 0 2.0 0.05
 * NOTE:  Internally accessed names MUST be in lowercase
-wrdata DEVICENAME__vth.data -Vid#branch V(3)
+wrdata DEVICENAME__iv.data -Vid#branch V(3)
 * Find threshold
 let ih=-Vid#branch[38]
 let il=-Vid#branch[28]
diff --git a/spice_test_suite/diode_vth.spice.in b/spice_test_suite/diode_vth.spice.in
index cfb8f79..73b89b3 100644
--- a/spice_test_suite/diode_vth.spice.in
+++ b/spice_test_suite/diode_vth.spice.in
@@ -15,7 +15,7 @@
 * Sweep Vdd from 0 to 2.0V
 dc Vdd 0 2.0 0.05
 * NOTE:  Internally accessed names MUST be in lowercase
-wrdata DEVICENAME__vth.data -Vid#branch V(3)
+wrdata DEVICENAME__iv.data -Vid#branch V(3)
 * Find threshold
 let ih=-Vid#branch[38]
 let il=-Vid#branch[28]
diff --git a/spice_test_suite/gen_spice_tests.py b/spice_test_suite/gen_spice_tests.py
index 0a490d3..94d079b 100755
--- a/spice_test_suite/gen_spice_tests.py
+++ b/spice_test_suite/gen_spice_tests.py
@@ -19,7 +19,6 @@
 import multiprocessing
 
 from plot_mosfet_iv import make_mosfet_iv_plot
-from plot_mosfet_vth import make_mosfet_vth_plot
 from plot_bipolar_iv import make_bipolar_iv_plot
 from plot_bipolar_beta import make_bipolar_beta_plot
 from plot_diode_iv import make_diode_iv_plot
diff --git a/spice_test_suite/nfet5term_vth.spice.in b/spice_test_suite/nfet5term_vth.spice.in
index 2bb437d..168f59a 100644
--- a/spice_test_suite/nfet5term_vth.spice.in
+++ b/spice_test_suite/nfet5term_vth.spice.in
@@ -17,7 +17,7 @@
 .control
 * Sweep Vds from 0 to 1.8V
 dc Vdd 0 1.8 0.01 Vgb 0 1.2 0.01
-wrdata DEVICENAME__vth.data Vid#branch V(1) V(3)
+wrdata DEVICENAME__iv.data Vid#branch V(1) V(3)
 
 * Sweep Vgs from 0 to 1.2V
 dc Vgb 0 1.2 0.01
diff --git a/spice_test_suite/nfet_vth.spice.in b/spice_test_suite/nfet_vth.spice.in
index aa6e8fb..1264a24 100644
--- a/spice_test_suite/nfet_vth.spice.in
+++ b/spice_test_suite/nfet_vth.spice.in
@@ -18,7 +18,7 @@
 .control
 * Sweep Vds from 0 to 1.8V
 dc Vdd 0 1.8 0.01 Vgb 0 1.2 0.01
-wrdata DEVICENAME__vth.data Vid#branch V(1) V(3)
+wrdata DEVICENAME__iv.data Vid#branch V(1) V(3)
 
 * Sweep Vgs from 0 to 1.2V
 dc Vgb 0 1.2 0.01
diff --git a/spice_test_suite/npn.spice.in b/spice_test_suite/npn.spice.in
index 08621c1..a1b4546 100644
--- a/spice_test_suite/npn.spice.in
+++ b/spice_test_suite/npn.spice.in
@@ -17,7 +17,7 @@
 .control
 * Sweep Vce from 0 to 1.8V
 dc Vce 0 1.8 0.01 vbb 0 1.2 0.01
-wrdata DEVICENAME__vth.data -Vic#branch V(1) V(3)
+wrdata DEVICENAME__iv.data -Vic#branch V(1) V(3)
 
 * Sweep Vce from 0 to 3.3V, Vbb from 0 to 2.0V
 dc Vce 0 3.3 0.02 Vbb 0.6 0.9 0.01
diff --git a/spice_test_suite/pfet_vth.spice.in b/spice_test_suite/pfet_vth.spice.in
index 854981d..fff41ad 100644
--- a/spice_test_suite/pfet_vth.spice.in
+++ b/spice_test_suite/pfet_vth.spice.in
@@ -19,7 +19,7 @@
 dc Vdd 0 1.8 0.01 Vgb 0 1.2 0.01
 let vgs = V(5) - V(1)
 let vds = V(5) - V(3)
-wrdata DEVICENAME__vth.data Vid#branch vgs vds
+wrdata DEVICENAME__iv.data Vid#branch vgs vds
 
 * Sweep Vgs from 0 to 1.2V
 dc Vgb 0 1.2 0.01
diff --git a/spice_test_suite/plot_bipolar_beta.py b/spice_test_suite/plot_bipolar_beta.py
index ae360cf..b1f95b5 100755
--- a/spice_test_suite/plot_bipolar_beta.py
+++ b/spice_test_suite/plot_bipolar_beta.py
@@ -1,13 +1,12 @@
 #!/usr/bin/env python3
 #
-# Plot Bipolar ?beta? I/V curve from devicename + '__beta.data' from running ngspice
+# Plot Bipolar beta curve from devicename + '__beta.data' from running ngspice
 # on 'bipolar_test.spice'
 
 import os
 import sys
 import matplotlib.pyplot as plt
 
-
 def make_bipolar_beta_plot(devicepath, devicename, version, corner):
 
     with open(devicepath + '/' + devicename + '__beta.data', 'r') as ifile:
@@ -22,12 +21,15 @@
 
     # Generate X/Y plots
 
-    plt.figure()
+    fig = plt.figure()
+    ax = fig.add_axes([0.1, 0.1, 0.6, 0.75])
     for i in range(0, len(allBeta), 166 * 10):
         Beta = allBeta[i : i + 166]
         Vbe = allVbe[i : i + 166]
         Vce = allVce[i : i + 166]
-        plt.plot(Vce, Beta)
+        ax.plot(Vce, Beta, label='{:.2f}'.format(Vbe[0]))
+        ax.legend(bbox_to_anchor=(1.05, 1), loc='upper left', borderaxespad=0.,
+                title='Vbe (Volts)')
 
     title = 'SkyWater SKY130 PDK ' + version + '\n' + devicename + '\nBeta vs. Vce at corner ' + corner
     plt.title(title)
@@ -35,14 +37,17 @@
     plt.ylabel('Beta')
     plt.axis('on')
     plt.grid('on')
-    plt.savefig(devicepath + '/' + devicename + '_beta_v_vce.svg')
+    plt.savefig(devicepath + '/' + devicename + '_beta_v_vce.svg', bbox_inches='tight', pad_inches=0.1)
 
-    plt.figure()
+    fig = plt.figure()
+    ax = fig.add_axes([0.1, 0.1, 0.6, 0.75])
     for i in range(0, 166, 18):
         Beta = allBeta[i : len(allBeta): 166]
         Vbe = allVbe[i : len(allVbe): 166]
         Vce = allVce[i : len(allVce): 166]
-        plt.plot(Vbe, Beta)
+        ax.plot(Vbe, Beta, label='{:.2f}'.format(Vce[0]))
+        ax.legend(bbox_to_anchor=(1.05, 1), loc='upper left', borderaxespad=0.,
+                title='Vce (Volts)')
 
     title = 'SkyWater SKY130 PDK ' + version + '\n' + devicename + '\nBeta vs. Vbe at corner ' + corner
     plt.title(title)
@@ -50,7 +55,7 @@
     plt.ylabel('Beta')
     plt.axis('on')
     plt.grid('on')
-    plt.savefig(devicepath + '/' + devicename + '_beta_v_vbe.svg')
+    plt.savefig(devicepath + '/' + devicename + '_beta_v_vbe.svg', bbox_inches='tight', pad_inches=0.1)
 
 
 if __name__ == '__main__':
@@ -59,4 +64,6 @@
         sys.exit(1)
 
     devicename = sys.argv[1]
+    version = '0.20.1'
+    corner = 'tt'
     make_bipolar_beta_plot(os.getcwd(), devicename, version, corner)
diff --git a/spice_test_suite/plot_bipolar_iv.py b/spice_test_suite/plot_bipolar_iv.py
index 1c792c1..b26ca39 100755
--- a/spice_test_suite/plot_bipolar_iv.py
+++ b/spice_test_suite/plot_bipolar_iv.py
@@ -1,16 +1,15 @@
 #!/usr/bin/env python3
 #
-# Plot Bipolar I/V curve from devicename + '__vth.data' from running ngspice
+# Plot Bipolar I/V curve from devicename + '.data' from running ngspice
 # on 'bipolar_test.spice'
 
 import os
 import sys
 import matplotlib.pyplot as plt
 
-
 def make_bipolar_iv_plot(devicepath, devicename, version, corner):
 
-    with open(devicepath + '/' + devicename + '__vth.data', 'r') as ifile:
+    with open(devicepath + '/' + devicename + '__iv.data', 'r') as ifile:
         idata = ifile.read().split()
 
     # Reformat data
@@ -22,12 +21,15 @@
 
     # Generate X/Y plots
 
-    plt.figure()
+    fig = plt.figure()
+    ax = fig.add_axes([0.1, 0.1, 0.6, 0.75])
     for i in range(0, len(allIce), 181 * 10):
         Ice = allIce[i : i + 181]
         Vbe = allVbe[i : i + 181]
         Vce = allVce[i : i + 181]
-        plt.plot(Vce, Ice)
+        ax.plot(Vce, Ice, label='{:.2f}'.format(Vbe[0]))
+        ax.legend(bbox_to_anchor=(1.05, 1), loc='upper left', borderaxespad=0.,
+                    title='Vbe (Volts)')
 
     title = 'SkyWater SKY130 PDK ' + version + '\n' + devicename + '\nI/V characteristic (Ice vs. Vce) at corner ' + corner
     plt.title(title)
@@ -35,14 +37,17 @@
     plt.ylabel('Ice (Amps)')
     plt.axis('on')
     plt.grid('on')
-    plt.savefig(devicepath + '/' + devicename + '_ice_v_vce.svg')
+    plt.savefig(devicepath + '/' + devicename + '_ice_v_vce.svg', bbox_inches='tight', pad_inches=0.1)
 
-    plt.figure()
+    fig = plt.figure()
+    ax = fig.add_axes([0.1, 0.1, 0.6, 0.75])
     for i in range(0, 181, 18):
         Ice = allIce[i : len(allIce): 181]
         Vbe = allVbe[i : len(allVbe): 181]
         Vce = allVce[i : len(allVce): 181]
-        plt.plot(Vbe, Ice)
+        ax.plot(Vbe, Ice, label='{:.2f}'.format(Vce[0]))
+        ax.legend(bbox_to_anchor=(1.05, 1), loc='upper left', borderaxespad=0.,
+                    title='Vce (Volts)')
 
     title = 'SkyWater SKY130 PDK ' + version + '\n' + devicename + '\nI/V characteristic (Ice vs. Vbe) at corner ' + corner
     plt.title(title)
@@ -50,7 +55,7 @@
     plt.ylabel('Ice (Amps)')
     plt.axis('on')
     plt.grid('on')
-    plt.savefig(devicepath + '/' + devicename + '_ice_v_vbe.svg')
+    plt.savefig(devicepath + '/' + devicename + '_ice_v_vbe.svg', bbox_inches='tight', pad_inches=0.1)
 
 
 if __name__ == '__main__':
@@ -59,4 +64,6 @@
         sys.exit(1)
 
     devicename = sys.argv[1]
+    version='0.20.1'
+    corner='tt'
     make_bipolar_iv_plot(os.getcwd(), devicename, version, corner)
diff --git a/spice_test_suite/plot_diode_iv.py b/spice_test_suite/plot_diode_iv.py
index 2a71452..ac50d32 100755
--- a/spice_test_suite/plot_diode_iv.py
+++ b/spice_test_suite/plot_diode_iv.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python3
 #
-# Plot MOSFET I/V curve from devicename + '__vth.data' from running ngspice
+# Plot DIODE I/V curve from devicename + '.data' from running ngspice
 # on 'diode_iv.spice'
 
 import os
@@ -10,7 +10,7 @@
 
 def make_diode_iv_plot(devicepath, devicename, version, corner):
 
-    with open(devicepath + '/' + devicename + '__vth.data', 'r') as ifile:
+    with open(devicepath + '/' + devicename + '__iv.data', 'r') as ifile:
         idata = ifile.read().split()
 
     # Reformat data
@@ -33,7 +33,7 @@
     plt.ylabel('Id (Amps)')
     plt.axis('on')
     plt.grid('on')
-    plt.savefig(devicepath + '/' + devicename + '_id_v_vd.svg')
+    plt.savefig(devicepath + '/' + devicename + '_id_v_vd.svg', bbox_inches='tight', pad_inches=0.1)
 
 
 if __name__ == '__main__':
@@ -42,4 +42,6 @@
         sys.exit(1)
 
     devicename = sys.argv[1]
+    version='0.20.1'
+    corner='tt'
     make_diode_iv_plot(os.getcwd(), devicename, version, corner)
diff --git a/spice_test_suite/plot_mosfet_iv.py b/spice_test_suite/plot_mosfet_iv.py
index 3746c91..b736ee2 100755
--- a/spice_test_suite/plot_mosfet_iv.py
+++ b/spice_test_suite/plot_mosfet_iv.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python3
 #
-# Plot MOSFET I/V curve from devicename + '__vth.data' from running ngspice
+# Plot MOSFET I/V curve from devicename + '.data' from running ngspice
 # on 'mosfet_test.spice'
 
 import os
@@ -10,7 +10,7 @@
 
 def make_mosfet_iv_plot(devicepath, devicename, version, corner):
 
-    with open(devicepath + '/' + devicename + '__vth.data', 'r') as ifile:
+    with open(devicepath + '/' + devicename + '__iv.data', 'r') as ifile:
         idata = ifile.read().split()
 
     # Reformat data
@@ -22,12 +22,15 @@
 
     # Generate X/Y plots
 
-    plt.figure()
+    fig = plt.figure()
+    ax = fig.add_axes([0.1, 0.1, 0.6, 0.75])
     for i in range(0, len(allIds), 181 * 10):
         Ids = allIds[i : i + 181]
         Vgs = allVgs[i : i + 181]
         Vds = allVds[i : i + 181]
-        plt.plot(Vds, Ids)
+        ax.plot(Vds, Ids, label='{:.2f}'.format(Vgs[0]))
+        ax.legend(bbox_to_anchor=(1.05, 1), loc='upper left', borderaxespad=0.,
+                        title='Vgs (Volts)')
 
     title = 'SkyWater SKY130 PDK ' + version + '\n' + devicename + '\nI/V characteristic (Ids vs. Vds) at corner ' + corner
     plt.title(title)
@@ -35,14 +38,17 @@
     plt.ylabel('Ids (Amps)')
     plt.axis('on')
     plt.grid('on')
-    plt.savefig(devicepath + '/' + devicename + '_ids_v_vds.svg')
+    plt.savefig(devicepath + '/' + devicename + '_ids_v_vds.svg', bbox_inches='tight', pad_inches=0.1)
 
-    plt.figure()
+    fig = plt.figure()
+    ax = fig.add_axes([0.1, 0.1, 0.6, 0.75])
     for i in range(0, 181, 18):
         Ids = allIds[i : len(allIds): 181]
         Vgs = allVgs[i : len(allVgs): 181]
         Vds = allVds[i : len(allVds): 181]
-        plt.plot(Vgs, Ids)
+        ax.plot(Vgs, Ids, label='{:.2f}'.format(Vds[0]))
+        ax.legend(bbox_to_anchor=(1.05, 1), loc='upper left', borderaxespad=0.,
+                        title='Vds (Volts)')
 
     title = 'SkyWater SKY130 PDK ' + version + '\n' + devicename + '\nI/V characteristic (Ids vs. Vgs) at corner ' + corner
     plt.title(title)
@@ -50,7 +56,7 @@
     plt.ylabel('Ids (Amps)')
     plt.axis('on')
     plt.grid('on')
-    plt.savefig(devicepath + '/' + devicename + '_ids_v_vgs.svg')
+    plt.savefig(devicepath + '/' + devicename + '_ids_v_vgs.svg', bbox_inches='tight', pad_inches=0.1)
 
 
 if __name__ == '__main__':
@@ -59,4 +65,6 @@
         sys.exit(1)
 
     devicename = sys.argv[1]
+    version = '0.20.1'
+    corner = 'tt'
     make_mosfet_iv_plot(os.getcwd(), devicename, version, corner)
diff --git a/spice_test_suite/plot_mosfet_vth.py b/spice_test_suite/plot_mosfet_vth.py
deleted file mode 100755
index 980d415..0000000
--- a/spice_test_suite/plot_mosfet_vth.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/env python3
-#
-# Plot MOSFET I/V curve from devicename + '__vth.data' from running ngspice
-# on 'mosfet_test.spice'
-
-import os
-import sys
-import matplotlib.pyplot as plt
-
-
-def make_mosfet_vth_plot(devicepath, devicename, version, corner):
-
-    with open(devicepath + '/' + devicename + '__vth.data', 'r') as ifile:
-        idata = ifile.read().split()
-
-    # Reformat data
-
-    nrows = int(len(idata) / 6)
-    allVth = list(float(idata[p + 1]) for p in range(0, len(idata), 6))
-    allVgs = list(float(idata[p + 3]) for p in range(0, len(idata), 6))
-    allVds = list(float(idata[p + 5]) for p in range(0, len(idata), 6))
-
-    # Generate X/Y plots
-
-    plt.figure()
-    for i in range(0, len(allVth), 181 * 10):
-        Vth = allVth[i : i + 181]
-        Vgs = allVgs[i : i + 181]
-        Vds = allVds[i : i + 181]
-        plt.plot(Vds, Vth)
-
-    title = 'SkyWater SKY130 PDK ' + version + '\n' + devicename + '\nThreshold voltage (Vth vs. Vds) at corner ' + corner
-    plt.title(title)
-    plt.xlabel('Vds (Volts)')
-    plt.ylabel('Vth (Volts)')
-    plt.axis('on')
-    plt.grid('on')
-    plt.savefig(devicepath + '/' + devicename + '_vth_v_vds.svg')
-
-    plt.figure()
-    for i in range(0, 181, 18):
-        Vth = allVth[i : len(allVth): 181]
-        Vgs = allVgs[i : len(allVgs): 181]
-        Vds = allVds[i : len(allVds): 181]
-        plt.plot(Vgs, Vth)
-
-    title = 'SkyWater SKY130 PDK ' + version + '\n' + devicename + '\nThreshold voltage (Vth vs. Vgs) at corner ' + corner
-    plt.title(title)
-    plt.xlabel('Vgs (Volts)')
-    plt.ylabel('Vth (Volts)')
-    plt.axis('on')
-    plt.grid('on')
-    plt.savefig(devicepath + '/' + devicename + '_vth_v_vgs.svg')
-
-
-if __name__ == '__main__':
-    if len(sys.argv) < 2:
-        print("No device name given to plot_mosfet_vth")
-        sys.exit(1)
-
-    devicename = sys.argv[1]
-    make_mosfet_vth_plot(os.getcwd(), devicename, version, corner)
diff --git a/spice_test_suite/pnp.spice.in b/spice_test_suite/pnp.spice.in
index c217c5e..1c8bdbc 100644
--- a/spice_test_suite/pnp.spice.in
+++ b/spice_test_suite/pnp.spice.in
@@ -19,7 +19,7 @@
 dc Vce 0 1.8 0.01 Vbb 0 1.2 0.01
 let vc1 = V(5) - V(3)
 let vb1 = V(5) - V(2)
-wrdata DEVICENAME__vth.data -Vic#branch vb1 vc1
+wrdata DEVICENAME__iv.data -Vic#branch vb1 vc1
 
 * Sweep Vce from 0 to 3.3V, Vbb from 0 to 2.0V
 dc Vce 0 3.3 0.02 Vbb 0.6 0.9 0.01
diff --git a/spice_test_suite/run_spice_tests.py b/spice_test_suite/run_spice_tests.py
index edffbc0..332d49f 100755
--- a/spice_test_suite/run_spice_tests.py
+++ b/spice_test_suite/run_spice_tests.py
@@ -21,7 +21,6 @@
 import find_all_devices
 
 from plot_mosfet_iv import make_mosfet_iv_plot
-from plot_mosfet_vth import make_mosfet_vth_plot
 from plot_bipolar_iv import make_bipolar_iv_plot
 from plot_bipolar_beta import make_bipolar_beta_plot
 from plot_diode_iv import make_diode_iv_plot
diff --git a/spice_test_suite/run_spice_tests_new.py b/spice_test_suite/run_spice_tests_new.py
index 21366a3..2ff66a7 100755
--- a/spice_test_suite/run_spice_tests_new.py
+++ b/spice_test_suite/run_spice_tests_new.py
@@ -28,7 +28,6 @@
 import find_all_devices_new
 
 from plot_mosfet_iv import make_mosfet_iv_plot
-from plot_mosfet_vth import make_mosfet_vth_plot
 from plot_bipolar_iv import make_bipolar_iv_plot
 from plot_bipolar_beta import make_bipolar_beta_plot
 from plot_diode_iv import make_diode_iv_plot