DC analysis of MOSFET circuits

In the circuit shown in the figure, the device parameters are $W=20\,\mu$m, $L=2\,\mu$m, $\mu _n C_{ox}=100\,\mu A/V^2$, $\lambda=0\,V^{-1}$. Find $R_2$ and $R_D$ for $I_D=200\,\mu$A and $V_{DS}=1\,$V. Assume the long-channel MOSFEL model to be valid.

Hint: Assume the transistor to be in saturation (you need to verify that after you compute $R_2$ and $R_D$.

In [1]:
from IPython.display import Image
Image(filename =r'EC_mos_dc_2_fig_1.png', width=150)
Out[1]:
No description has been provided for this image
In [2]:
# run this cell to view the circuit file.
%pycat EC_mos_dc_2_orig.in

We now replace the strings \$R2 and \$RD with the values of our choice by running the python script given below. It takes an existing circuit file EC_mos_dc_2_orig.in and produces a new circuit file EC_mos_dc_2.in, after replacing \$R2 and \$RD with the values of our choice.

In [3]:
import gseim_calc as calc
s_R2 = '50k' # to be changed by user
s_RD = '2.5k' # to be changed by user

l = [
  ('$R2', s_R2),
  ('$RD', s_RD),
]
calc.replace_strings_1("EC_mos_dc_2_orig.in", "EC_mos_dc_2.in", l)
print('EC_mos_dc_2.in is ready for execution')
EC_mos_dc_2.in is ready for execution
Execute the following cell to run NGSPICE on EC_mos_dc_2.in.
In [4]:
import ngspice_calc as ngcalc
ngcalc.run_ngspice('EC_mos_dc_2.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.001 

Total DRAM available = 7739.719 MB.
DRAM currently available = 2533.434 MB.
Total ngspice program size =   19.590 MB.
Resident set size =    9.164 MB.
Shared ngspice pages =    7.770 MB.
Text (code) pages =    5.789 MB.
Stack = 0 bytes.
Library pages =    1.840 MB.


Out[4]:
'EC_mos_dc_2.raw'
In [5]:
# get output file information from the circuit file
s = ngcalc.slv('EC_mos_dc_2.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(2)', 'i(vx)']
In [6]:
VDS = s.get_array('v(2)')[0]
ID  = s.get_array('i(vx)')[0]

print(f'VDS = {VDS:7.4f} V')
print(f'ID = {ID:11.4e} A')
VDS =  1.4875 V
ID =  1.2500e-04 A

This notebook was contributed by Prof. M. B. Patil, IIT Bombay. He may be contacted at mbpatil@ee.iitb.ac.in.

In [ ]: