summaryrefslogtreecommitdiff
path: root/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter4.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter4.ipynb')
-rwxr-xr-xMicroelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter4.ipynb606
1 files changed, 606 insertions, 0 deletions
diff --git a/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter4.ipynb b/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter4.ipynb
new file mode 100755
index 00000000..5c722e15
--- /dev/null
+++ b/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter4.ipynb
@@ -0,0 +1,606 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:2e122d0d9af0f7dc649a87e065bb4427f9b9f430299e88d4998a7b5b0d765c15"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter04: MOS Field-Effect Transistors (MOSFETs)"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.1:pg-245"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 4.1 : To determine operating point parameters\n",
+ "L_min=0.4*10**-6; # (m)\n",
+ "t_ox=8*10**-9; # (s)\n",
+ "u_n=450*10**-4; # (A/V**2)\n",
+ "V_t=0.7; # (V)\n",
+ "e_ox=3.45*10**-11; \n",
+ "\n",
+ "# 4.1a\n",
+ "C_ox=e_ox/t_ox;\n",
+ "print round(C_ox*1000,2),\"= C_ox (fF/micrometer**2)\"\n",
+ "k_n=u_n*C_ox;\n",
+ "print round(k_n*1e6),\"= k_n (microA/V**2)\"\n",
+ "\n",
+ "# 4.1b \n",
+ "# Operation in saturation region\n",
+ "W=8*10**-6; # (m)\n",
+ "L=0.8*10**-6; # (m)\n",
+ "i_D=100*10**-6; # (A)\n",
+ "V_GS=math.sqrt(2*L*i_D/(k_n*W)) +V_t;\n",
+ "print round(V_GS,2),\"= V_GS (V)\"\n",
+ "V_DSmin=V_GS-V_t;\n",
+ "print round(V_DSmin,2),\"= V_DSmin (V)\"\n",
+ "\n",
+ "# 4.1c\n",
+ "# MOSFET in triode region\n",
+ "r_DS=1000; # (ohm)\n",
+ "V_GS=1/(k_n*(W/L)*r_DS)+V_t;\n",
+ "print round(V_GS,2),\"= V_GS (V)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "4.31 = C_ox (fF/micrometer**2)\n",
+ "194.0 = k_n (microA/V**2)\n",
+ "1.02 = V_GS (V)\n",
+ "0.32 = V_DSmin (V)\n",
+ "1.22 = V_GS (V)\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.2:pg-263"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 4.2: Design of given circuit to obtain I_D=0.4mA and V_D=0.5V\n",
+ "# NMOS transistor is operating in saturation region\n",
+ "I_D=0.4*10**-3; # (A)\n",
+ "V_D=0.5; # (V)\n",
+ "V_t=0.7; # (V)\n",
+ "uC_n=100*10**-6; # (A/V**2)\n",
+ "L=1*10**-6; # (m)\n",
+ "W=32*10**-6; # (m)\n",
+ "V_SS=-2.5; # (V)\n",
+ "V_DD=2.5; # (V)\n",
+ "V_OV=math.sqrt(I_D*2*L/(uC_n*W));\n",
+ "V_GS=V_t+V_OV;\n",
+ "print V_GS,\"= V_t (V)\"\n",
+ "V_S=-1.2; # (V)\n",
+ "R_S=(V_S-V_SS)/I_D;\n",
+ "print round(R_S/1000,2),\"= R_S (Kohm)\"\n",
+ "V_D=0.5; # (V)\n",
+ "R_D=(V_DD-V_D)/I_D;\n",
+ "print round(R_D/1000),\"= R_D (Kohm)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1.2 = V_t (V)\n",
+ "3.25 = R_S (Kohm)\n",
+ "5.0 = R_D (Kohm)\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.3:pg-264"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 4.3: Design of given circuit to obtain I_D=80uA\n",
+ "# FET is operating in saturation region\n",
+ "I_D=80*10**-6; # (A)\n",
+ "V_t=0.6; # (V)\n",
+ "uC_n=200*10**-6; # (A/V**2)\n",
+ "L=0.8*10**-6; # (m)\n",
+ "W=4*10**-6; # (m)\n",
+ "V_DD=3; # (V)\n",
+ "V_OV=math.sqrt(2*I_D/(uC_n*(W/L)));\n",
+ "V_GS=V_t+V_OV;\n",
+ "V_DS=V_GS;\n",
+ "V_D=V_DS;\n",
+ "print V_D,\"V_D (V)\"\n",
+ "R=(V_DD-V_D)/I_D;\n",
+ "print R/1000,\"R (Kohm)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1.0 V_D (V)\n",
+ "25.0 R (Kohm)\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.4:pg-265"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 4.4 : Design of given circuit to obtain V_D=0.1V\n",
+ "# MOSFET is operating in triode region\n",
+ "V_D=0.1; # (V)\n",
+ "V_DD=5; # (V)\n",
+ "V_t=1; # (V=)\n",
+ "K=1*10**-3; # K=k'_n(W/L)\n",
+ "V_GS=5; # (V)\n",
+ "V_DS=0.1; # (V)\n",
+ "I_D=K*((V_GS-V_t)*V_DS-(V_DS**2)/2);\n",
+ "print I_D*1000,\"=I_D (mA)\"\n",
+ "R_D=(V_DD-V_D)/I_D;\n",
+ "print round(R_D/1000,1),\"=R_D (Kohm)\"\n",
+ "r_DS=V_DS/I_D;\n",
+ "print round(r_DS),\"=r_DS (ohm)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "0.395 =I_D (mA)\n",
+ "12.4 =R_D (Kohm)\n",
+ "253.0 =r_DS (ohm)\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.5:pg-266"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 4.5: To determine all node voltages and currents through all branches\n",
+ "V_t=1; # (V)\n",
+ "K=1*10**-3; # K=k'_n(W/L)\n",
+ "V_DD=10; # (V)\n",
+ "R_G1=10*10**6; # (ohm)\n",
+ "R_G2=10*10**6; # (ohm)\n",
+ "R_D=6*10**3; # (ohm)\n",
+ "R_S=6*10**3; # (ohm)\n",
+ "I_D=0.5 # mA\n",
+ "# I_D=0.89mA will result in transistor cut off hence we take the other root of the equation\n",
+ "V_G=V_DD*R_G2/(R_G2+R_G1);\n",
+ "I_D=I_D*10**-3;\n",
+ "print I_D*1000,\"= I_D (mA)\"\n",
+ "V_S=I_D*R_S;\n",
+ "print V_S,\"= V_S (V)\"\n",
+ "V_GS=V_G-V_S;\n",
+ "print V_GS,\"= V_GS (V)\"\n",
+ "V_D=V_DD-R_D*I_D;\n",
+ "print V_D,\"= V_D (V)\"\n",
+ "# V_D>V_G-V_t the transistor is operating in saturation as initially assumed"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "0.5 = I_D (mA)\n",
+ "3.0 = V_S (V)\n",
+ "2.0 = V_GS (V)\n",
+ "7.0 = V_D (V)\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.6:pg-268"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 4.6; Design of given circuit to obtain I_D=0.5mA and V_D=3V\n",
+ "# MOSFET is in saturation\n",
+ "V_DD=5; # (V)\n",
+ "V_D=3; # (V)\n",
+ "I_D=0.5*10**-3; # (A)\n",
+ "V_t=-1; # (V)\n",
+ "K=1*10**-3; # K=k'_n(W/L)\n",
+ "V_OV=math.sqrt(2*I_D/K);\n",
+ "V_GS=V_t+(-V_OV)\n",
+ "R_D=V_D/I_D;\n",
+ "V_Dmax=V_D-V_t; # - sign as magnitude of V_t is considered\n",
+ "R_D=V_Dmax/I_D;\n",
+ "print R_D/1000,\"= R_D (Kohm)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "8.0 = R_D (Kohm)\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.7:pg-269"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 4.7: To determine drain currents and output voltage\n",
+ "K_n =1*10**-3; # K_n=k_n*W_n/L_n (A/V**2)\n",
+ "K_p = 1*10**-3; # K_p=k_p*W_p/L_p (A/V**2)\n",
+ "V_tn= 1; # (V)\n",
+ "V_tp= -1; # (V)\n",
+ "V_I=-2.5; # (V)\n",
+ "V_DD=2.5; # (V)\n",
+ "R=10;# (kilo ohm)\n",
+ "# For V_I=0\n",
+ "I_DP=(K_p*(V_DD-V_tn)**2)/2;\n",
+ "I_DN=I_DP;\n",
+ "print round(I_DP*1000,3),\"= I_DP (mA) and \",round(I_DN*1000,1),\"=I_DN (A) for V_I=0V\"\n",
+ "print 0,\"= V_O for V_I =0V\"\n",
+ "# For V_I=2.5V\n",
+ "# I_DN=K_N(V_GS-V_tn)V_DS\n",
+ "# I_DN=v_O/R\n",
+ "# Solving the two equations we get\n",
+ "I_DN=0.244*10**-3; # (V)\n",
+ "V_O=-2.44; # (V)\n",
+ "print V_O,\"= V_O and\",round(I_DN*1000,2),\"= I_DN for V_I=2.5V\"\n",
+ "# For V_I=-2.5V Q_N is cut off\n",
+ "I_DP=2.44*10**-3; # (A)\n",
+ "V_O=2.44; # (V)\n",
+ "print V_O,\"= V_O(V), \",round(I_DP*1000,2),\"=I_DP (mA) and\",0,\"= I_DN (A) for V_I=-2.5V\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1.125 = I_DP (mA) and 1.1 =I_DN (A) for V_I=0V\n",
+ "0 = V_O for V_I =0V\n",
+ "-2.44 = V_O and 0.24 = I_DN for V_I=2.5V\n",
+ "2.44 = V_O(V), 2.44 =I_DP (mA) and 0 = I_DN (A) for V_I=-2.5V\n"
+ ]
+ }
+ ],
+ "prompt_number": 28
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.9:pg-283"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 4.9 : Design of given circuit to obtain I_D=0.5mA\n",
+ "I_d=0.5*10**-3; # (A)\n",
+ "I_S=0.5*10**-3; # (A)\n",
+ "V_t=1; # (V)\n",
+ "K_n=1*10**-3; # K_n=k_n*W/L (A/V**2)\n",
+ "V_DD=15; # (V)\n",
+ "V_D=10; # (V)\n",
+ "V_S=5; # (V)\n",
+ "R_D=(V_DD-V_D)/I_d;\n",
+ "R_S=V_S/I_S;\n",
+ "V_OV=math.sqrt(I_d*2/K_n);\n",
+ "V_GS=V_t+V_OV;\n",
+ "V_G=V_S+V_GS;\n",
+ "# V_t=1.5V\n",
+ "# I_D=K(V_GS-V_t)**2/2\n",
+ "# 7=V_GS+10I_D\n",
+ "# solving above equations \n",
+ "I_D=0.455*10**-3;\n",
+ "deltaI_D=I_D-I_d; # Change in I_D (A)\n",
+ "change=deltaI_D*100/I_d; # Change in %\n",
+ "print round(change,2),\"= Change in I_D (%)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "-9.0 = Change in I_D (%)\n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.10:pg-293"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 4.10 : Small signal analysis\n",
+ "V_t=1.5; # (V)\n",
+ "K=0.00025;#K= k_nW/L (A/V**2)\n",
+ "V_A=50; # (V)\n",
+ "I_D=1.06*10**-3; # (A)\n",
+ "V_D=4.4; # (V)\n",
+ "R_D=10000; # (ohm)\n",
+ "R_L=10000; # (ohm)\n",
+ "V_GS=V_D;\n",
+ "g_m=K*(V_GS-V_t);\n",
+ "r_o=V_A/I_D;\n",
+ "A_v=-g_m*(R_L*R_D*r_o)/(R_D*R_L+R_D*r_o+R_L*r_o);\n",
+ "print round(A_v,1),\"= Voltage gain (V/V)\"\n",
+ "R_G=10*10**6; #(ohm)\n",
+ "# i_i=v_i*(1-A_v)/R_G\n",
+ "R_in=R_G/(1-(A_v));\n",
+ "print round(R_in/1e6,1),\"= Input resistance (Mohm)\"\n",
+ "# v_DSmin=v_GSmin-V_t\n",
+ "v_i=V_t/(1+(-A_v)); # - sign to make A_v positive\n",
+ "print round(v_i,2),\"= Largest allowable input signal (V)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "-3.3 = Voltage gain (V/V)\n",
+ "2.3 = Input resistance (Mohm)\n",
+ "0.35 = Largest allowable input signal (V)\n"
+ ]
+ }
+ ],
+ "prompt_number": 35
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.11:pg-304"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 4.11: To determine all parameters of transistor amplifier\n",
+ "v_o=90; # (V)\n",
+ "v_i=9; # (V)\n",
+ "R_sig=100.0*10**3; # (ohm)\n",
+ "R_L=10.0*10**3; # (ohm)\n",
+ "v_sig=10; # (V)\n",
+ "A_vo=v_o/v_i;\n",
+ "print A_vo,\"= A_vo (V/V)\"\n",
+ "G_vo=v_o/A_vo;\n",
+ "print G_vo,\"= G_vo (V/V)\"\n",
+ "R_i=G_vo*R_sig/(A_vo-G_vo)\n",
+ "print R_i/1000,\"= R_i in Kohm\"\n",
+ "print \"assume R_L = 10 kilo ohm is connected\"\n",
+ "v_o=70.0; # (V)\n",
+ "v_i=8; # (V)\n",
+ "A_v=v_o/v_i;\n",
+ "print A_v,\"= A_v (V/V)\"\n",
+ "G_v=v_o/A_vo;\n",
+ "print G_v,\"= G_v (V/V)\"\n",
+ "R_o=R_L*(A_vo-A_v)/A_v;\n",
+ "print round(R_o/1000,2),\"= R_o (Kohm)\"\n",
+ "R_out=R_L*(G_vo-G_v)/G_v;\n",
+ "print round(R_out/1000,2),\"= R_out (Kohm)\"\n",
+ "R_in=(v_i*100)/(v_sig-v_i);\n",
+ "print R_in,\"= R_in (Kohm)\"\n",
+ "G_m=A_vo/R_o;\n",
+ "print G_m,\"= G_m (mho)\"\n",
+ "A_i=A_v*R_in/R_L;\n",
+ "print A_i,\"= A_i (V/V)\"\n",
+ "R_inL0=R_sig/((1+R_sig/R_i)*(R_out/R_o)-1); # R_in|R_L=0 (ohm)\n",
+ "print round(R_inL0/1000,1),\"= R_in at R_L=0\"\n",
+ "A_is=A_vo*R_inL0/R_o;\n",
+ "print int(A_is),\"= A_is (A/A)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "10 = A_vo (V/V)\n",
+ "9 = G_vo (V/V)\n",
+ "900.0 = R_i in Kohm\n",
+ "assume R_L = 10 kilo ohm is connected\n",
+ "8.75 = A_v (V/V)\n",
+ "7.0 = G_v (V/V)\n",
+ "1.43 = R_o (Kohm)\n",
+ "2.86 = R_out (Kohm)\n",
+ "400 = R_in (Kohm)\n",
+ "0.007 = G_m (mho)\n",
+ "0.35 = A_i (V/V)\n",
+ "81.8 = R_in at R_L=0\n",
+ "572 = A_is (A/A)\n"
+ ]
+ }
+ ],
+ "prompt_number": 43
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.12:pg-331"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 4.12 : Midband gain and upper 3dB frequency\n",
+ "R_sig= 100.0*10**3; # (ohm)\n",
+ "R_G=4.7*10**6; # (ohm)\n",
+ "R_D=15.0*10**3; # (ohm)\n",
+ "R_l=15.0*10**3; # (ohm)\n",
+ "g_m=1*10.0**-3; # (mho)\n",
+ "r_o=150.0*10**3; # (ohm)\n",
+ "C_gs=1*10.0**-12; # (F)\n",
+ "C_gd=0.4*10**-12; # (F)\n",
+ "R_L= 1.0/(1/r_o + 1/R_D + 1/R_l)\n",
+ "A_M=R_G/(R_G + R_sig)*g_m*R_L;\n",
+ "print round(A_M),\"= midband gain A_M (V/V)\"\n",
+ "C_eq=(1+g_m*R_L)*C_gd;\n",
+ "C_in=C_gs+C_eq;\n",
+ "f_H=(R_G+R_sig)/(2*math.pi*C_in*R_sig*R_G);\n",
+ "print round(f_H/1000),\"= f_H (KHz)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "7.0 = midband gain A_M (V/V)\n",
+ "382.0 = f_H (KHz)\n"
+ ]
+ }
+ ],
+ "prompt_number": 49
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.13:pg-335"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 4.13 : Coupling capacitor values\n",
+ "R_G=4.7*10**6; # (ohm)\n",
+ "R_D=15*10**3; # (ohm)\n",
+ "R_L=15*10**3; # (ohm)\n",
+ "R_sig=100*10**3; # (ohm)\n",
+ "g_m=1*10**-3; # (mho)\n",
+ "f_L=100; # (Hz)\n",
+ "C_S=g_m/(2*math.pi*f_L)\n",
+ "print round(C_S*1e6,1),\"= C_S (microF)\"\n",
+ "f_P2=1/(2*math.pi*C_S/g_m);\n",
+ "f_P1=10; # (Hz)\n",
+ "f_P2=10; # (Hz)\n",
+ "C_C1=1/(2*math.pi*(R_G+R_sig)*10)\n",
+ "print round(C_C1*1e9,1),\"= C_C1 (nanoF)\"\n",
+ "C_C2=1/(2*math.pi*(R_D+R_L)*10)\n",
+ "print round(C_C2*1e6,2),\"= C_C2 (microF)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1.6 = C_S (microF)\n",
+ "3.3 = C_C1 (nanoF)\n",
+ "0.53 = C_C2 (microF)\n"
+ ]
+ }
+ ],
+ "prompt_number": 55
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file