blob: 0e52067260ec02e373dde5649ed1e3157f5e0588 [file] [log] [blame]
#!/usr/bin/env python3
#
# Plot Bipolar I/V curve from devicename + '__vth.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:
idata = ifile.read().split()
# Reformat data
nrows = int(len(idata) / 6)
allIce = list(float(idata[p + 1]) for p in range(0, len(idata), 6))
allVbe = list(float(idata[p + 3]) for p in range(0, len(idata), 6))
allVce = 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(allIce), 181 * 10):
Ice = allIce[i : i + 181]
Vbe = allVbe[i : i + 181]
Vce = allVce[i : i + 181]
plt.plot(Vce, Ice)
title = 'SkyWater sky130 PDK ' + version + ' ' + devicename + ' I/V characteristic (Ice vs. Vce) at corner ' + corner
plt.title(title)
plt.xlabel('Vce (V)')
plt.ylabel('Ice (A)')
plt.axis('on')
plt.grid('on')
plt.savefig(devicepath + '/' + devicename + '_ice_v_vce.svg')
plt.figure()
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)
title = 'SkyWater sky130 PDK ' + version + ' ' + devicename + ' I/V characteristic (Ice vs. Vbe) at corner ' + corner
plt.title(title)
plt.xlabel('Vbe (V)')
plt.ylabel('Ice (A)')
plt.axis('on')
plt.grid('on')
plt.savefig(devicepath + '/' + devicename + '_ice_v_vbe.svg')
if __name__ == '__main__':
if len(sys.argv) < 2:
print("No device name given to plot_bipolar_iv")
sys.exit(1)
devicename = sys.argv[1]
make_bipolar_iv_plot(os.getcwd(), devicename, version, corner)