DC analysis of MOSFET circuits
In the circuit shown in the figure, the device parameters are $L_p=L_n=2\,\mu$m, $W_n=5\,\mu$m, $\mu _n C_{ox}=20\,\mu A/V^2$, $\mu _p C_{ox}=8\,\mu A/V^2$, $\lambda=0\,V^{-1}$. Find $W_p$ for a drain current of $5.57\,\mu$A. What is $V_1$ in that situation?
(Assume the long-channel MOSFEL model to be valid.)
In [1]:
from IPython.display import Image
Image(filename =r'EC_mos_dc_1_fig_1.png', width=100)
Out[1]:
In [2]:
# run this cell to view the circuit file.
%pycat EC_mos_dc_1_orig.in
We now replace the string \$Wp with the value of our choice by running the python script given below. It takes an existing circuit file EC_mos_dc_1_orig.in and produces a new circuit file EC_mos_dc_1.in, after replacing \$Wp with the value of our choice.
In [3]:
import gseim_calc as calc
s_Wp = '5u' # to be changed by user
l = [
('$Wp', s_Wp),
]
calc.replace_strings_1("EC_mos_dc_1_orig.in", "EC_mos_dc_1.in", l)
print('EC_mos_dc_1.in is ready for execution')
EC_mos_dc_1.in is ready for execution
Execute the following cell to run NGSPICE on EC_mos_dc_1.in.
In [4]:
import ngspice_calc as ngcalc
ngcalc.run_ngspice('EC_mos_dc_1.in')
Circuit: * dc analysis using basic mosfet model Doing analysis at TEMP = 27.000000 and TNOM = 27.000000 No. of Data Columns : 2 No. of Data Rows : 1 Total analysis time (seconds) = 0 Total elapsed time (seconds) = 0.002 Total DRAM available = 7739.719 MB. DRAM currently available = 2456.102 MB. Total ngspice program size = 19.590 MB. Resident set size = 8.996 MB. Shared ngspice pages = 7.609 MB. Text (code) pages = 5.789 MB. Stack = 0 bytes. Library pages = 1.840 MB.
Out[4]:
'EC_mos_dc_1.raw'
In [5]:
# get output file information from the circuit file
s = ngcalc.slv('EC_mos_dc_1.in')
for i in range(s.num_plots()):
print(f" plot {i}: {s.plotname(i)} | type: {s.analysis_type(i)} | vars: {s.variables(i)}")
plot 0: Operating Point | type: op | vars: ['v(1)', 'i(vdd)']
In [6]:
V1 = s.get_array('v(1)')[0]
I = s.get_array('i(vdd)')[0]
print(f'V1 = {V1:7.4f} V')
print(f'current = {-I:11.4e} A')
V1 = 1.3874 V current = 3.7528e-06 A
This notebook was contributed by Prof. M. B. Patil, IIT Bombay. He may be contacted at mbpatil@ee.iitb.ac.in.
In [ ]: