diff options
author | Thomas Stephen Lee | 2015-08-28 16:53:23 +0530 |
---|---|---|
committer | Thomas Stephen Lee | 2015-08-28 16:53:23 +0530 |
commit | db0855dbeb41ecb8a51dde8587d43e5d7e83620f (patch) | |
tree | b95975d958cba9af36cb1680e3f77205354f6512 /Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith | |
parent | 5a86a20b9de487553d4ef88719fb0fd76a5dd6a7 (diff) | |
download | Python-Textbook-Companions-db0855dbeb41ecb8a51dde8587d43e5d7e83620f.tar.gz Python-Textbook-Companions-db0855dbeb41ecb8a51dde8587d43e5d7e83620f.tar.bz2 Python-Textbook-Companions-db0855dbeb41ecb8a51dde8587d43e5d7e83620f.zip |
add books
Diffstat (limited to 'Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith')
13 files changed, 5330 insertions, 0 deletions
diff --git a/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter1.ipynb b/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter1.ipynb new file mode 100755 index 00000000..fb4718f9 --- /dev/null +++ b/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter1.ipynb @@ -0,0 +1,311 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:b8c93f0ed8e762e74a7e32d1ae1c9fc9e20a3917843706f0d24d06eedbf42b4e"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter01:INTRODUCTION TO ELECTRONICS"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex1.1:pg-17"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example1.1: Amplifier gain, power and eficiency\n",
+ "# Amplifier operates at +10-V/-10-V power supply.\n",
+ "A_v=9/1.0; # sinusoidal voltage input of 1V peak and sinusoidal output voltage of 9V peak\n",
+ "I_o=9/1000.0; # 1 kilo ohms load\n",
+ "print A_v,\"= Voltage gain (V/V) \" \n",
+ "print round(20*log10(A_v),1),\"= Voltage gain (dB) \" \n",
+ "I_i=0.0001 # sinusoidal current input of 0.1mA peak\n",
+ "A_i=I_o/I_i;\n",
+ "print A_i,\"= Current gain (A/A) \"\n",
+ "print round(20*log10(A_i),1),\"= Current gain (dB)\"\n",
+ "V_orms = 9/math.sqrt(2);\n",
+ "I_orms = 9/math.sqrt(2);\n",
+ "P_L=V_orms*I_orms; # output power in mW\n",
+ "V_irms=1/math.sqrt(2);\n",
+ "I_irms=0.1/math.sqrt(2);\n",
+ "P_I=V_irms*I_irms; # input power in mW\n",
+ "A_p=P_L/P_I; \n",
+ "print A_p,\"= Power gain (W/W) \"\n",
+ "print round(10*log10(A_p),1),\"= Power gain (dB) \"\n",
+ "P_dc=10*9.5+10*9.5; # amplifier draws a current of 9.5mA from each of its two power supplies\n",
+ "print P_dc,\"= Power drawn from the dc supplies (mW)\"\n",
+ "P_dissipated=P_dc+P_I-P_L;\n",
+ "print round(P_dissipated,1),\"= Power dissipated in the amplifier (mW)\"\n",
+ "n=P_L/P_dc*100;\n",
+ "print round(n,1),\"= Amplifier efficiency in percentage\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "9.0 = Voltage gain (V/V) \n",
+ "19.1 = Voltage gain (dB) \n",
+ "90.0 = Current gain (A/A) \n",
+ "39.1 = Current gain (dB)\n",
+ "810.0 = Power gain (W/W) \n",
+ "29.1 = Power gain (dB) \n",
+ "190.0 = Power drawn from the dc supplies (mW)\n",
+ "149.6 = Power dissipated in the amplifier (mW)\n",
+ "21.3 = Amplifier efficiency in percentage\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex1.2:pg-21"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 1.2: Gain of transistor amplifier\n",
+ "# Amplifier has transfer characteristics v_O=10-(10**-11)*(exp**40*v_1) applies for v_1 is greater than or equal 0V and v_o is greater than or equal to 0.3V\n",
+ "L_l = 0.3; # limit L_-\n",
+ "print round(L_l,2),\"=The limit L_- (V) \"\n",
+ "v_I=1/40.0*math.log((10-0.3)/10**-11); # from the transfer characteristics and v_o=0.3V\n",
+ "print round(v_I,2),\"=v_I in volts \"\n",
+ "L_u=10-10**-11; # obtained by v_I=0 in transfer characteristics\n",
+ "print round(L_u,3),\"=the limit L_+ (V) \"\n",
+ "V_I=1/40.0*math.log((10-5)/10**-11); # V_O=5V\n",
+ "print round(V_I,3),\"=The value of the dc bias voltage that results in V_O=5V (V)\"\n",
+ "A_v=-10**-11*exp(40*V_I)*40; # A_v=dv_O/dv_I\n",
+ "print round(A_v,2),\"=Gain at the operating point (V/V) \"\n",
+ "print \"NOTE the gain is negative that implies the amplifier is an inverting amplifier\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "0.3 =The limit L_- (V) \n",
+ "0.69 =v_I in volts \n",
+ "10.0 =the limit L_+ (V) \n",
+ "0.673 =The value of the dc bias voltage that results in V_O=5V (V)\n",
+ "-200.0 =Gain at the operating point (V/V) \n",
+ "NOTE the gain is negative that implies the amplifier is an inverting amplifier\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex1.3:pg-25"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 1.3 : Overall voltage gain of cthree-stage amplifier\n",
+ "gainloss_in=10**6/(1*10**6+100.0*10**3); # fraction of input signal is obtained using voltage divider rule , gainloss_in= v_i1/v_s\n",
+ "A_v1=10*100000.0/(100000+1000); # A_v1 = v_i2/v_i1 is the voltage gain at first stage\n",
+ "A_v2=100*10000.0/(10000+1000); # A_v2 = v_i3/v_i2 is the voltage gain at second stage\n",
+ "A_v3=100/(100+10.0); # A_v3 = v_L/v_i3 is the voltage gain at the output stage\n",
+ "A_v=A_v1*A_v2*A_v3; # A_v is the total voltage gain \n",
+ "print round(A_v),\" = The overall voltage gain (V/V) \"\n",
+ "print round(20.0*log10(A_v),1),\"= The overall voltage gain (dB) \"\n",
+ "gain_src_ld=A_v*gainloss_in;\n",
+ "print round(gain_src_ld,2),\"= The voltage gain from source to gain (V/V) \"\n",
+ "print round(20.0*log10(gain_src_ld),1),\"= The voltage gain from source to load (dB) \"\n",
+ "A_i=10**4*A_v; # A_i=i_o/i_i=(v_L/100)/(v_i1/10**6)\n",
+ "print \"{:.2e}\".format(A_i),\" = The current gain (A/A)\"\n",
+ "print round(20.0*log10(A_i),1),\"= The current gain (dB) \"\n",
+ "A_p=818*818*10**4; # A_p=P_L/P_I=v_L*i_o/v_i1*i_i\n",
+ "print \"{:.2e}\".format(A_p),\"= The power gain (W/W) \"\n",
+ "print round(10*log10(A_p),1),\"= The power gain (dB) \""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "818.0 = The overall voltage gain (V/V) \n",
+ "58.3 = The overall voltage gain (dB) \n",
+ "743.88 = The voltage gain from source to gain (V/V) \n",
+ "57.4 = The voltage gain from source to load (dB) \n",
+ "8.18e+06 = The current gain (A/A)\n",
+ "138.3 = The current gain (dB) \n",
+ "6.69e+09 = The power gain (W/W) \n",
+ "98.3 = The power gain (dB) \n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex1.4:pg-29"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example1.4 : Bipolar junction transistor\n",
+ "\n",
+ "# 1,4a\n",
+ "# using voltage divider rule the fraction of input signal v_be=v_s*r_pi/(r_pi+R_s)\n",
+ "# output voltage v_o=-g_mv_be(R_L||r_o)\n",
+ "r_pi=2.5*10**3; # (ohm)\n",
+ "R_s=5*10**3; # (ohm)\n",
+ "R_L=5*10**3 # (ohm)\n",
+ "g_m=40*10**-3; # (mho)\n",
+ "r_o=100*10**3; # (ohm)\n",
+ "gain=-(r_pi*g_m*(R_L*r_o/(R_L+r_o)))/(r_pi+R_s); # gain=v_o/v_s\n",
+ "print round(gain,1),\"= The voltage gain (V/V) \"\n",
+ "gain_negl_r_o=-r_pi*g_m*R_L/(r_pi+R_s);\n",
+ "print round(gain_negl_r_o,1),\"= Gain neglecting the effect of r_o (V/V) \"\n",
+ "\n",
+ "# 1.4b\n",
+ "# Bi_b=g_m*v_be\n",
+ "# B is short circuit gain\n",
+ "B=g_m*r_pi;\n",
+ "print B,\"= The short circuit gain (A/A) \""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "-63.5 = The voltage gain (V/V) \n",
+ "-66.7 = Gain neglecting the effect of r_o (V/V) \n",
+ "100.0 = The short circuit gain (A/A) \n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex1.5:pg-36"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 1.5 : DC gain, 3dB frequency and frequency at which gain=0 of voltage amplifier\n",
+ "\n",
+ "# 1.5b\n",
+ "R_s =20*10**3; # (ohm)\n",
+ "R_i =100.0*10**3; # (ohm)\n",
+ "C_i =60.0*10**-12; # (ohm)\n",
+ "u = 144.0; # (V/V)\n",
+ "R_o = 200.0; # (ohm)\n",
+ "R_L = 1000; # (ohm)\n",
+ "K=u/((1+R_s/R_i)*(1+R_o/R_L));\n",
+ "print K,\"= The dc gain (V/V)\"\n",
+ "print round(20*log10(K),2),\" = The dc gain (dB) \"\n",
+ "w_o=1/(C_i*R_s*R_i/(R_s+R_i));\n",
+ "print \"{:.0e}\".format(w_o),\" = The 3-dB frequency (rad/s) \"\n",
+ "f_o= w_o/2/math.pi;\n",
+ "print round(f_o/1000,1),\" = Frequency (KHz) \"\n",
+ "print \"{:.0e}\".format(100*w_o),\" = unity gain frequency (rad/s)\"\n",
+ "print round(100*f_o/1e6,2),\" = Unity gain frequency (MHz)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "100.0 = The dc gain (V/V)\n",
+ "40.0 = The dc gain (dB) \n",
+ "1e+06 = The 3-dB frequency (rad/s) \n",
+ "159.2 = Frequency (KHz) \n",
+ "1e+08 = unity gain frequency (rad/s)\n",
+ "15.92 = Unity gain frequency (MHz)\n"
+ ]
+ }
+ ],
+ "prompt_number": 39
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex1.6:pg-46"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 1.6: Time for the output to reach (V_OH+V_OL)/2\n",
+ "V_DD=5; # (V)\n",
+ "R=1000.0; # (ohm)\n",
+ "R_on=100.0; # (ohm)\n",
+ "V_offset=0.1; # (V)\n",
+ "C=10.0*10**-12; # (F)\n",
+ "V_OH=5; # (V)\n",
+ "V_OL=V_offset+(V_DD-V_offset)*R_on/(R+R_on);\n",
+ "T=R*C;\n",
+ "v_o_t_PLH=(V_OH+V_OL)/2; #to find t_PLH \n",
+ "t_PLH=0.69*T;# t_PLH is low to high propogtion delay\n",
+ "print t_PLH/1e-9,\"= time required for the output to reach (V_OH+V_OL)/2 (miliseconds) \""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "6.9 = time required for the output to reach (V_OH+V_OL)/2 (miliseconds) \n"
+ ]
+ }
+ ],
+ "prompt_number": 46
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter10.ipynb b/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter10.ipynb new file mode 100755 index 00000000..1ea303b0 --- /dev/null +++ b/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter10.ipynb @@ -0,0 +1,291 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:21296c3701295d5c104cbfb8dc3256ad4c96ab638c655298f128fa59daa0a30d"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter10: Digital CMOS Logic Circuits"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex10.1:pg-962"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 10.1 : To determine t_PHL, t_PLH and t_P\n",
+ "# Consider CMOS inverter\n",
+ "import math\n",
+ "C_ox=6*10.0**-15; # (F/um**2)\n",
+ "uC_n=115.0*10**-6; #uC_n=u_n*C_ox (A/V**2)\n",
+ "uC_p=30.0*10**-6; #uC_p=u_p*C_ox (A/V**2)\n",
+ "V_tn=0.4; # (V)\n",
+ "V_tp=-0.4; # (V)\n",
+ "V_DD=2.5; # (V)\n",
+ "W_n=0.375*10**-6; # W for Q_N\n",
+ "L_n=0.25*10**-6; # L for Q_N\n",
+ "W_p=1.125*10**-6; # W for Q_P\n",
+ "L_p=0.25*10**-6; # L for Q_P\n",
+ "C_gd1=0.3*W_n*10**-9; # (F)\n",
+ "C_gd2=0.3*W_p*10**-9; # (F)\n",
+ "C_db1=10**-15; # (F)\n",
+ "C_db2=10**-15; # (F)\n",
+ "C_g3= 0.375*0.25*6*10**-15+2*0.3*0.375*10**-15; # (F)\n",
+ "C_g4=1.125*0.25*6*10**-15+2*0.3*1.125*10**-15; # (F)\n",
+ "C_w=0.2*10**-15; # (F)\n",
+ "C=2*C_gd1+2.0*C_gd2+C_db1+C_db2+C_g3+C_g4+C_w; # (F)\n",
+ "i_DN0=uC_n*W_n*(V_DD-V_tn)**2/(2*L_n); # i_DN0 = i_DN(0) (A)\n",
+ "i_DNtPHL=uC_n*W_n*((V_DD-V_tn)*V_DD/2-((V_DD/2.0)**2)/2.0)/L_n; # i_DNtPHL = i_DN(t_PHL) (A)\n",
+ "i_DNav=(i_DN0+i_DNtPHL)/2; # i_DN|av (A)\n",
+ "t_PHL=C*(V_DD/2)*1e12/i_DNav;\n",
+ "print math.ceil(t_PHL),\"= t_PHL (picoseconds)\"\n",
+ "t_PLH=1.3*t_PHL; # Since W_p/W_n=3 and u_n/u_p=3.83 thus t_PLH is greater than t_PHL by 3.83/3\n",
+ "print round(t_PLH,-1),\"= t_PLH (picoseconds)\"\n",
+ "t_P=(t_PHL+t_PLH)/2; \n",
+ "print round(t_P),\"= t_P (picoseconds)\"\n",
+ "\n",
+ " # the answer in the textbook is slightly dirfferent due to approximation"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "23.0 = t_PHL (picoseconds)\n",
+ "30.0 = t_PLH (picoseconds)\n",
+ "26.0 = t_P (picoseconds)\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex10.2:pg-972"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 10.2 : W/L ratios for the logic circuit\n",
+ "#For basic inverter\n",
+ "n=1.5;\n",
+ "p=5;\n",
+ "L=0.25*10**-6; # (m)\n",
+ "WbyL=2*n; # W/L for Q_NB , Q_NC , Q_ND\n",
+ "print WbyL,\"= W/L ratio for Q_NB\"\n",
+ "print WbyL,\"= W/L ratio for Q_NC\"\n",
+ "print WbyL,\"= W/L ratio for Q_ND\"\n",
+ "WbyL=n; # W/L ratio for Q_NA\n",
+ "print WbyL,\"= W/L ratio for Q_NA\"\n",
+ "WbyL=3*p; # W/L for Q_PA, Q_PC , Q_PD\n",
+ "print WbyL,\"= W/L ratio for Q_PA\" \n",
+ "print WbyL,\"= W/L ratio for Q_PC\"\n",
+ "print WbyL,\"= W/L ratio for Q_PD\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "3.0 = W/L ratio for Q_NB\n",
+ "3.0 = W/L ratio for Q_NC\n",
+ "3.0 = W/L ratio for Q_ND\n",
+ "1.5 = W/L ratio for Q_NA\n",
+ "15 = W/L ratio for Q_PA\n",
+ "15 = W/L ratio for Q_PC\n",
+ "15 = W/L ratio for Q_PD\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex10.3:pg-981"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 10.3 : To determine the parameters of pseudo NMOS inverter\n",
+ "# Consider a pseudo NMOS inverter\n",
+ "uC_n=115.0*10**-6; #uC_n=u_n*C_ox (A/V**2)\n",
+ "uC_p=30*10.0**-6; #uC_p=u_p*C_ox (A/V**2)\n",
+ "V_tn=0.4; # (V)\n",
+ "V_tp=-0.4; # (V)\n",
+ "V_DD=2.5; # (V)\n",
+ "W_n=0.375*10**-6; # W for Q_N (m)\n",
+ "L_n=0.25*10**-6; # L for Q_N (m)\n",
+ "r=9.0;\n",
+ "\n",
+ "# 10.3a\n",
+ "V_OH=V_DD;\n",
+ "print round(V_OH,2),\"= V_OH (V)\"\n",
+ "V_OL=(V_DD-V_tn)*(1-math.sqrt(1.0-1/r));\n",
+ "print round(V_OL,2),\"= V_OL (V)\"\n",
+ "V_IL=V_tn+(V_DD-V_tn)/math.sqrt(r*(r+1.0));\n",
+ "print round(V_IL,2),\"=V_IL (V)\"\n",
+ "V_IH=V_tn+2*(V_DD-V_tn)/(math.sqrt(3.0*r));\n",
+ "print round(V_IH,2),\"= V_IH (V)\"\n",
+ "V_M=V_tn+(V_DD-V_tn)/math.sqrt(r+1.0);\n",
+ "print round(V_M,2),\"= V_M (V)\"\n",
+ "NM_H=V_OH-V_IH;\n",
+ "NM_L=V_IL-V_OL;\n",
+ "print round(NM_H,2),\"=The highest and the lowest values of allowable noise margin (V)=\",round(NM_L,2)\n",
+ "\n",
+ "# 10.3b\n",
+ "WbyL_p=uC_n*(W_n/L_n)/(uC_p*r); # WbyL_p=(W/L)_p\n",
+ "print round(WbyL_p,2),\"=(W/L)_p\"\n",
+ "\n",
+ "#10.3c\n",
+ "I_stat=(uC_p*WbyL_p*(V_DD-V_tn)**2)/2;\n",
+ "print round(I_stat*1e6,1),\"=I_stat (microA)\"\n",
+ "P_D=I_stat*V_DD;\n",
+ "print round(P_D*1e6),\"=Static power dissipation P_D (microW)\"\n",
+ "\n",
+ "#10.3d\n",
+ "C=7*10**-15;\n",
+ "t_PLH=1.7*C/(uC_p*WbyL_p*V_DD);\n",
+ "print round(t_PLH*1e9,2),\"=t_PLH (ns)\"\n",
+ "t_PHL=1.7*C/(uC_n*(W_n/L_n)*math.sqrt(1-0.46/r)*V_DD);\n",
+ "print round(t_PHL*1e9,2),\"= t_PHL (ns)\"\n",
+ "t_p=(t_PHL+t_PLH)/2.0;\n",
+ "print round(t_p*1e9,2),\"= t_p (ns)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "2.5 = V_OH (V)\n",
+ "0.12 = V_OL (V)\n",
+ "0.62 =V_IL (V)\n",
+ "1.21 = V_IH (V)\n",
+ "1.06 = V_M (V)\n",
+ "1.29 =The highest and the lowest values of allowable noise margin (V)= 0.5\n",
+ "0.64 =(W/L)_p\n",
+ "42.3 =I_stat (microA)\n",
+ "106.0 =Static power dissipation P_D (microW)\n",
+ "0.25 =t_PLH (ns)\n",
+ "0.03 = t_PHL (ns)\n",
+ "0.14 = t_p (ns)\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex10.4:pg-985"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 10.4 : To determine parameters for NMOS transistor\n",
+ "# Consider NMOS transistor switch\n",
+ "uC_n=50.0*10**-6; #uC_n=u_n*C_ox (A/V**2)\n",
+ "uC_p=20.0*10.0**-6; #uC_px `=u_p*C_ox (A/V**2)\n",
+ "V_tO=1.0; # (V)\n",
+ "y=0.5; # (V**1/2)\n",
+ "fie_f=0.6/2; # (V)\n",
+ "V_DD=5; # (V)\n",
+ "W_n=4*10.0**-6; # (m)\n",
+ "L_n=2*10.0**-6; # (m)\n",
+ "C=50*10.0**-15; # (F)\n",
+ "\n",
+ "# 10.4a\n",
+ "V_t=1.6; # (V)\n",
+ "V_OH=V_DD-V_t; # V_OH is the value of v_O at which Q stops conducting (V)\n",
+ "print V_OH,\"= V_OH (V)\"\n",
+ " \n",
+ "# 10.4b\n",
+ "W_p=10.0*10**-6; # (m)\n",
+ "L_p=2*10.0**-6; # (m)\n",
+ "i_DP=uC_p*W_p*((V_DD-V_OH-V_tO)**2)/(2*L_p);\n",
+ "print round(i_DP*1e6),\"= Static current of the inverter (microA)\"\n",
+ "P_D=V_DD*i_DP;\n",
+ "print round(P_D*1e6),\"= Power dissipated (microW)\"\n",
+ "V_O=0.08; # Output voltage (V) found by equating the current of Q_N=18uA\n",
+ "print round(V_O,2),\"= The output voltage of the inverter (V) \"\n",
+ "\n",
+ "# 10.4c\n",
+ "i_D0=uC_n*W_n*((V_DD-V_tO)**2)/(2*2*10**-6); # i_D0=i_D(0) (A) current i_D at t=0\n",
+ "v_O=2.5; # (V)\n",
+ "V_t=V_tO+0.5*(math.sqrt(v_O+2*fie_f)-math.sqrt(2*fie_f)); # at v_O=2.5V\n",
+ "i_DtPLH=(uC_n*W_n*(V_DD-v_O-V_t)**2)/(2*L_n); # i_DtPLH=i_D(t_PLH) (A) current i_D at t=t_PLH\n",
+ "i_Dav=(i_D0+i_DtPLH)/2; # i_Dav=i_D|av (A) average discharge current\n",
+ "t_PLH=C*(V_DD/2)/i_Dav;\n",
+ "print round(t_PLH*1e9,2),\"t_PHL (ns)\"\n",
+ "\n",
+ "# 10.4d\n",
+ "# Case with v_t going low\n",
+ "i_D0=uC_n*W_n*((V_DD-V_tO)**2)/(2*2*10**-6); # i_D0=i_D(0) (A) current i_D at t=0\n",
+ "i_DtPHL=uC_n*W_n*((V_DD-V_tO)*v_O-(v_O**2)/2.0)/(L_n); # i_DtPHL=i_D(t_PHL) (A) current i_D at t=T_PHL\n",
+ "i_Dav=(i_D0+i_DtPHL)/2; # i_Dav=i_D|av (A) average discarge current\n",
+ "t_PHL=C*(V_DD/2)/i_Dav;\n",
+ "print round(t_PHL*1e9,2),\"= t_PHL (ns)\"\n",
+ "\n",
+ "# 10.4e\n",
+ "t_P=(t_PHL+t_PLH)/2;\n",
+ "print round(t_P*1e9,2),\"= t_P (ns)\"\n",
+ " # the answer in the textbook is slightly dirfferent due to approximation"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "3.4 = V_OH (V)\n",
+ "18.0 = Static current of the inverter (microA)\n",
+ "90.0 = Power dissipated (microW)\n",
+ "0.08 = The output voltage of the inverter (V) \n",
+ "0.24 t_PHL (ns)\n",
+ "0.13 = t_PHL (ns)\n",
+ "0.18 = t_P (ns)\n"
+ ]
+ }
+ ],
+ "prompt_number": 34
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter11.ipynb b/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter11.ipynb new file mode 100755 index 00000000..efbba551 --- /dev/null +++ b/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter11.ipynb @@ -0,0 +1,140 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:32762f08f8decdcb2472567b8bb56aa30546cb37837b4beaf1c667dc49e7e0c1"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter11:Memory and Advanced\n",
+ "Digital Circuits"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex11.1:pg-1017"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# The problem is solved using Hit and Trial as well as approximation thus no programming is needed hence the example is skipped"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex11.2:pg-1032"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 11.2 Design of two-stage CMOS op-amp \n",
+ "\n",
+ "uC_n=50*10**-6; # u_n*C_ox (A/V**2)\n",
+ "uC_p=20.0*10**-6; # u_p*C_ox (A/V**2)\n",
+ "V_tn0=1.0; # (V)\n",
+ "V_tp0=-1; # (V)\n",
+ "fie_f=0.6/2; # (V)\n",
+ "y=0.5; # (V**1/2)\n",
+ "V_DD=5; # (V)\n",
+ "W_n=4*10.0**-6; # (m)\n",
+ "L_n=2*10.0**-6; # (m)\n",
+ "W_p=10*10**-6; # (m)\n",
+ "L_p=2*10.0**-6; # (m)\n",
+ "W=10*10**-6; # (m)\n",
+ "L=10*10.0**-6; # (m)\n",
+ "C_B=1*10.0**-12; # bit line capacitance (F)\n",
+ "deltaV=0.2; # 0.2 V decrement\n",
+ "WbyL_eq=1/(L_p/W_p+L_n/W_n); # WbyL_eq=(W/L)_eq\n",
+ "# Equivalent transistor will operate in saturation\n",
+ "I=(uC_n*WbyL_eq*(V_DD-V_tn0)**2)/2\n",
+ "r_DS=1/(uC_n*(W_n/L_n)*(V_DD-V_tn0));\n",
+ "v_Q=r_DS*I; # v_Q=r_DS*I\n",
+ "I_5=0.5*10.0**-3; # (A) \n",
+ "deltat=C_B*deltaV/I_5;\n",
+ "print deltat*1e9, \"is The time (ns) required to develop an output voltage of 0.2V\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "0.4 is The time (ns) required to develop an output voltage of 0.2V\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex11.3:pg-1041"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 11.3 : Time required for v_B to reach 4.5V\n",
+ "# Consider sense-amplifier circuit\n",
+ "uC_n=50*10**-6; #uC_n=u_n*C_ox (A/V**2)\n",
+ "uC_p=20*10**-6; #uC_p=u_p*C_ox (A/V**2)\n",
+ "W_n=12*10**-6; # (m)\n",
+ "L_n=4*10**-6; # (m)\n",
+ "W_p=30*10**-6; # (m)\n",
+ "L_p=4*10**-6; # (m)\n",
+ "v_B=4.5; # (V)\n",
+ "C_B=1*10**-12; # (F)\n",
+ "V_GS=2.5; # (V)\n",
+ "V_t=1; # (V)\n",
+ "deltaV=0.1; # (V)\n",
+ "g_mn=uC_n*(W_n/L_n)*(V_GS-V_t); # (A/V)\n",
+ "g_mp=uC_p*(W_p/L_p)*(V_GS-V_t); # (A/V)\n",
+ "G_m=g_mn+g_mp; # (A/V)\n",
+ "T=C_B/G_m; # (s)\n",
+ "deltat=T*(math.log(v_B/V_GS)-math.log(deltaV));\n",
+ "print round(deltat*1e9,1),\" is The time for v_B to reach 4.5V (s)\"\n",
+ "# The answer in the textbook is slightly different due to approximation"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "6.4 is The time for v_B to reach 4.5V (s)\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter12.ipynb b/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter12.ipynb new file mode 100755 index 00000000..530e0f53 --- /dev/null +++ b/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter12.ipynb @@ -0,0 +1,66 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:0d870b040ee224c1f9fb208e7b24af7cd3362e9d307710cf1a001e89fa523e12"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter12:Filters and Tuned Amplifiers"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex12.4:pg-1143"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 12.4 To design tuned amplifier\n",
+ "\n",
+ "cfg=-10; # Center frequency gain (V/V)\n",
+ "g_m=0.005; # (A/V)\n",
+ "r_o=10000; # (ohm)\n",
+ "f_o=1*10**6; # (Hz)\n",
+ "B=2*math.pi*10**4; # Bandwidth\n",
+ "R=-cfg/g_m;\n",
+ "R_L=R*r_o/(r_o-R);\n",
+ "print R_L/1000,\"= R_L (kohm)\"\n",
+ "C=1/(R*B)\n",
+ "print round(C*1e12),\"= C (picoF)\"\n",
+ "w_o=2*math.pi*f_o;\n",
+ "L=1/(w_o**2*C);\n",
+ "print round(L*1e6,2),\"= L (microH)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "2.5 = R_L (kohm)\n",
+ "7958.0 = C (picoF)\n",
+ "3.18 = L (microH)\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter14.ipynb b/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter14.ipynb new file mode 100755 index 00000000..5bdfcf5d --- /dev/null +++ b/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter14.ipynb @@ -0,0 +1,269 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:04c770610947ad7b99d743d99cd805c99779dc1a6616f379e3e115323e61d9f6"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter14:Output Stages and Power Amplifiers"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex14.1:pg-1239"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 14.1 To design a Class B Output Amplifier\n",
+ "\n",
+ "P_L=20; # Average power (W) \n",
+ "R_L=8; # Load resistance (ohm)\n",
+ "V_o=math.sqrt(2*P_L*R_L); \n",
+ "print round(V_o,1),\"= Supply voltage required (V)\"\n",
+ "V_CC=23; # We select this voltage (V)\n",
+ "I_o=V_o/R_L;\n",
+ "print round(I_o,2),\"= Peak current drawn from each supply (A)\"\n",
+ "P_Sav=V_CC*I_o/math.pi; # P_S+ = P_S- = P_Sav\n",
+ "P_S=P_Sav+P_Sav; # Total supply power\n",
+ "print round(P_S,1),\"= The total power supply (W)\"\n",
+ "n=P_L/P_S; # n is power conversion efficiency\n",
+ "print round(n*100),\" = Power conversion efficiency %\"\n",
+ "P_DPmax=V_CC**2/(math.pi**2*R_L);\n",
+ "P_DNmax=P_DPmax;\n",
+ "print round(P_DPmax,1),\"= Maximun power dissipated in each transistor (W)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "17.9 = Supply voltage required (V)\n",
+ "2.24 = Peak current drawn from each supply (A)\n",
+ "32.7 = The total power supply (W)\n",
+ "61.0 = Power conversion efficiency %\n",
+ "6.7 = Maximun power dissipated in each transistor (W)\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex14.2:pg-1245"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 14.2 To determine quiescent current and power\n",
+ "# Consider Class AB Amplifier\n",
+ "V_CC=15; # (V)\n",
+ "R_L=100; # (ohm)\n",
+ "v_O=-10; # Amplitude of sinusoidal output voltage (V)\n",
+ "I_S=10**-13; # (A)\n",
+ "V_T=25*10**-3; # (V)\n",
+ "B=50; # Beta value\n",
+ "i_Lmax=10/(0.1*10**3); # Maximum current through Q_N (A)\n",
+ "# Implies max base curent in Q_N is approximately 2mA\n",
+ "I_BIAS=3*10**-3; # We select I_BIAS=3mA in order to maintain a minimum of 1mA through the diodes\n",
+ "I_Q=9*10**-3; # The area ratio of 3 yeilds quiescent current of 9mA\n",
+ "P_DQ=2*V_CC*I_Q;\n",
+ "print round(P_DQ*1000),\"= Quiescent power dissipation (mW)\"\n",
+ "#For v_O=0V base current of Q_N is 9/51=0.18 mA\n",
+ "# Leaves a current of 3-0.18=2.83mA to flow through the diodes\n",
+ "I_S= (10**-13)/3; # Diodes have I_S = (1*10**-13)/3 \n",
+ "V_BB=2*V_T*math.log((2.83*10**-3)/I_S);\n",
+ "print round(V_BB,2),\"= V_BB (V) for v_O = 0V\"\n",
+ "# For v_O=+10V, current through the diodes will decrease to 1mA\n",
+ "V_BB=2*V_T*math.log((1*10**-3)/I_S);\n",
+ "print round(V_BB,2),\"= V_BB (V) for v_O = +10V\"\n",
+ "# For v_O=-10V , Q_N will conduct very small current thus base current is negligible\n",
+ "# All of the I_BIAS(3mA) flows through the diodes\n",
+ "V_BB=2*V_T*math.log((3*10**-3)/I_S);\n",
+ "print round(V_BB,2),\"= V_BB (V) for v_O = -10V\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "270.0 = Quiescent power dissipation (mW)\n",
+ "1.26 = V_BB (V) for v_O = 0V\n",
+ "1.21 = V_BB (V) for v_O = +10V\n",
+ "1.26 = V_BB (V) for v_O = -10V\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex14.3:pg-1248"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 14.3 Redesign the output stage of Example 14.2\n",
+ "V_T=25*10**-3; # (V)\n",
+ "I_S=10**-14; # (A)\n",
+ "I_Q=2*10**-3; # Required quiescent current (A)\n",
+ "# We select I_BIAS=3mA which is divided between I_R and I_C1\n",
+ "# Thus we select I_R=0.5mA and I_C1=2.5mA\n",
+ "V_BB=2*V_T*math.log(I_Q/10**-13);\n",
+ "print round(V_BB,2),\"=V_BB (V)\"\n",
+ "I_R=0.5*10**-3;\n",
+ "R1plusR2=V_BB/I_R; # R1plusR2 = R_1+R_2\n",
+ "I_C1=2.5*10**-3;\n",
+ "V_BE1=V_T*math.log(I_C1/I_S);\n",
+ "print round(V_BE1,2),\"= V_BE1 (V)\"\n",
+ "R_1=V_BE1/I_R;\n",
+ "print round(R_1/1000,2),\"R_1 (Kohm)\"\n",
+ "R_2=R1plusR2-R_1;\n",
+ "print round(R_2/1000,2),\"R_2 (Kohm)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1.19 =V_BB (V)\n",
+ "0.66 = V_BE1 (V)\n",
+ "1.31 R_1 (Kohm)\n",
+ "1.06 R_2 (Kohm)\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex14.4:pg-1251"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 14.4 To determine thermal resistance, junction temperature \n",
+ "# Consider BJT with following specifications\n",
+ "P_D0=2; # Maximum power dissipation (W)\n",
+ "T_A0=25.0; # Ambient temperature (degree celcius)\n",
+ "T_Jmax=150.0; # maximum junction temperature (degree celcius) \n",
+ "\n",
+ "# 14.4a \n",
+ "theta_JA=(T_Jmax-T_A0)/P_D0; # Thermal resistance\n",
+ "print theta_JA,\"is The thermal resistance (degree celsius/W)\"\n",
+ "\n",
+ "# 14.4b\n",
+ "T_A=50.0; # (degree celcius)\n",
+ "P_Dmax=(T_Jmax-T_A)/theta_JA; \n",
+ "print P_Dmax,\"is Maximum power that can be dissipated at an ambient temperature of 50 degree celsius (W)\"\n",
+ "\n",
+ "# 14.4c\n",
+ "T_A=25.0; # (degree celcius) \n",
+ "P_D=1; # (W)\n",
+ "T_J=T_A+theta_JA*P_D;\n",
+ "print T_J,\"is Junction temperature (degree celcius) if the device is operating at T_A=25 degree celsius and is dissipating 1W\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "62.5 is The thermal resistance (degree celsius/W)\n",
+ "1.6 is Maximum power that can be dissipated at an ambient temperature of 50 degree celsius (W)\n",
+ "87.5 is Junction temperature (degree celcius) if the device is operating at T_A=25 degree celsius and is dissipating 1W\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex14.5:pg-1253"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 14.5 To determine the maximum power dissipated \n",
+ "# Consider a BJT with following specifications\n",
+ "T_Jmax=150; # (degree celcius)\n",
+ "T_A=50; # (degree celcius)\n",
+ "\n",
+ "# 14.5a\n",
+ "theta_JA=62.5; # (degree celcius/W)\n",
+ "P_Dmax=(T_Jmax-T_A)/theta_JA;\n",
+ "print round(P_Dmax,2),\"is The maximum power (W) that can be dissipated safely by the transistor when operated in free air\"\n",
+ "\n",
+ "#14.5b\n",
+ "theta_CS=0.5; # (degree celcius/W)\n",
+ "theta_SA=4; # (degree celcius/W)\n",
+ "theta_JC=3.12; # (degree celcius/W)\n",
+ "theta_JA=theta_JC+theta_CS+theta_SA;\n",
+ "P_Dmax=(T_Jmax-T_A)/theta_JA\n",
+ "print round(P_Dmax,1),\"is The maximum power (W) that can be dissipated safely by the transistor when operated at an ambient temperature of 50 degree celcius but with a heat sink for which theta_CS= 0.5 (degree celcius/W) and theta_SA = 4 (degree celcius/W) (W)\"\n",
+ "\n",
+ "# 14.5c\n",
+ "theta_CA=0 # since infinite heat sink\n",
+ "P_Dmax=(T_Jmax-T_A)/theta_JC;\n",
+ "print round(P_Dmax),\"is The maximum power (W) that can be dissipated safely if an infinite heat sink is used and T_A=50 (degree celcius)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1.6 is The maximum power (W) that can be dissipated safely by the transistor when operated in free air\n",
+ "13.1 is The maximum power (W) that can be dissipated safely by the transistor when operated at an ambient temperature of 50 degree celcius but with a heat sink for which theta_CS= 0.5 (degree celcius/W) and theta_SA = 4 (degree celcius/W) (W)\n",
+ "32.0 is The maximum power (W) that can be dissipated safely if an infinite heat sink is used and T_A=50 (degree celcius)\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter2.ipynb b/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter2.ipynb new file mode 100755 index 00000000..0ae95a48 --- /dev/null +++ b/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter2.ipynb @@ -0,0 +1,135 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:9248ce0e9925b4b2a2db19b4a563a9dcd0c2615021a9c00f051f93b7c452821b"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter02:Operational Amplifiers"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.1:pg-72"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 2.1 : Closed loop and open loop gain\n",
+ "# Consider inverting configuration\n",
+ "\n",
+ "# 2.1a\n",
+ "R_1=1000.0; # (ohm)\n",
+ "R_2=100*10.0**3; # (ohm)\n",
+ "A=10**3; # (V/V)\n",
+ "print A,\"= A (V/V)\"\n",
+ "G=-R_2/R_1/(1+(1+R_2/R_1)/A);\n",
+ "print round(-G,2),\"= G\"\n",
+ "e=(-G-(R_2/R_1))/(R_2/R_1)*100;\n",
+ "print round(e,2),\"= e (%)\"\n",
+ "v_1=0.1; # (V)\n",
+ "v_1=G*v_1/A;\n",
+ "print round(v_1*1000,2),\"= v_1 (mV)\"\n",
+ "A=10**4; # (V/V)\n",
+ "print A,\"= A (V/V)\"\n",
+ "G=-R_2/R_1/(1+(1+R_2/R_1)/A);\n",
+ "print round(-G,2),\"= G\"\n",
+ "e=(-G-(R_2/R_1))/(R_2/R_1)*100;\n",
+ "print round(e,2),\"= e (%)\"\n",
+ "v_1=0.1; # (V)\n",
+ "v_1=G*v_1/A;\n",
+ "print round(v_1*1000,3),\"= v_1 (mV)\"\n",
+ "A=10**5; # (V/V)\n",
+ "print A,\"= A (V/V)\"\n",
+ "G=-R_2/R_1/(1+(1+R_2/R_1)/A);\n",
+ "print round(-G,2),\"= G\"\n",
+ "e=(-G-(R_2/R_1))/(R_2/R_1)*100;\n",
+ "print round(e,2),\"= e (%)\"\n",
+ "v_1=0.1; # (V)\n",
+ "v_1=G*v_1/A;\n",
+ "print round(v_1*1000,3),\"= v_1 (mV)\"\n",
+ "\n",
+ "# 2.1b\n",
+ "A=50000; # (V/V)\n",
+ "print A,\"= A (V/V)\"\n",
+ "G=-R_2/R_1/(1+(1+R_2/R_1)/A);\n",
+ "print round(-G,2),\"= G\"\n",
+ "print \"Thus a -50% change in the open loop gain results in only -0.1% in the closed loop gain\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1000 = A (V/V)\n",
+ "90.83 = G\n",
+ "-9.17 = e (%)\n",
+ "-9.08 = v_1 (mV)\n",
+ "10000 = A (V/V)\n",
+ "99.0 = G\n",
+ "-1.0 = e (%)\n",
+ "-0.99 = v_1 (mV)\n",
+ "100000 = A (V/V)\n",
+ "99.9 = G\n",
+ "-0.1 = e (%)\n",
+ "-0.1 = v_1 (mV)\n",
+ "50000 = A (V/V)\n",
+ "99.8 = G\n",
+ "Thus a -50% change in the open loop gain results in only -0.1% in the closed loop gain\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.3:pg-88"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 2.3 : Design instrumentation amplifier\n",
+ "R_2=1-50000-1/1000.0+50;\n",
+ "print round(-R_2/1000.0,1),\"= R_2 (Kohm)\"\n",
+ "R_1=-2*R_2/999;\n",
+ "print round(R_1),\"= R_1 (ohm)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "49.9 = R_2 (Kohm)\n",
+ "100.0 = R_1 (ohm)\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter3.ipynb b/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter3.ipynb new file mode 100755 index 00000000..78acbede --- /dev/null +++ b/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter3.ipynb @@ -0,0 +1,421 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:b6ca6f88473b518209629b5a50e034951050cc84cc7fdfcdcdfe2cbba83ff5c4"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter03:Diodes"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.1:pg-143"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Example 3.1: Peak value of diode current and maximum reverse voltage\n",
+ "#v_s is sinusoidal input voltage with peak 24V\n",
+ "#battery charges to 12V\n",
+ "I_d=(24-12)/100.0\n",
+ "max_v_rev=24+12.0;\n",
+ "print round(I_d,2),\"peak value of diode current (A)\\n\",round(max_v_rev,2),\"maximum reverse voltage acrossthe diode (V)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "0.12 peak value of diode current (A)\n",
+ "36.0 maximum reverse voltage acrossthe diode (V)\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.2:pg-145"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Example 3.2 : Values of Iand V for the circuit given\n",
+ "print \"Consider fig 3.6(a). Assume both diodes are conducting\"\n",
+ "I_D2=(10-0)/10.0;\n",
+ "I=(0-(-10))/5.0-I_D2; # node eqution at B for fig 3.6(a)\n",
+ "V_B=0;\n",
+ "V=0;\n",
+ "print I,\"= I (mA)\\n\", V,\"= V (V)\\n\" ,\"D_1 is conducting as assumed originally\"\n",
+ "print \"Consider fig 3.6(a). Assume both diodes are conducting\"\n",
+ "I_D2=(10-0)/5.0;\n",
+ "I=(0-(-10.0))/10-2; # node eqution at B for fig 3.6(b)\n",
+ "print I,\"= I (mA)\\n \", V,\"=V (V)\"\n",
+ "print \"Implies assumption is wrong. lets assume D_1 is off and D_2 is on\"\n",
+ "I_D2=(10-(-10))/15.0;\n",
+ "V_B=-10+10.0*I_D2;\n",
+ "I=0;\n",
+ "print I,\"= I (mA)\\n\", round(V_B,1),\"= V (V)\\n D_1 is reverse biased\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Consider fig 3.6(a). Assume both diodes are conducting\n",
+ "1.0 = I (mA)\n",
+ "0 = V (V)\n",
+ "D_1 is conducting as assumed originally\n",
+ "Consider fig 3.6(a). Assume both diodes are conducting\n",
+ "-1.0 = I (mA)\n",
+ " 0 =V (V)\n",
+ "Implies assumption is wrong. lets assume D_1 is off and D_2 is on\n",
+ "0 = I (mA)\n",
+ "3.3 = V (V)\n",
+ " D_1 is reverse biased\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.3:pg-150"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Example 3.3 : Evaluating junction scaling constant\n",
+ "#i-I_S*exp(v/(n*V_T)) implies I_S=i*exp(-v/(n*V_T))\n",
+ "n=1;\n",
+ "i=10**-3; # (A)\n",
+ "v=700; # (V)\n",
+ "V_T=25; # (V)\n",
+ "I_S=i*exp(-v/(n*V_T))\n",
+ "print round(I_S,17),\"= I_S (A) for n=1\"\n",
+ "n=2;\n",
+ "I_S=i*exp(-v/(n*V_T))\n",
+ "print round(I_S,11),\"= I_S (A) for n=2\"\n",
+ "print \"These values implies I_S is 1000 times greater \""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "6.9e-16 = I_S (A) for n=1\n",
+ "8.3e-10 = I_S (A) for n=2\n",
+ "These values implies I_S is 1000 times greater \n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.4:pg-154"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Example 3.4: To determine I_D and V_D\n",
+ "V_DD=5; # (V)\n",
+ "R=1000; # (ohm)\n",
+ "I_1=1*10**-3; # (A)\n",
+ "V_D=0.7; # (V)\n",
+ "V_1=V_D;\n",
+ "I_D=(V_DD-V_D)/R;\n",
+ "I_2=I_D;\n",
+ "V_2=V_1+0.1*log10(I_2/I_1);\n",
+ "I_D=(V_DD-V_2)/R;\n",
+ "print round(I_D*1000.0,3),\"= The diode current (mA)\"\n",
+ "V_D=V_2+0.1*log10(I_D/I_2)\n",
+ "print round(V_D,3),\"= The diode volage (V)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "4.237 = The diode current (mA)\n",
+ "0.763 = The diode volage (V)\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.5:pg-157"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 3.5 : Repeating example 3.4 using piecewise linear model\n",
+ "V_D0=0.65; # (V)\n",
+ "r_D=20; # (ohm)\n",
+ "R=1000; # (ohm)\n",
+ "V_DD=5; # (V)\n",
+ "I_D=(V_DD-V_D0)/(R+r_D);\n",
+ "print round(I_D*1000,2),\"= I_D (mA)\"\n",
+ "V_D=V_D0+I_D*r_D;\n",
+ "print round(V_D,3),\"= The diod voltage (V)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "4.26 = I_D (mA)\n",
+ "0.735 = The diod voltage (V)\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.6:pg-162"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 3.6 : Power supply ripple\n",
+ "V_S=10; # V_S=V_+\n",
+ "V_D=0.7; # (V)\n",
+ "R=10*10**3; # (ohm)\n",
+ "n=2;\n",
+ "V_T=25*10**-3; # (V)\n",
+ "V_s=1; # (V)\n",
+ "I_D=(V_S - V_D)/R;\n",
+ "r_D=n*V_T/I_D;\n",
+ "v_d=V_s*r_D/(R+r_D);\n",
+ "print round(v_d*1000,2),\"= v_d(peak (mV))\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "5.35 = v_d(peak (mV))\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.7:pg-163"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 3.7 : Percentage change in regulated voltage\n",
+ "V_DD=10; # (V)\n",
+ "V_D=0.7*3; # string of 3 diodes provide this constant voltage\n",
+ "R=1*10**3;\n",
+ "I_D=(V_DD-V_D)/R;\n",
+ "n=2;\n",
+ "V_T= 25*10**-3; # (V)\n",
+ "r_d=n*V_T/I_D; # incremental resistance \n",
+ "r=3*r_d; # total incremental resistance\n",
+ "deltav_O=2*r/(r+R); # deltav is peak to peak change in output voltage\n",
+ "print round(deltav_O*1000,1),\"is Percentage change (mV) in regulated voltage caused by 10% change in power supply\"\n",
+ "I=2.1*10**-3; # The current drawn from the diode string\n",
+ "deltav_O=-I*r; # Decrease in voltage across diode string\n",
+ "print round(deltav_O*1000,1),\"is Decrease in voltage across diode string (mV)\"\n",
+ "# The answer in the textbook is slightly different due to approximation"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "37.3 is Percentage change (mV) in regulated voltage caused by 10% change in power supply\n",
+ "-39.9 is Decrease in voltage across diode string (mV)\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.8:pg-169"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 3.8 : line regulation load regulation\n",
+ "\n",
+ "V_Z=6.8; # (V)\n",
+ "I_Z=0.005; # (A)\n",
+ "r_Z=20; # (ohm)\n",
+ "V=10; # V=V_+\n",
+ "R=0.5*10**3; # (ohm)\n",
+ "\n",
+ "# 3.8a\n",
+ "V_ZO=V_Z-r_Z*I_Z;\n",
+ "I_Z=(V-V_ZO)/(R+r_Z)\n",
+ "V_O=V_ZO+I_Z*r_Z;\n",
+ "print round(V_O,2),\"= V_O (V)\"\n",
+ "\n",
+ "# 3.8b\n",
+ "deltaV=1; # change in V is +1 and -1\n",
+ "deltaV_O=deltaV*r_Z/(R+r_Z); # corresponding change in output voltage\n",
+ "print round(deltaV_O*1000,1),\"= Line regulation (mV/V)\"\n",
+ "\n",
+ "# 3.8c\n",
+ "I_L=1*10**-3; # load current\n",
+ "deltaI_L=1*10**-3;\n",
+ "deltaI_Z=-1*10**-3; # change in zener current\n",
+ "deltaV_O=r_Z*deltaI_Z;\n",
+ "print round(deltaV_O*1000),\"= Load regulation (mV/mA)\"\n",
+ "\n",
+ "# 3.8d\n",
+ "I_L=6.8/2000; # load current with load resistance of 2000\n",
+ "deltaI_Z=-I_L;\n",
+ "deltaV_O=r_Z*deltaI_Z;\n",
+ "print round(deltaV_O*1000,2),\"= Corresponding change in zener voltage (mV) for zener current change of -3.4mA\"\n",
+ "\n",
+ "# 3.8e\n",
+ "R_L=0.5*10**3; # (ohm)\n",
+ "V_O=V*R_L/(R+R_L);\n",
+ "print V_O,\"V_O (V) for R_L=0.5K ohm\"\n",
+ "\n",
+ "# 3.8f\n",
+ "I_Z=0.2*10**-3; # Zener t be at the edge of breakdown I_Z=I_ZK\n",
+ "V_Z=6.7; # V_Z=V_ZK\n",
+ "I_Lmin=(9-6.7)/0.5; # Lowest current supplied to R\n",
+ "I_L=I_Lmin-I_Z; # load current\n",
+ "R_L=V_Z/I_L;\n",
+ "print round(R_L,1),\"= R_L (Kohm)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "6.83 = V_O (V)\n",
+ "38.5 = Line regulation (mV/V)\n",
+ "-20.0 = Load regulation (mV/mA)\n",
+ "-68.0 = Corresponding change in zener voltage (V) for zener current change of -3.4mA\n",
+ "5.0 V_O (V) for R_L=0.5K ohm\n",
+ "1.5 = R_L (Kohm)\n"
+ ]
+ }
+ ],
+ "prompt_number": 29
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.9:pg-181"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 3.9 : Value of capacitance C that will result in peak-peak ripple of 2V\n",
+ "V_P=100.0; # (V)\n",
+ "V_r=2.0; # (V)\n",
+ "f=60.0; # (Hz)\n",
+ "R=10.0*10**3; # (ohm)\n",
+ "I_L=V_P/R;\n",
+ "C=V_P/(V_r*f*R);\n",
+ "print round(C*1000000,1),\"= C (microF)\"\n",
+ "wdeltat=math.sqrt(2*V_r/V_P);\n",
+ "print wdeltat,\"= Conduction angle (rad)\"\n",
+ "i_Dav=I_L*(1+math.pi*math.sqrt(2*V_P/V_r));\n",
+ "print round(i_Dav*1000),\"= i_Dav (A)\"\n",
+ "i_Dmax=I_L*(1+2*math.pi*math.sqrt(2*V_P/V_r));\n",
+ "print round(i_Dmax*1000),\"= i_Dmax (mA)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "83.3 = C (microF)\n",
+ "0.2 = Conduction angle (rad)\n",
+ "324.0 = i_Dav (A)\n",
+ "638.0 = i_Dmax (mA)\n"
+ ]
+ }
+ ],
+ "prompt_number": 35
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file 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 diff --git a/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter5.ipynb b/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter5.ipynb new file mode 100755 index 00000000..4b4216b1 --- /dev/null +++ b/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter5.ipynb @@ -0,0 +1,868 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:f2f02a9bc5831c7f367935142b66b71aa0da896891093c898bfa38d6e16cd05d"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter05: Bipolar Junction\n",
+ "Transistors (BJTs)"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.1:pg-395"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 5.1 : Design of given circuit with current 2mA\n",
+ "# BJT will be operating in active mode\n",
+ "B=100.0; # B is beta value\n",
+ "a=B/(B+1); # a is alpha value\n",
+ "v_BE=0.7; # v_BE (V) at i_C=1mA\n",
+ "i_C1=1*10.0**-3; # (A)\n",
+ "I_C2=2*10.0**-3; # (A)\n",
+ "V_T=25*10.0**-3; # (V)\n",
+ "V_C=5; # (V)\n",
+ "V_CC=15.0; # (V)\n",
+ "V_B=0; # (V)\n",
+ "V_RC=V_CC-V_C;# V_RC is the voltage drop across resistor R_C\n",
+ "R_C=V_RC/I_C;\n",
+ "print R_C/1000,\"=Collector Resistance R_C (Kohm)\"\n",
+ "V_BE=v_BE+V_T*math.log(I_C2/i_C1);\n",
+ "print round(V_BE,3),\"=Base emitter voltage V_BE (V) at i_C=2mA\"\n",
+ "V_E=V_B-V_BE;\n",
+ "print round(V_E,3),\"=Emitter voltage V_E (V)\"\n",
+ "I_E=I_C2/a;\n",
+ "print I_E*1000,\"=Emitter current I_E (mA)\"\n",
+ "R_E=(V_E-(-V_CC))/I_E;\n",
+ "print round(R_E/1000,2),\"= Emitter resistance R_C (Kohm)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "5.0 =Collector Resistance R_C (Kohm)\n",
+ "0.717 =Base emitter voltage V_BE (V) at i_C=2mA\n",
+ "-0.717 =Emitter voltage V_E (V)\n",
+ "2.02 =Emitter current I_E (mA)\n",
+ "7.07 = Emitter resistance R_C (Kohm)\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.2:pg-413"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 5.2 : Consider a common Emitter circuit\n",
+ "I_S=10.0**-15; # (A)\n",
+ "R_C=6.8*10**3; # (ohm)\n",
+ "V_CC=10.0; # (V)\n",
+ "V_CE=3.2; # (V)\n",
+ "V_T=25.0*10**-3; # (V)\n",
+ "\n",
+ "# 5.2a\n",
+ "I_C=(V_CC-V_CE)/R_C;\n",
+ "print I_C*1000,\"= Collector current (A)\"\n",
+ "V_BE=V_T*math.log(I_C/I_S);\n",
+ "print round(V_BE*1000,1),\"= V_BE (mV)\"\n",
+ "\n",
+ "# 5.2b\n",
+ "V_in=5*10**-3; # sinuosoidal input 0f peak amplitide 5mv\n",
+ "A_v=-(V_CC-V_CE)/V_T;\n",
+ "print A_v,\"= Voltage gain\"\n",
+ "V_o=-A_v*V_in; # negative sign to make positive value of voltage gain\n",
+ "print V_o,\"= Amplitude of output voltage (V)\"\n",
+ "\n",
+ "# 5.2c\n",
+ "v_CE=0.3# (V)\n",
+ "i_C=(V_CC-v_CE)/R_C;\n",
+ "print round(i_C*1000,2),\"= i_C (mA)\"\n",
+ "v_be=V_T*math.log(i_C/I_C); # v_BE is positive increment in v_BE\n",
+ "print round(v_be*1000),\"= required increment (mV)\"\n",
+ "\n",
+ "# 5.2d\n",
+ "v_O=0.99*V_CC;\n",
+ "R_C=6.8*10**3; # (ohm)\n",
+ "i_C=(V_CC-v_O)/R_C;\n",
+ "I_C=1*10**-3; # (A)\n",
+ "print round(i_C*1000,4),\"= i_C (mA)\"\n",
+ "v_be=V_T*math.log(i_C/I_C);\n",
+ "print round(v_be*1000,1),\"= negative increment in v_BE (mV)\"\n",
+ "\n",
+ "# the answer for the C part is incorrect in the textbook"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1.0 = Collector current (A)\n",
+ "690.8 = V_BE (mV)\n",
+ "-272.0 = Voltage gain\n",
+ "1.36 = Amplitude of output voltage (V)\n",
+ "1.43 = i_C (mA)\n",
+ "9.0 = required increment (mV)\n",
+ "0.0147 = i_C (mA)\n",
+ "-105.5 = negative increment in v_BE (mV)\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.3:pg-420"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 5.3 :Determine R_B \n",
+ "# transistor is specified to have B value in the range of 50 to 150\n",
+ "V_C=0.2; # V_C=V_CEsat\n",
+ "V_CC=10; # (V)\n",
+ "R_C=10**3; # (ohm)\n",
+ "V_BB=5; # (V)\n",
+ "V_BE=0.7; # (V)\n",
+ "bmin=50; # range of bete is 50 to 150\n",
+ "I_Csat=(V_CC-V_C)/R_C;\n",
+ "I_BEOS=I_Csat/bmin; # I_B(EOS)=I_BEOS\n",
+ "I_B=10*I_BEOS; # base current for an overdrive factor 10\n",
+ "R_B=(V_BB-V_BE)/I_B;\n",
+ "print round(R_B/1000,1),\"= Value of R_B (Kohm)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "2.2 = Value of R_B (Kohm)\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.4:pg-422"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 5.4 : Analyse the circuit to find node voltages and branch currents\n",
+ "V_BB= 4; # (V)\n",
+ "V_CC=10; # (V)\n",
+ "V_BE=0.7; # (V)\n",
+ "b=100; # beta = 100\n",
+ "R_E=3.3*10**3; # (ohm)\n",
+ "R_C=4.7*10**3; # (ohm)\n",
+ "V_E=V_BB-V_BE;\n",
+ "print V_E,\"= Emitter voltage (V)\"\n",
+ "I_E=(V_E-0)/R_E;\n",
+ "print I_E*1000,\"= Emitter current (mA)\"\n",
+ "a=b/(b+1.0) # alpha value\n",
+ "I_C=I_E*a;\n",
+ "print round(I_C*1000,2),\"= Collector current (mA)\"\n",
+ "V_C=V_CC-I_C*R_C; # Applying ohm's law \n",
+ "print round(V_C,1),\"= Collector voltage (V)\"\n",
+ "I_B=I_E/(b+1);\n",
+ "print round(I_B*1000,2),\"= Base current (mA)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "3.3 = Emitter voltage (V)\n",
+ "1.0 = Emitter current (mA)\n",
+ "0.99 = Collector current (mA)\n",
+ "5.3 = Collector voltage (V)\n",
+ "0.01 = Base current (mA)\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.5:pg-423"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 5.5 : Analyse the circuit to find node voltages and branch currents\n",
+ "print \"Assuming active mode operation\"\n",
+ "V_CC=10.0; # (V)\n",
+ "R_C=4.7*10**3; # (V)\n",
+ "R_E=3.3*10**3; # (ohm)\n",
+ "V_BE=0.7; # (V)\n",
+ "V_BB=6.0; # (V)\n",
+ "V_CEsat=0.2; # (V)\n",
+ "V_E=V_BB-V_BE; \n",
+ "print V_E,\"= Emitter voltage (V)\"\n",
+ "I_E=V_E/R_E;\n",
+ "print round(I_E*1000,1),\"= Emitter current (mA)\"\n",
+ "V_C=V_CC-I_E*R_C; # I_E=I_C\n",
+ "print round(V_C,2),\"= Collector voltage (V)\"\n",
+ "print \"Since V_C < V_B our assumption is wrong\\n Hence its saturation mode operation\"\n",
+ "V_E=V_BB-V_BE;\n",
+ "print V_E,\"= Emitter voltage (V)\"\n",
+ "I_E=V_E/R_E;\n",
+ "print round(I_E*1000,1),\"= Emitter current (mA)\"\n",
+ "V_C=V_E+V_CEsat;\n",
+ "print V_C,\"= Collector voltage (V)\"\n",
+ "I_C=(V_CC-V_C)/R_C;\n",
+ "print round(I_C*1000,2),\"= Collector current (mA)\"\n",
+ "I_B=I_E-I_C;\n",
+ "print round(I_B*1000,2),\"=Base current (mA)\"\n",
+ "Bforced=I_C/I_B; # transistor is made to operate at a forced beta value\n",
+ "print round(Bforced,1),\"= forced beta\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Assuming active mode operation\n",
+ "5.3 = Emitter voltage (V)\n",
+ "1.6 = Emitter current (mA)\n",
+ "2.45 = Collector voltage (V)\n",
+ "Since V_C < V_B our assumption is wrong\n",
+ " Hence its saturation mode operation\n",
+ "5.3 = Emitter voltage (V)\n",
+ "1.6 = Emitter current (mA)\n",
+ "5.5 = Collector voltage (V)\n",
+ "0.96 = Collector current (mA)\n",
+ "0.65 =Base current (mA)\n",
+ "1.5 = forced beta\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.6:pg-426"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 5.7: Analyse the circuit to find node voltages and branch currents\n",
+ "V_CC=-10; # (V)\n",
+ "R_E=2000; # (ohm)\n",
+ "R_C=1000; # (ohm)\n",
+ "V_EE=10; # (V)\n",
+ "V_E=0.7; # (V) emitter base junction will be forward biased with V_E=V_EB=0.7V\n",
+ "print V_E,\"= Emitter base junction is forward biased with V_E (V)\"\n",
+ "I_E=(V_EE-V_E)/R_E;\n",
+ "print round(I_E*1000,2),\"= Emitter current (mA)\"\n",
+ "B=100; # Assuming beta 100\n",
+ "a=B/(B+1.0);\n",
+ "I_C=a*I_E; # Assuming the transistor to operate in active mode\n",
+ "print round(I_C*1000,1),\"= Collector current (mA)\"\n",
+ "V_C=V_CC+I_C*R_C;\n",
+ "print round(V_C,1),\"= Collector voltage (V)\"\n",
+ "I_B=I_E/(B+1);\n",
+ "print round(I_B*1000,2),\"= Base current (mA)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "0.7 = Emitter base junction is forward biased with V_E (V)\n",
+ "4.65 = Emitter current (mA)\n",
+ "4.6 = Collector current (mA)\n",
+ "-5.4 = Collector voltage (V)\n",
+ "0.05 = Base current (mA)\n"
+ ]
+ }
+ ],
+ "prompt_number": 32
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.8:pg-428"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 5.8 : Analyse the circuit to find node voltages and branch currents\n",
+ "V_CC= 10; # (V)\n",
+ "R_C=2000.0; # (ohm)\n",
+ "V_BB=5.0; # (V)\n",
+ "R_B=100.0*10**3; # (ohm)\n",
+ "B=100.0; # beta value\n",
+ "I_B=(V_BB-V_BE)/R_B;\n",
+ "print round(I_B*1000,3),\"= Base current (mA)\"\n",
+ "I_C=B*I_B;\n",
+ "print round(I_C*1000,1),\"= Collector current (mA)\"\n",
+ "V_C=V_CC-I_C*R_C;\n",
+ "print V_C,\"= Collector voltage (V)\"\n",
+ "V_B=0.7 ; # V_B=V_BE\n",
+ "print V_B,\"= Base voltage (V)\"\n",
+ "I_E=(B+1.0)*I_B;\n",
+ "print round(I_E*1000,1),\"= Emitter current (mA)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "0.043 = Base current (mA)\n",
+ "4.3 = Collector current (mA)\n",
+ "1.4 = Collector voltage (V)\n",
+ "0.7 = Base voltage (V)\n",
+ "4.3 = Emitter current (mA)\n"
+ ]
+ }
+ ],
+ "prompt_number": 39
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.9:pg-429"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 5.9 :Analyse the circuit to find node voltages and branch currents\n",
+ "# assuming that the transistor is saturated \n",
+ "V_CC=-5; # (V)\n",
+ "V_EE=5; # (V)\n",
+ "R_B=10000; # (ohm)\n",
+ "R_C=10000; # (ohm)\n",
+ "R_E=1000; # (ohm)\n",
+ "V_EB=0.7; # (V)\n",
+ "V_ECsat=0.2; # (V)\n",
+ "# using the relation I_E=I_C+I_B\n",
+ "V_B=3.75/1.2; #(V)\n",
+ "print round(V_B,2),\"= Base voltage (V)\"\n",
+ "V_E=V_B+V_EB;\n",
+ "print round(V_E,2),\"= Emitter voltage (V)\"\n",
+ "V_C=V_E-V_ECsat;\n",
+ "print round(V_C,2),\"= Collector voltage (V)\"\n",
+ "I_E=(V_EE-V_E)/R_E;\n",
+ "print round(I_E*1000,2),\"= Emitter current (mA)\"\n",
+ "I_B=V_B/R_B;\n",
+ "print round(I_B*1000,2),\"= Base current (mA)\"\n",
+ "I_C=(V_C-V_CC)/R_C;\n",
+ "print round(I_C*1000,2),\"= Collector current (mA)\"\n",
+ "Bforced=I_C/I_B; # Value of forced beta\n",
+ "print round(Bforced,1), \"= Forced Beta value\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "3.13 = Base voltage (V)\n",
+ "3.83 = Emitter voltage (V)\n",
+ "3.63 = Collector voltage (V)\n",
+ "1.17 = Emitter current (mA)\n",
+ "0.31 = Base current (mA)\n",
+ "0.86 = Collector current (mA)\n",
+ "2.8 = Forced Beta value\n"
+ ]
+ }
+ ],
+ "prompt_number": 43
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.10:pg-430"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Exampe 5.10 : Analyse the circuit to find node voltages and branch currents\n",
+ "V_CC=15; # (V)\n",
+ "R_C=5000; # (ohm)\n",
+ "R_B1=100*10**3; # (ohm)\n",
+ "R_B2=50*10**3; # (ohm)\n",
+ "R_E=3000; # (ohm)\n",
+ "V_BE=0.7; # (V)\n",
+ "B=100; # beta value\n",
+ "V_BB=V_CC*R_B2/(R_B1+R_B2);\n",
+ "print V_BB,\"=V_BB (V)\"\n",
+ "R_BB=R_B1*R_B2/(R_B1+R_B2);\n",
+ "print round(R_BB/1000.0,1),\"=R_BB (Kohm)\"\n",
+ "I_B=I_E/(B+1.0);\n",
+ "print round(I_B*1000,4),\"=Base current (mA)\"\n",
+ "I_E=(V_BB-V_BE)/(R_E +(R_BB/(B+1)))\n",
+ "print round(I_E*1000,2),\"=Emiter current (mA)\"\n",
+ "I_B=I_E/(B+1.0)\n",
+ "print round(I_B*1000,4),\"=Base current (mA)\"\n",
+ "V_B=V_BE+I_E*R_E;\n",
+ "print round(V_B,2),\"=Base voltage (V)\"\n",
+ "a=B/(B+1.0); # alpha value\n",
+ "I_C=a*I_E\n",
+ "print round(I_C*1000,2),\"=Collector current (mA)\"\n",
+ "V_C=V_CC-I_C*R_C;\n",
+ "print V_C,\"=Collector voltage (V))\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "5 =V_BB (V)\n",
+ "33.3 =R_BB (Kohm)\n",
+ "0.0128 =Base current (mA)\n",
+ "1.29 =Emiter current (mA)\n",
+ "0.0128 =Base current (mA)\n",
+ "4.57 =Base voltage (V)\n",
+ "1.28 =Collector current (mA)\n",
+ "8.60746885499 =Collector voltage (V))\n"
+ ]
+ }
+ ],
+ "prompt_number": 62
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.11:pg-432"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 5.11 :Analyse the circuit to find node voltages and branch currents\n",
+ "V_CC=15.0; # (V)\n",
+ "R_C1=5000.0; # (ohm)\n",
+ "R_B1=100.0*10**3; # (ohm)\n",
+ "R_B2=50.0*10**3; # (ohm)\n",
+ "R_E=3000.0; # (ohm)\n",
+ "V_BE=0.7; # (V)\n",
+ "R_E2=2000.0; # (ohm)\n",
+ "R_C2=2700.0; # (ohm)\n",
+ "V_EB=0.7; # (V)\n",
+ "B=100.0; # beta value\n",
+ "V_BB=V_CC*R_B2/(R_B1+R_B2);\n",
+ "R_BB=R_B1*R_B2/(R_B1+R_B2);\n",
+ "I_E1=(V_BB-V_BE)/(R_E +(R_BB/(B+1.0)))\n",
+ "print round(I_E1*1000,2),\"= I_E1 (mA)\"\n",
+ "I_B1=I_E1/(B+1.0)\n",
+ "print round(I_B1*1000,2),\"I_B1 (mA)\"\n",
+ "V_B1=V_BE+I_E*R_E;\n",
+ "print round(V_B1,2),\"=V_B1 (V)\"\n",
+ "a=B/(B+1.0); # alpha value\n",
+ "# beta and alpha values are same for the two transistors\n",
+ "I_C1=a*I_E\n",
+ "print round(I_C1*1000,2),\"= IC1 (mA)\"\n",
+ "V_C1=V_CC-I_C1*R_C1;\n",
+ "print round(V_C1,1),\"V_C1 (V))\"\n",
+ "V_E2=V_C1+V_EB;\n",
+ "print round(V_E2,1),\"V_E2(V)\"\n",
+ "I_E2=(V_CC-V_E2)/R_E2;\n",
+ "print round(I_E2*1000,2),\"I_E2 (mA)\"\n",
+ "I_C2=a*I_E2;\n",
+ "print round(I_C2*1000,2),\"I_C2 (mA)\"\n",
+ "V_C2=I_C2*R_C2;\n",
+ "print round(V_C2,2),\"V_C2 (V)\"\n",
+ "I_B2=I_E2/(B+1.0);\n",
+ "print round(I_B2*1000,3),\"I_B2 (mA)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1.29 = I_E1 (mA)\n",
+ "0.01 I_B1 (mA)\n",
+ "4.57 =V_B1 (V)\n",
+ "1.28 = IC1 (mA)\n",
+ "8.6 V_C1 (V))\n",
+ "9.3 V_E2(V)\n",
+ "2.85 I_E2 (mA)\n",
+ "2.82 I_C2 (mA)\n",
+ "7.61 V_C2 (V)\n",
+ "0.028 I_B2 (mA)\n"
+ ]
+ }
+ ],
+ "prompt_number": 77
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.13:pg-438"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 5.13 : Design of bias network of the amplifier\n",
+ "I_E=1*10**-3; # (A)\n",
+ "V_CC=12; # (V)\n",
+ "B=100; # beta value\n",
+ "V_B=4; # (V)\n",
+ "V_BE=0.7; # (V)\n",
+ "R1=80; # (ohm)\n",
+ "R2=40; # (ohm)\n",
+ "V_C=8; # (V)\n",
+ "V_E=V_B-V_BE;\n",
+ "print V_E,\"= Emitter voltage (V)\"\n",
+ "R_E=V_E/I_E;\n",
+ "print R_E/1000,\"= Emitter resistance (Kohm)\"\n",
+ "I_E=(V_B-V_BE)/(R_E+(R1*R2/(R1+R2))/(B+1));\n",
+ "print I_E*1000,\"= more accurate value for I_E (mA) for R1=80 ohm and R2=40 ohm\"\n",
+ "R1=8; # (ohm)\n",
+ "R2=4; # (ohm)\n",
+ "I_E=(V_B-V_BE)/(R_E+(R1*R2/(R1+R2))/(B+1));\n",
+ "print I_E*1000,\"= more accurate value for I_E (mA) for R1=8 ohm and R2=4 ohm\"\n",
+ "R_C=(V_CC-V_C)/I_E; # I_E=I_C\n",
+ "print round(R_C/1000.0),\"= Collector resistor (Kohm)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "3.3 = Emitter voltage (V)\n",
+ "3.3 = Emitter resistance (Kohm)\n",
+ "1.0 = more accurate value for I_E (mA) for R1=80 ohm and R2=40 ohm\n",
+ "1.0 = more accurate value for I_E (mA) for R1=8 ohm and R2=4 ohm\n",
+ "4.0 = Collector resistor (Kohm)\n"
+ ]
+ }
+ ],
+ "prompt_number": 81
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.14:pg-450"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 5.14 : Analysis of transistor amplifier\n",
+ "V_CC=10; # (V)\n",
+ "R_C=3000; # (ohm)\n",
+ "R_BB=100*10**3; # (ohm)\n",
+ "V_BB=3; # (V)\n",
+ "V_BE=0.7; # (V)\n",
+ "V_T=25*10**-3; # (V)\n",
+ "I_B=(V_BB-V_BE)/R_BB;\n",
+ "print round(I_B*1000,2),\"= Base current (mA)\"\n",
+ "I_C=B*I_B;\n",
+ "print round(I_C*1000,2),\"= Collector current (mA)\"\n",
+ "V_C=V_CC-I_C*R_C;\n",
+ "print V_C,\"= Collecor voltage (V)\"\n",
+ "I_E=B*I_C/(B+1);\n",
+ "r_e=V_T/I_E;\n",
+ "print round(r_e,2),\"= r_e (ohm)\"\n",
+ "g_m=I_C/V_T;\n",
+ "print g_m*1000,\"= g_m (mA/V)\"\n",
+ "r_pi=B/g_m;\n",
+ "print round(r_pi/1000,2),\"= r_pi (Kohm)\"\n",
+ "# v_i is input voltage let us assume it to be 1 V\n",
+ "v_i=1;\n",
+ "v_be=v_i*r_pi/(r_pi+R_BB)\n",
+ "print round(v_be,3),\"= v_be\"\n",
+ "v_o=-g_m*R_C*v_be;\n",
+ "print round(v_o),\"= Output voltage (V)\"\n",
+ "A_v=v_o/v_i;\n",
+ "print round(A_v),\"= Voltage gain\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "0.02 = Base current (mA)\n",
+ "2.3 = Collector current (mA)\n",
+ "3.1 = Collecor voltage (V)\n",
+ "10.98 = r_e (ohm)\n",
+ "92.0 = g_m (mA/V)\n",
+ "1.09 = r_pi (Kohm)\n",
+ "0.011 = v_be\n",
+ "-3.0 = Output voltage (V)\n",
+ "-3.0 = Voltage gain\n"
+ ]
+ }
+ ],
+ "prompt_number": 92
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.17:pg-464"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 5.17 : Amplifier parameters\n",
+ "# Transistor amplifier is having a open circuit voltage of v_sig of 10mV\n",
+ "v_sig=10*10.0**-3; # (V)\n",
+ "R_L=10*10.0**3; # (ohm)\n",
+ "R_sig=100*10.0**3; # (ohm)\n",
+ "print \"Calculation with R_L infinite\"\n",
+ "v_i=9.0; # (V)\n",
+ "v_o=90.0; # (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 (Kohm)\"\n",
+ "print \"Calculations with R_L = 10k ohm\"\n",
+ "v_o=70*10**-3; # (V)\n",
+ "v_i=8*10**-3; # (V)\n",
+ "A_v=v_o/v_i;\n",
+ "print A_v,\"= Voltage gain A_v (V/V)\"\n",
+ "G_v=v_o*10**3/10.0;\n",
+ "print G_v,\"= G_v (V/V)\"\n",
+ "R_o=(A_vo-A_v)*R_L/A_v;\n",
+ "print round(R_o/1000,2),\"= R_o (Kohm)\"\n",
+ "R_out=(G_vo-G_v)*R_L/G_v;\n",
+ "print round(R_out/1000,2),\"= R_out (Kohm)\"\n",
+ "R_in=v_i*R_sig/(v_sig-v_i);\n",
+ "print R_in/1000,\"= R_in (Kohm)\"\n",
+ "G_m=A_vo/R_o;\n",
+ "print round(G_m*1000),\"= G_m (mA/V)\"\n",
+ "A_i=A_v*R_in/R_L;\n",
+ "print A_i,\"= A_i (A/A)\"\n",
+ "R_ino=R_sig/((1+R_sig/R_i)*(R_out/R_o)-1); # R_ino is R_in at R_L=0\n",
+ "print round(R_ino/1000,1),\"= R_in at R_L =0\"\n",
+ "A_is=A_vo*R_ino/R_o;\n",
+ "print int(A_is),\"= A_is (A/A)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Calculation with R_L infinite\n",
+ "10.0 = A_vo (V/V)\n",
+ "9.0 = G_vo (V/V)\n",
+ "900.0 = R_i (Kohm)\n",
+ "Calculations with R_L = 10k ohm\n",
+ "8.75 = Voltage gain 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.0 = R_in (Kohm)\n",
+ "7.0 = G_m (mA/V)\n",
+ "350.0 = A_i (A/A)\n",
+ "81.8 = R_in at R_L =0\n",
+ "572 = A_is (A/A)\n"
+ ]
+ }
+ ],
+ "prompt_number": 103
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.18:pg-497"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Example 5.18 : Midband gain and 3dB frequency\n",
+ "# Transistor is biased at I_C=1mA\n",
+ "V_CC=10.0; # (V)\n",
+ "V_EE=10.0; # (V)\n",
+ "I=0.001; # (A)\n",
+ "R_B=100000.0; # (ohm)\n",
+ "R_C=8000.0; # (ohm)\n",
+ "R_sig=5000.0; #(ohm)\n",
+ "R_L=5000.0; # (ohm)\n",
+ "B=100.0; # beta value\n",
+ "V_A=100.0; # (V)\n",
+ "C_u=1*10.0**-12; # (F)\n",
+ "f_T=800.0*10**6; # (Hz)\n",
+ "I_C=0.001; # (A)\n",
+ "r_x=50.0; # (ohm)\n",
+ "# Values of hybrid pi model parameters\n",
+ "g_m=I_C/V_T;\n",
+ "r_pi=B/g_m;\n",
+ "r_o=V_A/I_C;\n",
+ "w_T=2*math.pi*f_T;\n",
+ "CpiplusCu=g_m/w_T; # C_u+C_pi\n",
+ "C_pi=CpiplusCu-C_u;\n",
+ "R_l=r_o*R_C*R_L/(r_o*R_C+R_C*R_L+R_L*r_o) # R_l=R_L'\n",
+ "A_M=R_B*r_pi*g_m*R_l/((R_B+R_sig)*(r_pi+r_x+(R_B*R_sig/(R_B+R_sig))));\n",
+ "print round(A_M),\"= Midband gain (V/V)\"\n",
+ "R_seff=(r_pi*(r_x+R_B*R_sig/(R_B+R_sig)))/(r_pi+r_x+R_B*R_sig/(R_B+R_sig)); # Effective source resistance R_seff=R'_sig\n",
+ "C_in=C_pi+C_u*(1+R_l*g_m);\n",
+ "f_H=1/(2*math.pi*C_in*R_seff);\n",
+ "print int(f_H/1000),\"= 3dB frequency (KHz)\"\n",
+ "\n",
+ "# the answer is the book is slightly different due to approximation"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "39.0 = Midband gain (V/V)\n",
+ "759 = 3dB frequency (KHz)\n"
+ ]
+ }
+ ],
+ "prompt_number": 109
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.19:pg-502"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 5.19 : To select values of capacitance required\n",
+ "R_B=100000.0; # (ohm)\n",
+ "r_pi=2500.0; # (ohm)\n",
+ "R_C=8000.0; # (ohm)\n",
+ "R_L=5000.0; # (ohm)\n",
+ "R_sig=5000.0; # (ohm)\n",
+ "B=100.0; # beta value\n",
+ "g_m=0.04; # (A/V)\n",
+ "r_pi=2500.0; #(ohm)\n",
+ "f_L=100.0; # (Hz)\n",
+ "r_e=25.0; # (ohm)\n",
+ "R_C1=R_B*r_pi/(R_B+r_pi)+R_sig; # Resistance seen by C_C1 \n",
+ "R_E=r_e+R_B*R_sig/((R_B+R_sig)*(B+1)); # Resistance seen by C_E\n",
+ "R_C2=R_C+R_L;# Resistance seen by C_C2\n",
+ "w_L=2*math.pi*f_L;\n",
+ "C_E=1/(R_E*0.8*w_L); #C_E is to contribute only 80% of the value of w_L\n",
+ "print round(C_E*1e6,1),\"= C_E (microF)\" \n",
+ "C_C1=1/(R_C1*0.1*w_L); #C_C1 is to contribute only 10% of the value of f_L\n",
+ "print round(C_C1*1e6,1),\"= C_C1 (microF)\"\n",
+ "C_C2=1/(R_C2*0.1*w_L); #C_C2 should contribute only 10% of the value of f_L\n",
+ "print round(C_C2*1e6,1),\"= C_C2 (microF)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "27.6 = C_E (microF)\n",
+ "2.1 = C_C1 (microF)\n",
+ "1.2 = C_C2 (microF)\n"
+ ]
+ }
+ ],
+ "prompt_number": 116
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter6.ipynb b/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter6.ipynb new file mode 100755 index 00000000..ea4f4708 --- /dev/null +++ b/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter6.ipynb @@ -0,0 +1,1095 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:40f100c8d1fc30e8a6b1192e3ef11450d13550145cfc252cd5b9c5a67296969d"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter06:Single-Stage Integrated-\n",
+ "Circuit Amplifiers"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.1:pg-553"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 6.1: To find the operating point of NMOS transistor\n",
+ "# Consider NMOS transistor\n",
+ "\n",
+ "# 6.1a\n",
+ "I_D=100.0*10**-6; # (A)\n",
+ "K_n=387.0*10**-6*10; # K_n=u_n*C_ox(W/L) (A/V**2) \n",
+ "V_th=0.48; # (V)\n",
+ "V_OV=math.sqrt(2*I_D/K_n);\n",
+ "print round(V_OV,2),\"= V_OV (V)\"\n",
+ "V_GS=V_th+V_OV;\n",
+ "print round(V_GS,2),\"= V_GS (V)\"\n",
+ "\n",
+ "# 6.1b\n",
+ "I_C=100*10**-6; # (A)\n",
+ "I_S=6*10**-18 # (A)\n",
+ "V_T=0.025; # (V)\n",
+ "V_BE=V_T*math.log(I_C/I_S);\n",
+ "print round(V_BE,2),\"= V_BE (V)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "0.23 = V_OV (V)\n",
+ "0.71 = V_GS (V)\n",
+ "0.76 = V_BE (V)\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.2:pg-556"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 6.2 : Comparison between NMOS transistor and npn transistor\n",
+ "\n",
+ "print \"For NMOS transistor\"\n",
+ "I_D=100*10**-6; # (A)\n",
+ "V_a=5; # V'_A=V_a (A)\n",
+ "L=0.4; # (um)\n",
+ "K_n=267*4/0.4*10**-6; # K_n=u_n*C_ox*(W/L) (A/V**2)\n",
+ "V_OV=math.sqrt(2*I_D/K_n);\n",
+ "g_m=math.sqrt(2*K_n*I_D)\n",
+ "print round(g_m*1e3,2),\"= g_m (mA/V)\"\n",
+ "print \"R_in is infinite\"\n",
+ "r_o=V_a*L/I_D;\n",
+ "print r_o/1000,\"= r_o (kohm)\"\n",
+ "A_O=g_m*r_o;\n",
+ "print round(A_O,1),\"= A_O (V/V)\"\n",
+ "print \"For npn transistor\"\n",
+ "I_C=0.1*10**-3; # collector current \n",
+ "B_o=100; # beta value\n",
+ "V_A=35; # (V)\n",
+ "g_m=I_C/V_T;\n",
+ "print round(g_m*1e3),\"= g_m (mA/V)\"\n",
+ "R_in=B_o/g_m;\n",
+ "print R_in/1000,\"= R_in (Kohm)\"\n",
+ "r_o=V_A/I_C;\n",
+ "print r_o/1000,\"= r_o (Kohm)\"\n",
+ "A_O=g_m*r_o;\n",
+ "print A_O,\"= A_O (V/V)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "For NMOS transistor\n",
+ "0.73 = g_m (mA/V)\n",
+ "R_in is infinite\n",
+ "20.0 = r_o (kohm)\n",
+ "14.6 = A_O (V/V)\n",
+ "For npn transistor\n",
+ "4.0 = g_m (mA/V)\n",
+ "25.0 = R_in (Kohm)\n",
+ "350.0 = r_o (Kohm)\n",
+ "1400.0 = A_O (V/V)\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.3:pg-559"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 6.3 : Comparison between NMOS transistor and npn transistor\n",
+ "# For npn transistor\n",
+ "print \"For npn transistor\"\n",
+ "I_C=10.0*10**-6; # (A)\n",
+ "V_T=0.025; # (V)\n",
+ "V_A=35.0; # (V)\n",
+ "C_jeO=5.0*10**-15; # (F)\n",
+ "C_uO=5*10.0**-15; # (F)\n",
+ "C_L=1*10.0**-12; # (F)\n",
+ "print \"The data calculated for I_C=10uA\"\n",
+ "g_m=I_C/V_T;\n",
+ "print round(g_m*1e3,1),\"= g_m (mA/V)\"\n",
+ "r_o=V_A/I_C;\n",
+ "print int(r_o/1000),\"=r_o (Kohm)\"\n",
+ "A_O=V_A/V_T;\n",
+ "print A_O,\"= A_O (V/V)\"\n",
+ "T_F=10*10.0**-12;\n",
+ "C_de=T_F*g_m;\n",
+ "print round(C_de*1e15,2),\"= C_de (fF)\"\n",
+ "C_je=2*C_jeO;\n",
+ "print round(C_je*1e15,2),\"= C_je (fF)\"\n",
+ "C_pi=C_de+C_je;\n",
+ "print round(C_pi*1e15,2),\"= C_pi (fF)\"\n",
+ "C_u=C_uO;\n",
+ "print round(C_u*1e15,2),\"= C_u (fF)\"\n",
+ "f_T=g_m/(2*math.pi*(C_pi+C_u));\n",
+ "print round(f_T/1e9,1),\"= f_T (GHz)\"\n",
+ "f_t=g_m/(2*math.pi*C_L);\n",
+ "print round(f_t/1e6,1),\"= f_t (MHz)\"\n",
+ "print \"The data calculated for I_C=100uA\"\n",
+ "I_C=100.0*10**-6;\n",
+ "g_m=I_C/V_T;\n",
+ "print round(g_m*1e3,1),\"= g_m (mA/V)\"\n",
+ "r_o=V_A/I_C;\n",
+ "print int(r_o/1000),\"=r_o (Kohm)\"\n",
+ "A_O=V_A/V_T;\n",
+ "print A_O,\"= A_O (V/V)\"\n",
+ "T_F=10.0*10**-12;\n",
+ "C_de=T_F*g_m;\n",
+ "print round(C_de*1e15,2),\"= C_de (fF)\"\n",
+ "C_je=2*C_jeO;\n",
+ "print round(C_je*1e15,2),\"= C_je (fF)\"\n",
+ "C_pi=C_de+C_je;\n",
+ "print round(C_pi*1e15,2),\"= C_pi (fF)\"\n",
+ "C_u=C_uO;\n",
+ "print round(C_u*1e15,2),\"= C_u (fF)\"\n",
+ "f_T=g_m/(2*math.pi*(C_pi+C_u));\n",
+ "print round(f_T/1e9,1),\"= f_T (GHz)\"\n",
+ "f_t=g_m/(2*math.pi*C_L);\n",
+ "print round(f_t/1e6,1),\"= f_t (MHz)\"\n",
+ "print \"The data calculated for I_C=1mA\"\n",
+ "I_C=1*10.0**-3;\n",
+ "g_m=I_C/V_T;\n",
+ "print round(g_m*1e3,1),\"= g_m (mA/V)\"\n",
+ "r_o=V_A/I_C;\n",
+ "print int(r_o/1000),\"=r_o (Kohm)\"\n",
+ "A_O=V_A/V_T;\n",
+ "print A_O,\"= A_O (V/V)\"\n",
+ "T_F=10*10**-12;\n",
+ "C_de=T_F*g_m;\n",
+ "print round(C_de*1e6,3),\"= C_de (fF)\"\n",
+ "C_je=2*C_jeO;\n",
+ "print round(C_je*1e15,3),\"= C_je (fF)\"\n",
+ "C_pi=C_de+C_je;\n",
+ "print round(C_pi*1e15,3),\"= C_pi (fF)\"\n",
+ "C_u=C_uO;\n",
+ "print round(C_u*1e15,2),\"= C_u (fF)\"\n",
+ "f_T=g_m/(2*math.pi*(C_pi+C_u));\n",
+ "print round(f_T/1e9,1),\"= f_T (GHz)\"\n",
+ "f_t=g_m/(2*math.pi*C_L);\n",
+ "print round(f_t/1e6,1),\"= f_t (MHz)\"\n",
+ "# For NMOS transistor\n",
+ "L=0.4*10**-6; # (m)\n",
+ "C_L=1*10.0**-12; # (F)\n",
+ "print \"The data calculated for I_D = 10uA\"\n",
+ "I_D=10*10.0**-6; # (A)\n",
+ "WbyL=0.12*I_D; # WbyL=(W/L)\n",
+ "print WbyL*10**6,\"= (W/L)\"\n",
+ "g_m=8*I_D;\n",
+ "print round(g_m*1e3,1),\"= g_m (mA/V)\"\n",
+ "r_o=2/I_D;\n",
+ "print int(r_o/1000),\"=r_o (Kohm)\"\n",
+ "A_O=g_m*r_o;\n",
+ "print A_O,\"= A_O (V/V)\"\n",
+ "C_gs=(2/3.0)*WbyL*0.4*0.4*5.8+0.6*WbyL*0.4;\n",
+ "print round(C_gs*1e6,2),\"= C_gs (fF)\"\n",
+ "C_gd=0.6*WbyL*0.4;\n",
+ "print round(C_gd*1e6,2),\"= C_gd (fF)\"\n",
+ "f_T=g_m/(2*math.pi*(C_gs*10**-15+C_gd*10**-15));\n",
+ "print round(f_T/1e15,1),\"=f_T (GHz)\"\n",
+ "f_t=g_m/(2*math.pi*C_L)\n",
+ "print round(f_t/1e6,1),\"=f_t (MHz)\"\n",
+ "print \"The data calculated for I_D = 100uA\"\n",
+ "I_D=100.0*10**-6; # (A)\n",
+ "WbyL=0.12*I_D; # WbyL=(W/L)\n",
+ "print WbyL*10**6,\"=(W/L)\"\n",
+ "g_m=8*I_D;\n",
+ "print round(g_m*1e3,1),\"= g_m (mA/V)\"\n",
+ "r_o=2/I_D;\n",
+ "print int(r_o/1000),\"=r_o (Kohm)\"\n",
+ "A_O=g_m*r_o;\n",
+ "print A_O,\"=A_O (V/V)\"\n",
+ "C_gs=(2/3.0)*WbyL*0.4*0.4*5.8+0.6*WbyL*0.4;\n",
+ "print round(C_gs*1e6,1),\"=C_gs (fF)\"\n",
+ "C_gd=0.6*WbyL*0.4;\n",
+ "print round(C_gd*1e6,1),\"=C_gd (fF)\"\n",
+ "f_T=g_m/(2*math.pi*(C_gs*10**-15+C_gd*10**-15));\n",
+ "print round(f_T/1e15,1),\"=f_T (GHz)\"\n",
+ "f_t=g_m/(2*math.pi*C_L)\n",
+ "print int(f_t/1e6),\"=f_t (MHz)\"\n",
+ "print \"The data calculated for I_D = 1mA\"\n",
+ "I_D=1*10**-3; # (A)\n",
+ "WbyL=0.12*I_D; # WbyL=(W/L)\n",
+ "print WbyL*10**6,\"=(W/L)\"\n",
+ "g_m=8*I_D;\n",
+ "print round(g_m*1e3,1),\"= g_m (mA/V)\"\n",
+ "r_o=2/I_D;\n",
+ "print int(r_o/1000),\"=r_o (Kohm)\"\n",
+ "A_O=g_m*r_o;\n",
+ "print A_O,\"=A_O (V/V)\"\n",
+ "C_gs=(2/3.0)*WbyL*0.4*0.4*5.8+0.6*WbyL*0.4;\n",
+ "print round(C_gs*1e6,1),\"=C_gs (fF)\"\n",
+ "C_gd=0.6*WbyL*0.4;\n",
+ "print round(C_gd*1e6,1),\"=C_gd (fF)\"\n",
+ "f_T=g_m/(2*math.pi*(C_gs*10**-15+C_gd*10**-15));\n",
+ "print round(f_T/1e15,1),\"=f_T (GHz)\"\n",
+ "f_t=g_m/(2*math.pi*C_L)\n",
+ "print int(f_t/1e6),\"=f_t (MHz)\"\n",
+ " # the answer in the textbook is slightly different due to approximation"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "For npn transistor\n",
+ "The data calculated for I_C=10uA\n",
+ "0.4 = g_m (mA/V)\n",
+ "3500 =r_o (Kohm)\n",
+ "1400.0 = A_O (V/V)\n",
+ "4.0 = C_de (fF)\n",
+ "10.0 = C_je (fF)\n",
+ "14.0 = C_pi (fF)\n",
+ "5.0 = C_u (fF)\n",
+ "3.4 = f_T (GHz)\n",
+ "63.7 = f_t (MHz)\n",
+ "The data calculated for I_C=100uA\n",
+ "4.0 = g_m (mA/V)\n",
+ "350 =r_o (Kohm)\n",
+ "1400.0 = A_O (V/V)\n",
+ "40.0 = C_de (fF)\n",
+ "10.0 = C_je (fF)\n",
+ "50.0 = C_pi (fF)\n",
+ "5.0 = C_u (fF)\n",
+ "11.6 = f_T (GHz)\n",
+ "636.6 = f_t (MHz)\n",
+ "The data calculated for I_C=1mA\n",
+ "40.0 = g_m (mA/V)\n",
+ "35 =r_o (Kohm)\n",
+ "1400.0 = A_O (V/V)\n",
+ "0.0 = C_de (fF)\n",
+ "10.0 = C_je (fF)\n",
+ "410.0 = C_pi (fF)\n",
+ "5.0 = C_u (fF)\n",
+ "15.3 = f_T (GHz)\n",
+ "6366.2 = f_t (MHz)\n",
+ "The data calculated for I_D = 10uA\n",
+ "1.2 = (W/L)\n",
+ "0.1 = g_m (mA/V)\n",
+ "200 =r_o (Kohm)\n",
+ "16.0 = A_O (V/V)\n",
+ "1.03 = C_gs (fF)\n",
+ "0.29 = C_gd (fF)\n",
+ "9.7 =f_T (GHz)\n",
+ "12.7 =f_t (MHz)\n",
+ "The data calculated for I_D = 100uA\n",
+ "12.0 =(W/L)\n",
+ "0.8 = g_m (mA/V)\n",
+ "20 =r_o (Kohm)\n",
+ "16.0 =A_O (V/V)\n",
+ "10.3 =C_gs (fF)\n",
+ "2.9 =C_gd (fF)\n",
+ "9.7 =f_T (GHz)\n",
+ "127 =f_t (MHz)\n",
+ "The data calculated for I_D = 1mA\n",
+ "120.0 =(W/L)\n",
+ "8.0 = g_m (mA/V)\n",
+ "2 =r_o (Kohm)\n",
+ "16.0 =A_O (V/V)\n",
+ "103.0 =C_gs (fF)\n",
+ "28.8 =C_gd (fF)\n",
+ "9.7 =f_T (GHz)\n",
+ "1273 =f_t (MHz)\n"
+ ]
+ }
+ ],
+ "prompt_number": 34
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.4:pg-565"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 6.4 : Design of the circuit with output current =100uA\n",
+ "\n",
+ "V_DD=3; # (V)\n",
+ "I_REF=100*10**-6; # (A)\n",
+ "I_D1=100*10**-6; # (A)\n",
+ "L=1*10**-6; # (m)\n",
+ "W=10*10**-6; # (m)\n",
+ "V_t=0.7; # (V)\n",
+ "k_n=200*10**-6; # k_n=k'_n (A/V**2)\n",
+ "V_A=20; # V_A=V'_A (V)\n",
+ "V_OV=math.sqrt(I_D1*2*L/(k_n*W));\n",
+ "V_GS=V_t+V_OV;\n",
+ "R=(V_DD-V_GS)/I_REF;\n",
+ "V_Omin=V_OV;\n",
+ "print round(V_Omin,3),\"= V_min (V)\"\n",
+ "r_o2=V_A/I_REF;\n",
+ "print r_o2/1e6,\"= r_o2 (Mohm)\"\n",
+ "V_O=V_GS;\n",
+ "deltaV_O=1; # Change in V_O (V)\n",
+ "deltaI_O=deltaV_O/r_o2; # Corresponding change in I_O (A)\n",
+ "print (deltaI_O*1e6),\"= The correspondng change in I_O (mA)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "0.316 = V_min (V)\n",
+ "0.2 = r_o2 (Mohm)\n",
+ "5.0 = The correspondng change in I_O (mA)\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.5:pg-574"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 6.5 : Determine 3dB frequency \n",
+ "# High frequency response of an amplifier can be characterized by th transfer function\n",
+ "# F_H(s)=(1-s/10**5)/(1+s/10**4)(1+s/4*10**4)\n",
+ "w_H=1/math.sqrt(1/10.0**8+1/(16.0*10**8)-2/10.0**10); # w_H=1/math.sqrt(1/w_P1**2+1/w_P2**2-2/w_Z1**2-2w_Z2**2)\n",
+ "print int(w_H),\"= w_H (rad/s)\"\n",
+ " # the answer in the textbook is slightly different due to approximation"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "9794 = w_H (rad/s)\n"
+ ]
+ }
+ ],
+ "prompt_number": 40
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.6:pg-576"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 6.6 : To determine midband gain and upper 3dB frequency\n",
+ "R_in=420*10**3; # (ohm)\n",
+ "R_sig=100*10**3; # (ohm)\n",
+ "g_m=4*10**-3; # (mho)\n",
+ "R_L=3.33*10**3; # R_L=R'_L (ohm)\n",
+ "C_gs=1*10**-12; # F\n",
+ "C_gd=C_gs; \n",
+ "A_M=-R_in*g_m*R_L/(R_in+R_sig)\n",
+ "print round(A_M,1),\"= Midband frequency gain A_M (V/V)\"\n",
+ "R_gs=R_in*R_sig/(R_in+R_sig);\n",
+ "R=R_gs; #R=R'\n",
+ "T_gs=C_gs*R_gs; # Oen circuit time constant of C_gs (s)\n",
+ "R_gd=R+R_L+g_m*R_L*R;\n",
+ "T_gd=R_gd*C_gd; # open circuit time constant of C_gd (s)\n",
+ "w_H=1/(T_gs+T_gd); # upper 3dB frequency w_H\n",
+ "f_H=w_H/(2*math.pi);\n",
+ "print round(f_H/1000,1),\"= Upper 3dB frequency f_H (KHz)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "-10.8 = Midband frequency gain A_M (V/V)\n",
+ "128.3 = Upper 3dB frequency f_H (KHz)\n"
+ ]
+ }
+ ],
+ "prompt_number": 44
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.7:pg-580"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 6.7 : Application of miller's theorem\n",
+ "\n",
+ "# 6.7a\n",
+ "# By miller's theorem\n",
+ "Z=1000.0*10**3; # (ohm)\n",
+ "K=-100.0; # (V/V)\n",
+ "R_sig=10.0*10**3; # (ohm)\n",
+ "Z_1=Z/(1-K);\n",
+ "print round(Z_1/1e3,2),\"= Z_1 (Kohm)\"\n",
+ "Z_2=Z/(1-(1/K));\n",
+ "print round(Z_2/1e6,2),\"= Z_2 (Mohm)\"\n",
+ "VobyVsig=-100*Z_1/(Z_1+R_sig); # VobyVsig=(V_o/V_sig)\n",
+ "print round(VobyVsig,1),\"= (V_o/V_sig) (V/V)\"\n",
+ "\n",
+ "#6.7b\n",
+ "# Applying miller's theorem\n",
+ "f_3dB=1/(2*math.pi*1.01*10**-6);\n",
+ "print round(f_3dB/1000,1),\"= f_3dB (KHz)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "9.9 = Z_1 (Kohm)\n",
+ "0.99 = Z_2 (Mohm)\n",
+ "-49.8 = (V_o/V_sig) (V/V)\n",
+ "157.6 = f_3dB (KHz)\n"
+ ]
+ }
+ ],
+ "prompt_number": 49
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.8:pg-586"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 6.8 : Analysis of CMOS CS amplifier\n",
+ "k_n=200*10**-6; # (A/V**2)\n",
+ "W=4*10**-6; # (m)\n",
+ "L=0.4*10**-6; # (m)\n",
+ "I_REF=100*10**-6; # (A)\n",
+ "V_An=20; # (A)\n",
+ "I_D1=0.1*10**-3; # (A)\n",
+ "V_Ap=10; # (V)\n",
+ "V_DD=3; # (V)\n",
+ "I_D2=0.1*10**-3; # (A)\n",
+ "V_tp=0.6; # (V)\n",
+ "V_tn=0.6; # (V)\n",
+ "g_m1=math.sqrt(2*k_n*(W/L)*I_REF);\n",
+ "print round(g_m1*1e3,2),\"=g_m1 (mA/V)\"\n",
+ "r_o1=V_An/I_D1;\n",
+ "print r_o1/1000,\"= r_o1 (Kohm)\"\n",
+ "r_o2=V_Ap/I_D2;\n",
+ "print r_o2/1000,\"= r_o2 (Kohm)\"\n",
+ "A_v=-g_m1*r_o1*r_o2/(r_o1+r_o2);\n",
+ "print round(A_v),\"= A_v (v/V)\"\n",
+ "I_D=100*10**-6; # (A)\n",
+ "k_n=65*10**-6; # (A/V**2)\n",
+ "V_OV3=0.53; # (V)\n",
+ "V_SG=V_tp+V_OV3;\n",
+ "print V_SG,\"= V_SG (V)\"\n",
+ "V_OA=V_DD-V_OV3;\n",
+ "print V_OA,\"= V_OA (V)\"\n",
+ "V_IB=0.93; # (V)\n",
+ "V_IA=0.88; # (V)\n",
+ "print V_IA,\"---\",V_IB,\"= Coordinates of the extremities of the amplifier V_IB and V_IA\"\n",
+ "deltavI=V_IB-V_IA; # width of amplifier region\n",
+ "V_OB=0.33; # (V)\n",
+ "deltavO=V_OB-V_OA; # corresponding output range (V)\n",
+ "deltavObydeltavI=-deltavO/deltavI; # Large signal voltage gain (V/V)\n",
+ "print deltavObydeltavI,\"= Large signal voltage gain (V/V)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "0.63 =g_m1 (mA/V)\n",
+ "200.0 = r_o1 (Kohm)\n",
+ "100.0 = r_o2 (Kohm)\n",
+ "-42.0 = A_v (v/V)\n",
+ "1.13 = V_SG (V)\n",
+ "2.47 = V_OA (V)\n",
+ "0.88 --- 0.93 = Coordinates of the extremities of the amplifier V_IB and V_IA\n",
+ "42.8 = Large signal voltage gain (V/V)\n"
+ ]
+ }
+ ],
+ "prompt_number": 54
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.9:pg-593"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 6.9: Analysis of CMOS CS amplifier\n",
+ "# Consider CMOS open source amplifier\n",
+ "from sympy import roots\n",
+ "from sympy import *\n",
+ "I_D=100.0*10**-6; # (A)\n",
+ "I_REF=I_D; \n",
+ "uC_n=387.0*10**-6; # u_n*C_ox=uC_n (A/V**2)\n",
+ "uC_p=86*10.0**-6; # u_n*C_ox=uC_n (A/V**2)\n",
+ "W=7.2*10**-6; # (m)\n",
+ "L=0.36*10**-6; # (m)\n",
+ "V_An=5*10**-6; # (A)\n",
+ "R_sig=10*10**3; # (ohm)\n",
+ "V_OV=math.sqrt(2*I_D*L/(W*uC_n));\n",
+ "g_m=I_D/(V_OV/2);\n",
+ "print round(g_m*1e3),\"= g_m (mA/V)\"\n",
+ "r_o1=5*0.36/(0.1*10**-3);\n",
+ "print math.ceil(r_o1/1000),\"= r_o1 (ohm)\"\n",
+ "r_o2=6*0.36/(.1*10**-3);\n",
+ "print round(r_o2/1000,1),\"= r_o2 (Kohm)\"\n",
+ "R_L=r_o1*r_o2/(r_o1+r_o2);\n",
+ "print round(R_L/1000,2),\"= R_L (Kohm)\"\n",
+ "A_m=-g_m*R_L;\n",
+ "print round(A_m,1),\"= A_m (V/V)\"\n",
+ "C_gs=20.0*10**-15; # (F)\n",
+ "C_gd=5*10.0**-15; # (F)\n",
+ "C_in=C_gs+C_gd*(1+g_m*R_L); # using miller equivalence\n",
+ "print round(C_in*1e15,1),\"= C_in (fF)\"\n",
+ "f_H=1/(2*math.pi*C_in*R_sig);\n",
+ "print int(f_H/1e6),\"= f_H (MHz)\"\n",
+ "R_gs=10.0*10**3; # (ohm) using open circuit time constants methods\n",
+ "R_L=9.82*10**3; # (ohm)\n",
+ "R_gd=R_sig*(1+g_m*R_L) + R_L;\n",
+ "print round(R_gd/1000),\"= R_gd (Kohm)\"\n",
+ "R_CL=R_L;\n",
+ "T_gs=C_gs*R_gs;\n",
+ "print int(T_gs*1e12),\"= T_gs (ps)\"\n",
+ "T_gd=C_gd*R_gd;\n",
+ "print int(T_gd*1e12),\"= T_gd (ps)\"\n",
+ "C_L=25*10**-15;\n",
+ "T_CL=C_L*R_CL;\n",
+ "print math.ceil(T_CL*1e12),\"= T_CL (ps)\"\n",
+ "T_H=T_gs+T_gd+T_CL;\n",
+ "print int(T_H*1e12),\"= T_H (ps)\"\n",
+ "f_H=1/(2*math.pi*T_H); # 3dB frequency\n",
+ "print int(f_H/1e6),\"= f_H (MHz)\"\n",
+ "f_Z=g_m/(2*math.pi*C_gd); # frequency of the zero\n",
+ "print math.ceil(f_Z/1e9),\"= f_Z (MHz)\"\n",
+ "# Denominator polynomial\n",
+ "#p=poly([1 1.16*10**-9 0.0712*10**-18],'s','coeff')\n",
+ "x = symbols('x')\n",
+ "s=solve(1+(1.16*10**-9)*x+(0.0712*10**-18)*x**2,x)\n",
+ "#print p,\"Denominator polynomial\"\n",
+ "\n",
+ "f_P2=s[1]/(-2*math.pi);\n",
+ "f_P1=s[0]/(-2*math.pi)\n",
+ "print round(f_P2/1e6,1),\" and \",round(f_P1/1e9,1), \"The frequencies f_P1 (MHz) and f_P2 (GHz) are found as the roots of the denominator frequency\"\n",
+ "print round(f_P2/1e6,1),\" = better estimate for f_H (MHz)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1.0 = g_m (mA/V)\n",
+ "18.0 = r_o1 (ohm)\n",
+ "21.6 = r_o2 (Kohm)\n",
+ "9.82 = R_L (Kohm)\n",
+ "-12.2 = A_m (V/V)\n",
+ "86.1 = C_in (fF)\n",
+ "184 = f_H (MHz)\n",
+ "142.0 = R_gd (Kohm)\n",
+ "200 = T_gs (ps)\n",
+ "709 = T_gd (ps)\n",
+ "246.0 = T_CL (ps)\n",
+ "1155 = T_H (ps)\n",
+ "137 = f_H (MHz)\n",
+ "40.0 = f_Z (MHz)\n",
+ "145.4"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " and 2.4 The frequencies f_P1 (MHz) and f_P2 (GHz) are found as the roots of the denominator frequency\n",
+ "145.4 = better estimate for f_H (MHz)\n"
+ ]
+ }
+ ],
+ "prompt_number": 56
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.10:pg-599"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 6.10 : To determine A_M, f_t, f_Z, f_3dB\n",
+ "# Consider the CS amplifier\n",
+ "A_M=-12.3;# (V/V) found from Example 6.9\n",
+ "C_L=25.0*10**-15; # (F)\n",
+ "C_gd=5*10.0**-15; # (F)\n",
+ "R_L=9.82*10**3; # (F)\n",
+ "g_m=1.25*10**-3; # (mho)\n",
+ "f_H=1/(2*math.pi*(C_L+C_gd)*R_L); # 3dB frequency\n",
+ "print round(f_H/1e6),\"= f_H (MHz)\"\n",
+ "f_t=-A_M*f_H; # Unity-gain frequency - sign to make gain positive as only magnitude is considered\n",
+ "print round(f_t/1e9,1),\"= f_t (GHz)\"\n",
+ "f_Z=g_m/(2*math.pi*C_gd); # frequency of the zero\n",
+ "print round(f_Z/1e9),\"= f_Z (GHz)\"\n",
+ "I_D=400*10**-6; # I_D must be quadrupled by changing I_REF to 400uF\n",
+ "V_OV=0.32; \n",
+ "g_m=I_D/(V_OV/2);\n",
+ "print round(g_m*1e3,2),\"= g_m (mA/V)\"\n",
+ "r_o1=5*0.36/(0.4*10**-3);\n",
+ "print r_o1/1000,\"= r_o1 (Kohm)\"\n",
+ "r_o2=6*0.36/(0.4*10**-3);\n",
+ "print r_o2/1000,\"= r_o2 (Kohm)\"\n",
+ "R_L=(r_o1*r_o2)/(r_o1+r_o2);\n",
+ "print round(R_L/1000,1),\"= R_L (Kohm)\"\n",
+ "A_M=-g_m*R_L;\n",
+ "print round(A_M,2),\"= A_M (V/V)\"\n",
+ "f_H=1/(2*math.pi*(C_L+C_gd)*R_L);\n",
+ "print round(f_H/1e9,2),\"= f_H (GHz)\"\n",
+ "f_t=f_H*-A_M; # Unity gain frequency\n",
+ "print round(f_t/1e9,1),\"= f_t (GHz)\"\n",
+ " # the answer in the textbook is slightly different due to approximation"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "540.0 = f_H (MHz)\n",
+ "6.6 = f_t (GHz)\n",
+ "40.0 = f_Z (GHz)\n",
+ "2.5 = g_m (mA/V)\n",
+ "4.5 = r_o1 (Kohm)\n",
+ "5.4 = r_o2 (Kohm)\n",
+ "2.5 = R_L (Kohm)\n",
+ "-6.14 = A_M (V/V)\n",
+ "2.16 = f_H (GHz)\n",
+ "13.3 = f_t (GHz)\n"
+ ]
+ }
+ ],
+ "prompt_number": 57
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.11:pg-609"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 6.11 : Avo Rin Rout Gi Gis Gv fH\n",
+ "# Consider the common gate amplifier\n",
+ "g_m=1.25*10**-3; # (A/V)\n",
+ "r_o=18000; # (ohm)\n",
+ "I_D=100*10**-6; # (A)\n",
+ "X=0.2;\n",
+ "R_S=10*10**3; # (ohm)\n",
+ "R_L=100*10**3; # (ohm)\n",
+ "C_gs=20*10**-15;# (F)\n",
+ "C_gd=5*10**-15;# (F)\n",
+ "C_L=0; # (F)\n",
+ "gmplusgmb=g_m+0.2*g_m; # gmplusgmb=g_m+g_mb\n",
+ "A_vo=1+(gmplusgmb)*r_o;\n",
+ "print A_vo,\"= A_vo (V/V)\"\n",
+ "R_in=(r_o+R_L)/A_vo;\n",
+ "print round(R_in/1000,1),\"= R_in (Kohm)\"\n",
+ "R_out=r_o+A_vo*R_S;\n",
+ "print int(R_out/1000),\"= Kohm\"\n",
+ "G_v=A_vo*R_L/(R_L+R_out);\n",
+ "print round(G_v),\"= G_v (V/V)\"\n",
+ "G_is=A_vo*R_S/R_out;\n",
+ "print round(G_is,2),\"= G_is (A/A)\"\n",
+ "G_i=G_is*R_out/(R_out+R_L)\n",
+ "print round(G_i,1),\"= G_i (A/A)\"\n",
+ "R_gs=R_S*R_in/(R_S+R_in);\n",
+ "R_gd=R_L*R_out/(R_L+R_out);\n",
+ "T_H=C_gs*R_gs+C_gd*R_gd;\n",
+ "f_H=1/(2*math.pi*T_H);\n",
+ "print int(f_H/1e6),\"= f_H (MHz)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "28.0 = A_vo (V/V)\n",
+ "4.2 = R_in (Kohm)\n",
+ "298 = Kohm\n",
+ "7.0 = G_v (V/V)\n",
+ "0.94 = G_is (A/A)\n",
+ "0.7 = G_i (A/A)\n",
+ "366 = f_H (MHz)\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.12:pg-620"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 6.12 : Comparison between Cascode amplifier and CS amplifier\n",
+ "# 6.12a \n",
+ "# CS amplifier\n",
+ "g_m=1.25*10**-3;\n",
+ "r_o=20*10**3;\n",
+ "R_L=r_o*r_o/(r_o+r_o);\n",
+ "C_gs=20*10**-15;\n",
+ "R_sig=10000;\n",
+ "C_gd=5*10**-15;\n",
+ "C_L=5*10**-15;\n",
+ "C_db=5*10**-15;\n",
+ "A_o=g_m*r_o;\n",
+ "print A_o,\"= A_o (V/V)\"\n",
+ "A_v=-A_o/2;\n",
+ "print A_v,\"= A_v (V/V)\"\n",
+ "T_H=C_gs*R_sig+C_gd*((1+g_m*R_L)*R_sig+R_L)+(C_L+C_db)*R_L;\n",
+ "print round(T_H*1e12),\"= T_H (ps)\"\n",
+ "f_H=1/(2*math.pi*T_H);\n",
+ "print round(f_H/1e6,1),\"= f_H (MHz)\"\n",
+ "f_t=-A_v*f_H;\n",
+ "print round(f_t/1e9,2),\"= f_t (GHz)\"\n",
+ "# Cascode amplifier\n",
+ "g_m1=1.25*10**-3;\n",
+ "r_o1=20000;\n",
+ "X=0.2;\n",
+ "r_o2=20000;\n",
+ "R_L=20000;\n",
+ "A_o1=g_m1*r_o1;\n",
+ "print A_o1,\"= A_o1 (V/V)\"\n",
+ "gm2plusgmb2=g_m1+X*g_m;\n",
+ "A_vo2=1+(gm2plusgmb2)*r_o2;\n",
+ "print A_vo2,\"= A_vo2 (V/V)\"\n",
+ "R_out1=r_o1;\n",
+ "R_in2=1/(gm2plusgmb2)+R_L/A_vo2;\n",
+ "print round(R_in2/1000.0,1),\"= R_in2 (kohm)\"\n",
+ "R_d1=R_out1*R_in2/(R_out1+R_in2);\n",
+ "print round(R_d1/1000.0,1),\"= R_d1 (Kohm)\"\n",
+ "R_out=r_o2+A_vo2*r_o1;\n",
+ "print round(R_out/1000.0,1),\"= R_out (Kohm)\"\n",
+ "vo1byvi=-g_m1*R_d1;\n",
+ "print round(vo1byvi,1),\"= (v_o1/v_i) (V/V)\"\n",
+ "A_v=-A_o1*A_vo2*R_L/(R_L+R_out);\n",
+ "print round(A_v,1),\"= A_v (V/V)\"\n",
+ "C_gs1=20*10**-15;\n",
+ "R_sig=10*10**3;\n",
+ "gm1Rd1=1.5;\n",
+ "C_gd1=5*10**-15;\n",
+ "C_gs2=20*10**-15;\n",
+ "C_db2=5*10**-15;\n",
+ "C_gd2=5*10**-15;\n",
+ "C_db1=5*10**-15;\n",
+ "T_H=R_sig*(C_gs1+C_gd1*(1+gm1Rd1))+R_d1*(C_gd1+C_db1+C_gs2)+((R_L*R_out)/(R_L+R_out))*(C_L+C_db2+C_gd2);\n",
+ "f_H=1/(2*math.pi*T_H);\n",
+ "print round(T_H*1e12),\"= T_H (ps)\"\n",
+ "print round(T_H*1e12),\"= T_H (ps)\"\n",
+ "f_t=-A_v*f_H;\n",
+ "print round(T_H*1e12),\"= T_H (ps)\"\n",
+ "# 6.12b \n",
+ "# CS amplifier\n",
+ "A_v=-12.5;\n",
+ "R_L=10*10**3;\n",
+ "print A_v,\"= A_v (V/V)\"\n",
+ "T_H=(C_gd+C_L+C_db)*R_L;\n",
+ "print round(T_H*1e12),\"= T_H (ps)\"\n",
+ "f_H=1/(2*math.pi*T_H);\n",
+ "print round(f_H/1e9,2),\"= f_H (GHz)\"\n",
+ "f_t=-A_v*f_H;\n",
+ "print round(f_t/1e9,1),\"= f_t (GHz)\"\n",
+ "# Cascode amplifier\n",
+ "R_L=640*10**3;\n",
+ "R_out=640*10**3;\n",
+ "R_out1=20*10**3;\n",
+ "A_v=-A_o1*A_vo2*R_L/(R_L+R_out);\n",
+ "print A_v,\"= A_v (V/V)\"\n",
+ "R_in2=1/gm2plusgmb2+R_L/A_vo2;\n",
+ "print round(R_in2/1000.0,1),\"= R_in2 (Kohm)\"\n",
+ "R_d1=R_in2*R_out1/(R_in2+R_out1);\n",
+ "print round(R_d1/1000.0,1),\"= R_d1 (Kohm)\"\n",
+ "T_H=R_d1*(C_gd1+C_db1+C_gs2)+(R_L*R_out/(R_L+R_out))*(C_L+C_gd2+C_db2);\n",
+ "print round(T_H*1e12),\"= T_H (ps)\"\n",
+ "f_H=1/(2*math.pi*T_H);\n",
+ "print round(f_H/1e6,1),\"= f_H (MHz)\"\n",
+ "f_t=-A_v*f_H;\n",
+ "print round(f_t/1e9,1),\"= f_t (GHz)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "25.0 = A_o (V/V)\n",
+ "-12.5 = A_v (V/V)\n",
+ "1025.0 = T_H (ps)\n",
+ "155.3 = f_H (MHz)\n",
+ "1.94 = f_t (GHz)\n",
+ "25.0 = A_o1 (V/V)\n",
+ "31.0 = A_vo2 (V/V)\n",
+ "1.3 = R_in2 (kohm)\n",
+ "1.2 = R_d1 (Kohm)\n",
+ "640.0 = R_out (Kohm)\n",
+ "-1.5 = (v_o1/v_i) (V/V)\n",
+ "-23.5 = A_v (V/V)\n",
+ "653.0 = T_H (ps)\n",
+ "653.0 = T_H (ps)\n",
+ "653.0 = T_H (ps)\n",
+ "-12.5 = A_v (V/V)\n",
+ "150.0 = T_H (ps)\n",
+ "1.06 = f_H (GHz)\n",
+ "13.3 = f_t (GHz)\n",
+ "-387.5 = A_v (V/V)\n",
+ "21.3 = R_in2 (Kohm)\n",
+ "10.3 = R_d1 (Kohm)\n",
+ "5110.0 = T_H (ps)\n",
+ "31.1 = f_H (MHz)\n",
+ "12.1 = f_t (GHz)\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.13:pg-642"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 6.13: Analysis of CC-CE amplifier\n",
+ "# Consider a CC-CE amplifier\n",
+ "# at an emitter bias current of 1mA for Q_1 and Q_2\n",
+ "g_m=40.0*10**-3; # (A/V)\n",
+ "r_e=25.0; # (ohm)\n",
+ "B=100.0; # beta value\n",
+ "C_u=2*10.0**-12; # (F)\n",
+ "f_T=400*10.0**6 # (Hz)\n",
+ "r_pi= B/g_m; \n",
+ "print round(r_pi/1000,1),\"= r_pi (Kohm)\"\n",
+ "C_pi=g_m/(2*math.pi*f_T)-C_u;\n",
+ "print round(C_pi*1e12,1),\"= C_pi (pF)\"\n",
+ "R_in2=2500.0; # (ohm)\n",
+ "r_pi2=2500.0 # (ohm)\n",
+ "r_pi1=2500.0; # (ohm)\n",
+ "r_e1=0.025; # (ohm)\n",
+ "B_1=100.0; # beta value\n",
+ "R_in=(B_1+1)*(r_e1+R_in2);\n",
+ "print round(R_in/1000),\"= R_in (Kohm)\"\n",
+ "R_sig=4*10.0**3; # (ohm)\n",
+ "R_L=4000.0; # (ohm)\n",
+ "Vb1byVsig=R_in/(R_in+R_sig); # (V_b1/V_sig)\n",
+ "print round(Vb1byVsig,2),\"= (V_b1/V_sig) (V/V)\"\n",
+ "Vb2plusVb1=R_in2/(R_in2+r_e1); # (V_b2/V_b1)\n",
+ "print round(Vb2plusVb1,3),\"= (V_b2/V_b1) (V/V)\"\n",
+ "VobyVb2=-g_m*R_L; # (V_o/V_b2)\n",
+ "print round(VobyVb2,2),\"= (V_o/V_b2) (V/V)\"\n",
+ "A_M=VobyVb2*Vb2plusVb1*Vb2plusVb1;\n",
+ "print int(A_M),\"= A_M (V/V)\"\n",
+ "R_u1=R_sig*R_in/(R_sig+R_in);\n",
+ "print round(R_u1/1000,1),\"= R_u1 (Kohm)\"\n",
+ "R_pi1=(R_sig+R_in2)/(1+(R_sig/r_pi1)+(R_in2/r_e1)); # C_pi1 sees a resistance R_pi1\n",
+ "print round(R_pi1*1000,2),\"= R_pi1 (ohm)\"\n",
+ "R_out1=25+4000/101;\n",
+ "R_pi2=R_in2*R_out1/(R_in2+R_out1); # C_pi2 sees a resistance R_pi2\n",
+ "print round(R_pi2,1),\"= R_pi2 (ohm)\"\n",
+ "R_u2=(1+g_m*R_L)*R_pi2+R_L;\n",
+ "print round(R_u2/1000,2),\"= R_u2 (Kohm)\"\n",
+ "C_u1=2*10**-12; # (F)\n",
+ "R_u1=3940; # (ohm)\n",
+ "C_pi1=13.9*10**-12; # (F)\n",
+ "C_u2=2*10**-12; # (F)\n",
+ "C_pi2=13.9*10**-12; # (F)\n",
+ "T_H=C_u1*R_u1+C_pi1*R_pi1+C_u2*R_u2+C_pi2*R_pi2;\n",
+ "print round(T_H*1e9),\"= T_H (ns)\"\n",
+ "f_H=1/(2*math.pi*T_H);\n",
+ "print round(f_H/1e6,1),\"= f_H (MHz)\"\n",
+ "A_M=r_pi*(-g_m*R_L)/(r_pi+R_sig);\n",
+ "print round(A_M,2),\"= A_M (V/V)\"\n",
+ "R_pi=r_pi*R_sig/(r_pi+R_sig); \n",
+ "print round(R_pi/1000,2),\"= R_pi (Kohm)\"\n",
+ "R_u=(1+g_m*R_L)*R_pi +R_L;\n",
+ "print round(R_u/1000,1),\"= R_u (Kohm)\"\n",
+ "T_H=C_pi*R_pi+C_u*R_u;\n",
+ "print round(T_H*1e9,1),\"= T_H (ns)\"\n",
+ "f_H=1/(2*math.pi*T_H);\n",
+ "print int(f_H/1e3),\"= f_H (KHz)\"\n",
+ " # the answer in the textbook is slightly different due to approximation"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "2.5 = r_pi (Kohm)\n",
+ "13.9 = C_pi (pF)\n",
+ "253.0 = R_in (Kohm)\n",
+ "0.98 = (V_b1/V_sig) (V/V)\n",
+ "1.0 = (V_b2/V_b1) (V/V)\n",
+ "-160.0 = (V_o/V_b2) (V/V)\n",
+ "-159 = A_M (V/V)\n",
+ "3.9 = R_u1 (Kohm)\n",
+ "65.0 = R_pi1 (ohm)\n",
+ "62.4 = R_pi2 (ohm)\n",
+ "14.05 = R_u2 (Kohm)\n",
+ "37.0 = T_H (ns)\n",
+ "4.3 = f_H (MHz)\n",
+ "-61.54 = A_M (V/V)\n",
+ "1.54 = R_pi (Kohm)\n",
+ "251.7 = R_u (Kohm)\n",
+ "524.8 = T_H (ns)\n",
+ "303 = f_H (KHz)\n"
+ ]
+ }
+ ],
+ "prompt_number": 49
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.14:pg-654"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 6.14 : To determine required resistor values\n",
+ "# The circuits generate a constant current I_D=10uA which operate at a supply of 10V\n",
+ "V_BE=0.7; # (V)\n",
+ "V_t=0.025; # (V)\n",
+ "I_REF=10.0*10**-6; # (A)\n",
+ "V_DD=10.0; # (V)\n",
+ "I=1*10.0**-3; # (A)\n",
+ "V_BE1=V_BE+V_t*math.log(I_REF/I); # Voltage drop across Q_1\n",
+ "print round(V_BE1,2),\"= V_BE1 (V)\"\n",
+ "R_1=(V_DD-V_BE1)/(I_REF); # For the Widlar circuit we decide I_REF=1mA and V_BE1=0.7V\n",
+ "print round(R_1/1000,1),\"= R_1 (kohm)\"\n",
+ "R_2=(V_DD-V_BE)/I;\n",
+ "print R_2/1000,\"= R_2 (kohm)\"\n",
+ "R_3=(V_t/I_REF)*math.log(I/I_REF);\n",
+ "print round(R_3/1000,1),\"= R_3 (kohm)\"\n",
+ " # the answer in the textbook is slightly different due to approximation"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "0.58 = V_BE1 (V)\n",
+ "941.5 = R_1 (kohm)\n",
+ "9.3 = R_2 (kohm)\n",
+ "11.5 = R_3 (kohm)\n"
+ ]
+ }
+ ],
+ "prompt_number": 53
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter7.ipynb b/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter7.ipynb new file mode 100755 index 00000000..f8cf792d --- /dev/null +++ b/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter7.ipynb @@ -0,0 +1,474 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:aa3033a597a0bf06128c3fae6fc134561fe0b608c1a6f342b1690de7caed5ad0"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter07:Differential and Multistage amlplifiers"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.1:pg-690"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 7.1 Analysis of differential amplifier\n",
+ "# Consider the differential amplifier\n",
+ "\n",
+ "B=100.0; # beta value\n",
+ "\n",
+ "# 7.1a\n",
+ "V_T=0.025; # (V)\n",
+ "I_E=0.0005; # (A)\n",
+ "R_E=150.0; # (ohm)\n",
+ "r_e1=V_T/I_E; # emitter resistance (ohm)\n",
+ "r_e2=r_e1; # emitterA resistance (ohm)\n",
+ "r_e=r_e1;\n",
+ "R_id=2*(B+1)*(r_e+R_E);\n",
+ "print round(R_id/1000.0),\"The input differential resistance R_id (kohm)\"\n",
+ "\n",
+ "# 7.1b\n",
+ "R_id=40000.0; # (ohm)\n",
+ "R_sig=5000.0; # (ohm)\n",
+ "R_C=10000.0; # (ohm)\n",
+ "R_E=150.0; # (ohm)\n",
+ "A_v=R_id/(R_id+R_sig); # A_v= v_o/v_sig (V/V)\n",
+ "A_V=2*R_C/(2.0*(r_e+R_E)); # A_V= v_o/v_id (V/v)\n",
+ "A_d=A_v*A_V; # A_d=v_o/v_sig (V/V)\n",
+ "print \"Overall differential voltage gain (V/V)\",round(A_d,-1)\n",
+ "\n",
+ "# 7.1c\n",
+ "R_EE=200000.0; # (ohm)\n",
+ "deltaR_C=0.02*R_C; # in the worst case\n",
+ "A_cm=R_C*deltaR_C/(2.0*R_EE*R_C)\n",
+ "print A_cm,\"Worst case common mode gain (V/V)\"\n",
+ "\n",
+ "# 7.1d\n",
+ "CMRR=20*math.log10(A_d/A_cm)\n",
+ "print int(CMRR),\"CMRR in dB\"\n",
+ "\n",
+ "# 7.1e\n",
+ "r_o=200000.0; #(ohm)\n",
+ "R_icm=(B+1)*(R_EE*r_o/2.0)/(R_EE+r_o/2.0);\n",
+ "print round(R_icm/1e6,1),\"Input common mode resistance (kohm)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "40.0 The input differential resistance R_id (kohm)\n",
+ "Overall differential voltage gain (V/V) 40.0\n",
+ "0.0005 Worst case common mode gain (V/V)\n",
+ "98 CMRR in dB\n",
+ "6.7 Input common mode resistance (kohm)\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.2:pg-747"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 7.2 : Analysis of Active loaded MOS differential amplifier\n",
+ "W=7.2*10**-6; # (m)\n",
+ "L=0.36*10**-6; # (m)\n",
+ "C_gs=29*10**-15; # (F)\n",
+ "C_gd=5*10**-15; # (F)\n",
+ "C_db=5*10**-15; # (F)\n",
+ "uC_n=387*10**-6; # uC_n=u_nC_ox (A/V**2)\n",
+ "uC_p=86*10**-6; # uC_p=u_pC_ox (A/V**2)\n",
+ "V_an=5; # V_an=V'_An (V/um) (V)\n",
+ "V_ap=6; # V_ap=V'_Ap (V/um) (V)\n",
+ "I=0.2*10**-3; # (A)\n",
+ "R_SS=25000; # (ohm)\n",
+ "C_SS=0.2*10**-12; # (F)\n",
+ "C_S=25*10**-15; # (F)\n",
+ "K_n=uC_n*W/L;\n",
+ "I_D=100*10**-6; # bias current (A)\n",
+ "V_OV=math.sqrt(2*I_D/K_n);\n",
+ "g_m=I/V_OV;\n",
+ "g_m1=g_m;\n",
+ "g_m2=g_m;\n",
+ "r_o1=V_an*0.36/(0.1*10**-3);\n",
+ "r_o2=r_o1;\n",
+ "K_p=uC_p*W/L;\n",
+ "V_OV34=math.sqrt(2*I_D/K_p); # V_OV3,4\n",
+ "g_m3=2*0.1*10**-3/V_OV34;\n",
+ "g_m4=g_m3;\n",
+ "r_o3=V_ap*0.36/(0.1*10**-3);\n",
+ "r_o4=r_o3;\n",
+ "A_d=g_m*(r_o2*r_o4)/(r_o2+r_o4);\n",
+ "print round(A_d,1),\"A_d (V/V)\"\n",
+ "A_cm=-1/(2*g_m3*R_SS);\n",
+ "print round(A_cm,3),\"A_cm (V/V)\"\n",
+ "CMRR=20*log10(-A_d/A_cm); # negative sign to make A_cm positive\n",
+ "print round(CMRR,1),\"CMRR in dB\"\n",
+ "C_gd1=5*10**-15; # (F)\n",
+ "C_db1=5*10**-15; # (F)\n",
+ "C_db3=5*10**-15; # (F)\n",
+ "C_gs3=20*10**-15; # (F)\n",
+ "C_gs4=20*10**-15; # (F)\n",
+ "C_m=C_gd1+C_db1+C_db3+C_gs3+C_gs4;\n",
+ "C_gd2=5*10**-15; # (F)\n",
+ "C_db2=5*10**-15; # (F)\n",
+ "C_gd4=5*10**-15; # (F)\n",
+ "C_db4=5*10**-15; # (F)\n",
+ "C_x=25*10**-15; # (F)\n",
+ "C_L=C_gd2+C_db2+C_gd4+C_db4+C_x;\n",
+ "print \"poles and zeroes of A_d\"\n",
+ "R_o=r_o2*r_o4/(r_o2+r_o4)\n",
+ "f_p1=1/(2*math.pi*C_L*R_o);\n",
+ "print int(f_p1/1e6),\"f_p1 (MHz)\"\n",
+ "f_p2=g_m3/(2*math.pi*C_m);\n",
+ "print round(f_p2/1e9,2),\"f_p2 (GHz)\"\n",
+ "f_Z=2*f_p2;\n",
+ "print round(f_Z/1e9,1),\"f_Z (GHz)\"\n",
+ "print \"Dominant pole of CMRR is at location of commom-mode gain zero\"\n",
+ "f_Z=1/(2*math.pi*C_SS*R_SS);\n",
+ "print round(f_Z/1e6,1),\"f_Z (MHz)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "12.2 A_d (V/V)\n",
+ "-0.034 A_cm (V/V)\n",
+ "51.1 CMRR in dB\n",
+ "poles and zeroes of A_d\n",
+ "360 f_p1 (MHz)\n",
+ "1.7 f_p2 (GHz)\n",
+ "3.4 f_Z (GHz)\n",
+ "Dominant pole of CMRR is at location of commom-mode gain zero\n",
+ "31.8 f_Z (MHz)\n"
+ ]
+ }
+ ],
+ "prompt_number": 28
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.3:pg-751"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 7.3 : To determine all parameters for different transistor\n",
+ "I_REF=90*10.0**-6; # (A)\n",
+ "V_tn=0.7; # (V)\n",
+ "V_tp=0.8; # Magnitude is cconsidered\n",
+ "uC_n=160.0*10**-6; # uC_n=u_n*C_ox\n",
+ "uC_p=40*10.0**-6; # uC_p=u_p*C_ox\n",
+ "V_A=10.0; # (V)\n",
+ "V_DD=2.5; # (V)\n",
+ "V_SS=2.5; # (V)\n",
+ "L=0.8*10**-6; # (m)\n",
+ "r_o2=222.0; # (ohm)\n",
+ "r_o4=222.0; # (ohm)\n",
+ "g_m1=0.3; # (mho)\n",
+ "A_1=-g_m1*r_o2*r_o4/(r_o2+r_o4);\n",
+ "print round(A_1,2),\"=A_1 (V/V)\"\n",
+ "r_o6=111.0; # (ohm)\n",
+ "r_o7=111.0; # (ohm)\n",
+ "g_m6=0.6; # (mho)\n",
+ "A_2=-g_m6*r_o6*r_o7/(r_o6+r_o7);\n",
+ "print round(A_2,2),\"=A_2 (V/V)\"\n",
+ "print \"For Q_1\"\n",
+ "W=20*10.0**-6; # (m)\n",
+ "I_D=I_REF/2.0; # (A)\n",
+ "print round(I_D/(10.0**-6),2),\"=I_D (microA)\"\n",
+ "K_p=uC_p*W/L;\n",
+ "V_OV=math.sqrt(2*I_D/K_p);\n",
+ "print round(V_OV,2),\"=V_OV (V)\"\n",
+ "V_GS=V_tp+V_OV;\n",
+ "print round(V_GS,2),\"=V_GS (V)\"\n",
+ "g_m=2*I_D/V_OV;\n",
+ "print round(g_m/(10.0**-3),2),\"=g_m (mA/V)\"\n",
+ "r_o=V_A/I_D;\n",
+ "print int(r_o/1e3),\"=r_o (kohm)\"\n",
+ "print \"For Q_2\"\n",
+ "W=20*10.0**-6; # (m)\n",
+ "I_D=I_REF/2; # (A)\n",
+ "print round(I_D/(10.0**-6),2),\"=I_D (microA)\"\n",
+ "K_p=uC_p*W/L;\n",
+ "V_OV=math.sqrt(2*I_D/K_p);\n",
+ "print round(V_OV,2),\"=V_OV (V)\"\n",
+ "V_GS=V_tp+V_OV;\n",
+ "print round(V_GS,2),\"=V_GS (V)\"\n",
+ "g_m=2*I_D/V_OV;\n",
+ "print round(g_m/(10.0**-3),2),\"=g_m (mA/V)\"\n",
+ "r_o=V_A/I_D;\n",
+ "print round(r_o/1e3),\"=r_o (kohm)\"\n",
+ "print \"For Q_3\"\n",
+ "W=5*10**-6; # (m)\n",
+ "I_D=I_REF/2; # (A)\n",
+ "print round(I_D/(10.0**-6),2),\"=I_D (microA)\"\n",
+ "K_n=uC_n*W/L;\n",
+ "V_OV=math.sqrt(2*I_D/K_n);\n",
+ "print round(V_OV,2),\"=V_OV (V)\"\n",
+ "V_GS=V_tn+V_OV;\n",
+ "print round(V_GS,2),\"=V_GS (V)\"\n",
+ "g_m=2*I_D/V_OV;\n",
+ "print round(g_m/(10.0**-3),2),\"=g_m (mA/V)\"\n",
+ "r_o=V_A/I_D;\n",
+ "print round(r_o/1e3),\"=r_o (kohm)\"\n",
+ "print \"For Q_4\"\n",
+ "W=5*10**-6; # (m)\n",
+ "I_D=I_REF/2; # (A)\n",
+ "print round(I_D/(10.0**-6),2),\"=I_D (microA)\"\n",
+ "K_n=uC_n*W/L;\n",
+ "V_OV=math.sqrt(2*I_D/K_n);\n",
+ "print round(V_OV,2),\"=V_OV (V)\"\n",
+ "V_GS=V_tn+V_OV;\n",
+ "print round(V_GS,2),\"=V_GS (V)\"\n",
+ "g_m=2*I_D/V_OV;\n",
+ "print round(g_m/(10.0**-3),2),\"=g_m (mA/V)\"\n",
+ "r_o=V_A/I_D;\n",
+ "print round(r_o/1e3),\"=r_o (kohm)\"\n",
+ "print \"For Q_5\"\n",
+ "W=40*10.0**-6; # (m)\n",
+ "I_D=I_REF; # (A)\n",
+ "print round(I_D/(10.0**-6),2),\"=I_D (microA)\"\n",
+ "K_p=uC_p*W/L;\n",
+ "V_OV=math.sqrt(2*I_D/K_p);\n",
+ "print round(V_OV,2),\"=V_OV (V)\"\n",
+ "V_GS=V_tp+V_OV;\n",
+ "print round(V_GS,2),\"=V_GS (V)\"\n",
+ "g_m=2*I_D/V_OV;\n",
+ "print round(g_m/(10.0**-3),2),\"=g_m (mA/V)\"\n",
+ "r_o=V_A/I_D;\n",
+ "print round(r_o/1e3),\"=r_o (kohm)\"\n",
+ "print \"For Q_6\"\n",
+ "W=10*10**-6; # (m)\n",
+ "I_D=I_REF; #A\n",
+ "print round(I_D/(10.0**-6),2),\"=I_D (microA)\"\n",
+ "K_n=uC_n*W/L;\n",
+ "V_OV=math.sqrt(2*I_D/K_n);\n",
+ "print round(V_OV,2),\"=V_OV (V)\"\n",
+ "V_GS=V_tn+V_OV;\n",
+ "print round(V_GS,2),\"=V_GS (V)\"\n",
+ "g_m=2*I_D/V_OV;\n",
+ "print round(g_m/(10.0**-3),2),\"=g_m (mA/V)\"\n",
+ "r_o=V_A/I_D;\n",
+ "print round(r_o/1e3),\"=r_o (kohm)\"\n",
+ "print \"For Q_7\"\n",
+ "W=40*10**-6; # (m)\n",
+ "I_D=I_REF;#A\n",
+ "print round(I_D/(10.0**-6),2),\"=I_D (microA)\"\n",
+ "K_p=uC_p*W/L;\n",
+ "V_OV=math.sqrt(2*I_D/K_p);\n",
+ "print round(V_OV,2),\"=V_OV (V)\"\n",
+ "V_GS=V_tp+V_OV;\n",
+ "print round(V_GS,2),\"=V_GS (V)\"\n",
+ "g_m=2*I_D/V_OV;\n",
+ "print round(g_m/(10.0**-3),2),\"=g_m (mA/V)\"\n",
+ "r_o=V_A/I_D;\n",
+ "print round(r_o/1e3),\"=r_o (kohm)\"\n",
+ "print \"For Q_8\"\n",
+ "W=40*10**-6; # (m)\n",
+ "I_D=I_REF; # A\n",
+ "print round(I_D/(10.0**-6),2),\"=I_D (microA)\"\n",
+ "K_p=uC_p*W/L;\n",
+ "V_OV=math.sqrt(2*I_D/K_p);\n",
+ "print round(V_OV,2),\"=V_OV (V)\"\n",
+ "V_GS=V_tp+V_OV;\n",
+ "print round(V_GS,2),\"=V_GS (V)\"\n",
+ "g_m=2*I_D/V_OV;\n",
+ "print round(g_m/(10.0**-3),2),\"=g_m (mA/V)\"\n",
+ "r_o=V_A/I_D;\n",
+ "print int(r_o/1e3),\"=r_o (kohm)\"\n",
+ "A_O=A_1*A_2;\n",
+ "print round(20*log10(A_O)),\"=The dc open loop gain in dB\"\n",
+ "v_ICMmin=-2.5+1;\n",
+ "print round(v_ICMmin,2),\"=Lower limit of input common-mode (V)\"\n",
+ "v_ICMmax=2.2-1.1;\n",
+ "print round(v_ICMmax,2),\"=Upper limit of input common-mode (V)\"\n",
+ "v_Omax=V_DD-V_OV;\n",
+ "print round(v_Omax,2),\"=Highest allowable output voltage (V)\"\n",
+ "v_Omin=-V_SS+V_OV;\n",
+ "print round(v_Omin,2),\"=Lowest allowable output voltage (V)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "-33.3 =A_1 (V/V)\n",
+ "-33.3 =A_2 (V/V)\n",
+ "For Q_1\n",
+ "45.0 =I_D (microA)\n",
+ "0.3 =V_OV (V)\n",
+ "1.1 =V_GS (V)\n",
+ "0.3 =g_m (mA/V)\n",
+ "222 =r_o (kohm)\n",
+ "For Q_2\n",
+ "45.0 =I_D (microA)\n",
+ "0.3 =V_OV (V)\n",
+ "1.1 =V_GS (V)\n",
+ "0.3 =g_m (mA/V)\n",
+ "222.0 =r_o (kohm)\n",
+ "For Q_3\n",
+ "45.0 =I_D (microA)\n",
+ "0.3 =V_OV (V)\n",
+ "1.0 =V_GS (V)\n",
+ "0.3 =g_m (mA/V)\n",
+ "222.0 =r_o (kohm)\n",
+ "For Q_4\n",
+ "45.0 =I_D (microA)\n",
+ "0.3 =V_OV (V)\n",
+ "1.0 =V_GS (V)\n",
+ "0.3 =g_m (mA/V)\n",
+ "222.0 =r_o (kohm)\n",
+ "For Q_5\n",
+ "90.0 =I_D (microA)\n",
+ "0.3 =V_OV (V)\n",
+ "1.1 =V_GS (V)\n",
+ "0.6 =g_m (mA/V)\n",
+ "111.0 =r_o (kohm)\n",
+ "For Q_6\n",
+ "90.0 =I_D (microA)\n",
+ "0.3 =V_OV (V)\n",
+ "1.0 =V_GS (V)\n",
+ "0.6 =g_m (mA/V)\n",
+ "111.0 =r_o (kohm)\n",
+ "For Q_7\n",
+ "90.0 =I_D (microA)\n",
+ "0.3 =V_OV (V)\n",
+ "1.1 =V_GS (V)\n",
+ "0.6 =g_m (mA/V)\n",
+ "111.0 =r_o (kohm)\n",
+ "For Q_8\n",
+ "90.0 =I_D (microA)\n",
+ "0.3 =V_OV (V)\n",
+ "1.1 =V_GS (V)\n",
+ "0.6 =g_m (mA/V)\n",
+ "111 =r_o (kohm)\n",
+ "61.0 =The dc open loop gain in dB\n",
+ "-1.5 =Lower limit of input common-mode (V)\n",
+ "1.1 =Upper limit of input common-mode (V)\n",
+ "2.2 =Highest allowable output voltage (V)\n",
+ "-2.2 =Lowest allowable output voltage (V)\n"
+ ]
+ }
+ ],
+ "prompt_number": 49
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.5:pg-760"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 7.5 : Analysis of given circuit\n",
+ "B=100.0; # beta value\n",
+ "I_E=0.2510**-3; # (A)\n",
+ "R_1=20000.0; # (ohm)\n",
+ "R_2=20000; # (ohm)\n",
+ "R_3=3000; # (ohm)\n",
+ "R_4=2300; # (ohm)\n",
+ "R_5=15700; # (ohm)\n",
+ "R_6=3000; # (ohm)\n",
+ "r_e1=25/0.25; # (ohm)\n",
+ "r_e2=r_e1; # (ohm)\n",
+ "r_pi1=(B+1)*r_e1;\n",
+ "r_pi2=(B+1)*r_e2;\n",
+ "R_id=r_pi1+r_pi2;\n",
+ "print round(R_id/1e3,2),\"Input differential resistance (kohm)\"\n",
+ "I_E=1*10.0**-3;\n",
+ "r_e4=25/1.0;\n",
+ "r_e5=r_e4;\n",
+ "r_pi4=(B+1)*r_e4;\n",
+ "r_pi5=(B+1)*r_e5;\n",
+ "R_i2=r_pi4+r_pi5;\n",
+ "print round(R_i2/1e3,2),\"Input resistance of the second stage R_i2 (kohm)\"\n",
+ "A_1=(R_i2*(R_1+R_2)/((R_i2+R_1+R_2)*(r_e1+r_e2)))\n",
+ "print round(A_1,1),\"Voltage gain of the first stage (V/V)\"\n",
+ "r_e7=25/1.0;\n",
+ "R_i3=(B+1)*(R_4+r_e7);\n",
+ "print round(R_i3/1e3,1),\"Input resistance of the third stage R_i3 (kohm)\"\n",
+ "A_2=(-R_3*R_i3)/((R_3+R_i3)*(r_e4+r_e5));\n",
+ "print round(A_2,1),\"Voltage gain of the second stage (V/V)\"\n",
+ "r_e8=25/5.0;\n",
+ "R_i4=(B+1)*(r_e8+R_6);\n",
+ "print round(R_i4/1e3,2),\"Input resistance of the third stage R_i2 (kohm)\"\n",
+ "A_3=(-R_5*R_i4)/((R_5+R_i4)*(r_e7+R_4));\n",
+ "print round(A_3,2),\"Voltage gain of the third stage (V/V)\"\n",
+ "A_4=R_6/(R_6+r_e8);\n",
+ "print round(A_4,2),\"Voltage gain of the fourth stage (V/V)\"\n",
+ "A=A_1*A_2*A_3*A_4 ; # A=v_o/v_id (V/V)\n",
+ "print round(A),\"Overall output gain (V/V)\"\n",
+ "print round(20*log10(A),1),\"Overall output gain in dB\"\n",
+ "R_o=R_6*(r_e8+R_5/(B+1))/(R_6+r_e8+R_5/(B+1))\n",
+ "print round(R_o),\"Output resistance (ohm)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "20.2 Input differential resistance (kohm)\n",
+ "5.05 Input resistance of the second stage R_i2 (kohm)\n",
+ "22.4 Voltage gain of the first stage (V/V)\n",
+ "234.8 Input resistance of the third stage R_i3 (kohm)\n",
+ "-59.2 Voltage gain of the second stage (V/V)\n",
+ "303.5 Input resistance of the third stage R_i2 (kohm)\n",
+ "-6.42 Voltage gain of the third stage (V/V)\n",
+ "1.0 Voltage gain of the fourth stage (V/V)\n",
+ "8514.0 Overall output gain (V/V)\n",
+ "78.6 Overall output gain in dB\n",
+ "152.0 Output resistance (ohm)\n"
+ ]
+ }
+ ],
+ "prompt_number": 56
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter8.ipynb b/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter8.ipynb new file mode 100755 index 00000000..be4f9dc6 --- /dev/null +++ b/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter8.ipynb @@ -0,0 +1,260 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:083d39cbb0b520b2793c0213a9dd654eda9ff785157da84f0bec629956fa17a6"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter08: Feedback"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.1:pg-808"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 8.1: Analysis of op amp connected in an inverting configuration\n",
+ "# By inspection we can write down the expressions for A, B , closed loop gain , the input resistance and the output resistance\n",
+ "u=10**4; # (ohm)\n",
+ "R_id=100.0*10**3; # (ohm)\n",
+ "r_o=1000.0; # (ohm)\n",
+ "R_L=2000.0; # (ohm)\n",
+ "R_1=1000.0; # (ohm)\n",
+ "R_2=10.0**6; # (ohm)\n",
+ "R_S=10000.0; # (ohm)\n",
+ "A=u*(R_L*(R_1+R_2)/(R_L+R_1+R_2))*R_id/(((R_L*(R_1+R_2))/(R_L+R_1+R_2)+r_o)*(R_id+R_S+(R_1*R_2)/(R_1+R_2)))\n",
+ "print int(A),\"= Voltage gain without feedback (V/V)\"\n",
+ "B=R_1/(R_1+R_2); # Beta value\n",
+ "print round(B,5), \"= Beta value \"\n",
+ "A_f=A/(1.0+A*B);\n",
+ "print int(A_f),\"= Voltage gain with feedback (V/V)\"\n",
+ "R_i=R_S+R_id+(R_1*R_2/(R_1+R_2))# Input resistance of the A circuit in fig 8.12a of textbook\n",
+ "R_if=R_i*7;\n",
+ "R_in=R_if-R_S;\n",
+ "print round(R_in/1000.0,1),\"= Input resistance (Kohm)\"\n",
+ "R_o=1.0/(1/r_o+1/R_L+1/(R_1+R_2));\n",
+ "R_of=R_o/(1.0+A*B); \n",
+ "R_out=R_of*R_L/(R_L-R_of);\n",
+ "print round(R_out),\"= the output resistance (ohm)\"\n",
+ "# the answer for input resistance is incorrect in the textbook"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "6002 = Voltage gain without feedback (V/V)\n",
+ "0.001 = Beta value \n",
+ "857 = Voltage gain with feedback (V/V)\n",
+ "767.0 = Input resistance (Kohm)\n",
+ "100.0 = the output resistance (ohm)\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.2:pg-815"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 8.2: Feedback triple\n",
+ "# Consider the given three stage series-series feedback\n",
+ "h_fe=100.0;\n",
+ "g_m2=40.0*10**-3; # (A/V)\n",
+ "r_e1=41.7; # (ohm)\n",
+ "a_1=0.99; # alpha value\n",
+ "R_C1=9000.0; # (ohm)\n",
+ "R_E1=100.0; #(ohm)\n",
+ "R_F=640.0; # (ohm)\n",
+ "R_E2=100.0; #(ohm)\n",
+ "r_pi2=h_fe/g_m2;\n",
+ "R_C2=5000.0; # (ohm)\n",
+ "r_e3=6.25; # (ohm)\n",
+ "R_C3=800.0; #(ohm)\n",
+ "# First stage gain A_1=V_c1/V_i\n",
+ "A_1=-a_1*R_C1*r_pi2/((R_C1+r_pi2)*(r_e1+((R_E1*(R_F+R_E2))/(R_E1+R_F+R_E2)))) \n",
+ "print round(A_1,2),\"=The voltage gain of the first stage (V/V)\"\n",
+ "# Gain of the second stage A_2=Vc2/V_c1\n",
+ "A_2=-g_m2*((R_C2*(h_fe+1)/(R_C2+h_fe+1))*(r_e3+(R_E2*(R_F+R_E1))/(R_E2+R_F+R_E1)))\n",
+ "print round(A_2,1),\"=The second stage gain (V/V)\"\n",
+ "# Third stage gain A_3 I_O/V_i\n",
+ "A_3=1/(r_e3+(R_E2*(R_F+R_E1)/(R_E2+R_F+R_E1)));\n",
+ "print round(A_3*1000,1),\"=The third stage gain (mA/V)\"\n",
+ "A=A_1*A_2*A_3; # combined gain\n",
+ "print A,\"=Combined gain (V/V)\"\n",
+ "B=R_E1*R_E2/(R_E2+R_F+R_E1);\n",
+ "print B,\"=Beta value\"\n",
+ "A_f=A/(1.0+A*B);\n",
+ "print round(A_f*1000.0,2),\"=Closed loop gain (mA/V)\"\n",
+ "A_v=-A_f*R_C3; # Voltage gain\n",
+ "print round(A_v,1),\"=Voltage gain (V/V)\"\n",
+ "R_i=(h_fe+1)*(r_e1+(R_E1//(R_F+R_E2))/(R_E1+R_F+R_E2));\n",
+ "R_if=R_i*(1+A*B);\n",
+ "print round(R_if/1e6,1),\"=Input resistance (Mohm)\"\n",
+ "R_o=(R_E2//(R_F+R_E1)/(R_F+R_E1+R_E2))+r_e3+R_C2/(h_fe+1);\n",
+ "R_of=R_o*(1.0+A*B);\n",
+ "print round(R_of/1000,1),\"=Output voltage (kohm)\"\n",
+ "r_o=25000; # (ohm)\n",
+ "g_m3=160*10**-3; # (mho)\n",
+ "r_pi3=625; # (ohm)\n",
+ "R_out=r_o+(1+g_m3*r_o)*R_of*r_pi3/(R_of+r_pi3);\n",
+ "print round(R_out/1e6,1),\"=R_out (Mohm)\"\n",
+ " # the answer in the textbook is slightly dirfferent due to approximation"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "-14.92 =The voltage gain of the first stage (V/V)\n",
+ "-373.6 =The second stage gain (V/V)\n",
+ "10.6 =The third stage gain (mA/V)\n",
+ "59.0958738355 =Combined gain (V/V)\n",
+ "11.9047619048 =Beta value\n",
+ "83.88 =Closed loop gain (mA/V)\n",
+ "-67.1 =Voltage gain (V/V)\n",
+ "3.0 =Input resistance (Mohm)\n",
+ "39.3 =Output voltage (kohm)\n",
+ "2.5 =R_out (Mohm)\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.3:pg-821"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 8.3 : Small signal analysis\n",
+ "B=100.0; # beta value\n",
+ "I_B=0.015*10**-3; # (A)\n",
+ "I_C=1.5*10**-3; # (A)\n",
+ "V_C=4.7; # (V)\n",
+ "g_m=40.0*10**-3;\n",
+ "R_f=47000.0;\n",
+ "R_S=10000.0;\n",
+ "R_C=4700.0;\n",
+ "r_pi=B/g_m;\n",
+ "A=-358.7*10**3; # V_o/I_i= -g_m(R_f||R_C)(R_S||R_F||r_pi)\n",
+ "R_i=1400.0; # R_i=R_S||R_f||r_pi (ohm)\n",
+ "R_o=R_C*R_f/(R_C+R_f); \n",
+ "B=-1/R_f;\n",
+ "A_f=A/(1.0+A*B); # V_o/I_s\n",
+ "A_v=A_f/R_S; # V_o/V_s\n",
+ "print round(A_v,2),\"= The gain (V/V)\"\n",
+ "R_if=R_i/(1+A*B);\n",
+ "print round(R_if,1),\"= R_if (ohm)\"\n",
+ "R_of=R_o/(1+A*B);\n",
+ "print round(R_of),\"= R_of (ohm)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "-4.16 = The gain (V/V)\n",
+ "162.2 = R_if (ohm)\n",
+ "495.0 = R_of (ohm)\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.4:pg-825"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 8.4: Small signal analysis\n",
+ "R_S=10.0*10**3; # (ohm)\n",
+ "R_B1=100.0*10**3; # (ohm)\n",
+ "R_B2=15.0*10**3; # (ohm)\n",
+ "R_C1=10.0*10**3; # (ohm)\n",
+ "R_E1=870.0; # (ohm)\n",
+ "R_E2=3400.0; # (ohm)\n",
+ "R_C2=8000.0; # (ohm)\n",
+ "R_L=1000.0; # (ohm)\n",
+ "R_f=10000.0; # (ohm)\n",
+ "B=100.0; # beta value\n",
+ "V_A=75.0; # (V)\n",
+ "A=-201.45 # I_o/I_i (A/A)\n",
+ "R_i=1535.0; # (ohm)\n",
+ "R_o=2690.0; # (ohm)\n",
+ "B=-R_E2/(R_E2+R_f);\n",
+ "R_if=R_i/(1+A*B);\n",
+ "R_in=1/((1/R_if)-(1/R_S));\n",
+ "print round(R_in,1), \"= R_in (ohm)\"\n",
+ "A_f=A/(1+A*B); # I_o/I_S\n",
+ "gain=R_C2*A_f/(R_C2+R_L); # I_o/I_S\n",
+ "print round(gain,2),\"= I_o/I_S (A/A)\"\n",
+ "R_of=R_o*(1+A*B); # (ohm)\n",
+ "r_o2=75/0.0004; # (ohm)\n",
+ "g_m2=0.016; # (A/V)\n",
+ "r_pi2=6250; # (ohm)\n",
+ "R_out=r_o2*(1+g_m2*(r_pi2*R_of/(r_pi2+R_of)))\n",
+ "print round(R_out/1e6,1),\"= R_out (Mohm)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "29.5 = R_in (ohm)\n",
+ "-3.44 = I_o/I_S (A/A)\n",
+ "18.1 = R_out (Mohm)\n"
+ ]
+ }
+ ],
+ "prompt_number": 29
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter9.ipynb b/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter9.ipynb new file mode 100755 index 00000000..836bb3d5 --- /dev/null +++ b/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter9.ipynb @@ -0,0 +1,394 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:319b3f32e409bff3be02756cf61b3db7331d3cf7998339ca41a86fd66771d9c7"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter09:Operational-Amplifier and\n",
+ "Data-Converter Circuits"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.1:pg-881"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 9.1 Design of two-stage CMOS op-amp \n",
+ "A_v=4000.0; # (V/V)\n",
+ "V_A=20.0; # (V)\n",
+ "k_p=80.0*10**-6; # k'_n=k_n (A/V**2)\n",
+ "k_n=200.0*10**-6; # k'_p=k_P (A/V**2)\n",
+ "V_SS=1.65; # (V)\n",
+ "V_DD=1.65; # (V)\n",
+ "V_tn=0.5; # (V)\n",
+ "V_tp=0.5; # (V)\n",
+ "C_1=0.2*10**-12; # (F)\n",
+ "C_2=0.8*10**-12; # (F)\n",
+ "I_D=100.0*10**-6; # (A)\n",
+ "V_OV=math.sqrt(V_A**2/A_v);\n",
+ "WbyL_1=I_D*2/(V_OV**2*k_p); # WbyL_1=(W/L)_1\n",
+ "print WbyL_1,\"= Required (W/L) ratio for Q_1\"\n",
+ "WbyL_2=WbyL_1; # WbyL_2=(W/L)_2\n",
+ "print WbyL_2,\"= Required (W/L) ratio for Q_2\"\n",
+ "WbyL_3=I_D*2/(V_OV**2*k_n); # WbyL_3=(W/L)_3\n",
+ "print WbyL_3,\"= Required (W/L) ratio for Q_3\"\n",
+ "WbyL_4=WbyL_3; # WbyL_4=(W/L)_4\n",
+ "print WbyL_4,\"= Required (W/L) ratio for Q_4\"\n",
+ "I_D=200*10**-6;\n",
+ "WbyL_5=I_D*2/(V_OV**2*k_p); # WbyL_5=(W/L)_5\n",
+ "print WbyL_5,\"= Required (W/L) ratio for Q_5\"\n",
+ "I_D=500*10**-6;\n",
+ "WbyL_7=2.5*WbyL_5; # WbyL_7=(W/L)_7 \n",
+ "print WbyL_7,\"= Required (W/L) ratio for Q_7\"\n",
+ "WbyL_6=I_D*2/(V_OV**2*k_n); # WbyL_6=(W/L)_6\n",
+ "print WbyL_6,\"= Required (W/L) ratio for Q_6\"\n",
+ "WbyL_8=0.1*WbyL_5; # WbyL_8=(W/L)_8\n",
+ "print WbyL_8,\"= Required (W/L) ratio for Q_8\"\n",
+ "V_ICMmin=-V_SS+V_OV+V_tn-V_tp;\n",
+ "print round(V_ICMmin,2),\"= The lowest value of input common mode voltage\"\n",
+ "V_ICMmax=V_DD-V_OV-V_OV-V_tp;\n",
+ "print round(V_ICMmax,2),\"= The highest value of input common mode voltage\"\n",
+ "v_omin=-V_SS+V_OV;\n",
+ "print round(v_omin,2),\"= The lowest value of output swing allowable\"\n",
+ "v_omax=V_DD-V_OV;\n",
+ "print round(v_omax,2),\"= The highest value of output swing allowable\"\n",
+ "R_o=20/(2*0.5);\n",
+ "print R_o,\"= Input resistance is practically infinite and output reistance is (Kohm)\"\n",
+ "G_m2=2*I_D/V_OV;\n",
+ "print round(G_m2*1e3,1),\"= G_m2 (mA/V)\"\n",
+ "f_P2=3.2*10**-3/(2*math.pi*C_2);\n",
+ "print round(f_P2/1e6),\"= f_P2 (MHz)\"\n",
+ "R=1/G_m2;\n",
+ "print int(R),\"= To move the transmission zero to s=infinite , r value selected as (ohm)\"\n",
+ "f_t=f_P2*tan(15*math.pi/180.0); # Phase margin of 75 degrees , thus phase shift due to seccond pole must be 15 degrees\n",
+ "print round(f_t/1e6),\"= f_t (MHz)\"\n",
+ "G_m1=2*100*10**-6/V_OV; # I_D = 100uA\n",
+ "C_C1=G_m1/(2*math.pi*f_t);\n",
+ "print round(C_C1/1e-12,1),\"= C_C1 (picoF)\"\n",
+ "SR=2*math.pi*f_t*V_OV;\n",
+ "print round(SR/1e6),\"= SR (V/micros)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "25.0 = Required (W/L) ratio for Q_1\n",
+ "25.0 = Required (W/L) ratio for Q_2\n",
+ "10.0 = Required (W/L) ratio for Q_3\n",
+ "10.0 = Required (W/L) ratio for Q_4\n",
+ "50.0 = Required (W/L) ratio for Q_5\n",
+ "125.0 = Required (W/L) ratio for Q_7\n",
+ "50.0 = Required (W/L) ratio for Q_6\n",
+ "5.0 = Required (W/L) ratio for Q_8\n",
+ "-1.33 = The lowest value of input common mode voltage\n",
+ "0.52 = The highest value of input common mode voltage\n",
+ "-1.33 = The lowest value of output swing allowable\n",
+ "1.33 = The highest value of output swing allowable\n",
+ "20.0 = Input resistance is practically infinite and output reistance is (Kohm)\n",
+ "3.2 = G_m2 (mA/V)\n",
+ "637.0 = f_P2 (MHz)\n",
+ "316 = To move the transmission zero to s=infinite , r value selected as (ohm)\n",
+ "171.0 = f_t (MHz)\n",
+ "0.6 = C_C1 (picoF)\n",
+ "339.0 = SR (V/micros)\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.2:pg-889"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 9.2 : To determine A_v,f_t,f_P,SR and P_D of folded cascode amplifier\n",
+ "# Consider a design of the folded-cascode op amp\n",
+ "I=200*10.0**-6; # (A)\n",
+ "I_B=250.0*10**-6; # (A)\n",
+ "V_OV=0.25; # (V)\n",
+ "k_n=100.0*10**-6; # k_n=k'_n (A/V**2)\n",
+ "k_p=40*10.0**-6; # k_p=k'_p (A/V**2)\n",
+ "V_A=20.0; # V_A=V'_A (V/um)\n",
+ "V_DD=2.5; # (V)\n",
+ "V_SS=2.5; # (V)\n",
+ "V_t=0.75; # (V)\n",
+ "L=1*10.0**-6; # (m)\n",
+ "C_L=5*10.0**-12; # (F)\n",
+ "print \"Data calculated for Q1\"\n",
+ "I_D=I/2;\n",
+ "print round(I_D*1e6),\"= I_D (microA)\"\n",
+ "g_m=2*I_D/V_OV;\n",
+ "print round(g_m*1e3,1),\"= g_m (mA/V)\"\n",
+ "r_o=V_A/I_D;\n",
+ "print r_o/1000,\"= r_o (Kohm)\"\n",
+ "WbyL=2*I_D/(k_n*V_OV**2); # WbyL =W/L\n",
+ "print WbyL,\"= W/L\"\n",
+ "print \"Data calculated for Q2\"\n",
+ "I_D=I/2;\n",
+ "print round(I_D*1e6),\"= I_D (microA)\"\n",
+ "g_m=2*I_D/V_OV;\n",
+ "print round(g_m*1e3,1),\"= g_m (mA/V)\"\n",
+ "r_o=V_A/I_D;\n",
+ "print r_o/1000,\"= r_o (Kohm)\"\n",
+ "WbyL=2*I_D/(k_n*V_OV**2); # WbyL =W/L\n",
+ "print WbyL,\"= W/L\"\n",
+ "print \"Data calculated for Q3\"\n",
+ "I_D=I_B-I/2;\n",
+ "print round(I_D*1e6),\"= I_D (microA)\"\n",
+ "g_m=2*I_D/V_OV;\n",
+ "print round(g_m*1e3,1),\"= g_m (mA/V)\"\n",
+ "r_o=V_A/I_D;\n",
+ "print int(r_o/1000),\"= r_o (Kohm)\"\n",
+ "WbyL=2*I_D/(k_p*V_OV**2); # WbyL =W/L\n",
+ "print WbyL,\"= W/L\"\n",
+ "print \"Data calculated for Q4\"\n",
+ "I_D=I_B-I/2;\n",
+ "print round(I_D*1e6),\"= I_D (microA)\"\n",
+ "g_m=2*I_D/V_OV;\n",
+ "print round(g_m*1e3,1),\"= g_m (mA/V)\"\n",
+ "r_o=V_A/I_D;\n",
+ "print int(r_o/1000),\"= r_o (Kohm)\"\n",
+ "WbyL=2*I_D/(k_p*V_OV**2); # WbyL =W/L\n",
+ "print WbyL,\"= W/L\"\n",
+ "print \"Data calculated for Q5\"\n",
+ "I_D=I_B-I/2;\n",
+ "print round(I_D*1e6),\"= I_D (microA)\"\n",
+ "g_m=2*I_D/V_OV;\n",
+ "print g_m,\"= g_m (mA/V)\"\n",
+ "r_o=V_A/I_D;\n",
+ "print int(r_o/1000),\"= r_o (Kohm)\"\n",
+ "WbyL=2*I_D/(k_n*V_OV**2); # WbyL =W/L\n",
+ "print WbyL,\"= W/L\"\n",
+ "print \"Data calculated for Q6\"\n",
+ "I_D=I_B-I/2;\n",
+ "print round(I_D*1e6),\"= I_D (microA)\"\n",
+ "g_m=2*I_D/V_OV;\n",
+ "print round(g_m*1e3,1),\"= g_m (mA/V)\"\n",
+ "r_o=V_A/I_D;\n",
+ "print int(r_o/1000),\"= r_o (Kohm)\"\n",
+ "WbyL=2*I_D/(k_n*V_OV**2); # WbyL =W/L\n",
+ "print WbyL,\"= W/L\"\n",
+ "print \"Data calculated for Q7\"\n",
+ "I_D=I_B-I/2;\n",
+ "print round(I_D*1e6),\"= I_D (microA)\"\n",
+ "g_m=2*I_D/V_OV;\n",
+ "print round(g_m*1e3,1),\"= g_m (mA/V)\"\n",
+ "r_o=V_A/I_D;\n",
+ "print int(r_o/1000),\"= r_o (Kohm)\"\n",
+ "WbyL=2*I_D/(k_n*V_OV**2); # WbyL =W/L\n",
+ "print WbyL,\"= W/L\"\n",
+ "print \"Data calculated for Q8\"\n",
+ "I_D=I_B-I/2;\n",
+ "print round(I_D*1e6),\"= I_D (microA)\"\n",
+ "g_m=2*I_D/V_OV;\n",
+ "print round(g_m*1e3,1),\"= g_m (mA/V)\"\n",
+ "r_o=V_A/I_D;\n",
+ "print int(r_o/1000),\"= r_o (Kohm)\"\n",
+ "WbyL=2*I_D/(k_n*V_OV**2); # WbyL =W/L\n",
+ "print WbyL,\"= W/L\"\n",
+ "print \"Data calculated for Q9\"\n",
+ "I_D=I_B;\n",
+ "print round(I_D*1e6),\"= I_D (microA)\"\n",
+ "g_m=2*I_D/V_OV;\n",
+ "print round(g_m*1e3,1),\"= g_m (mA/V)\"\n",
+ "r_o=V_A/I_D;\n",
+ "print int(r_o/1000),\"= r_o (Kohm)\"\n",
+ "WbyL=2*I_D/(k_p*V_OV**2); # WbyL =W/L\n",
+ "print WbyL,\"= W/L\"\n",
+ "print \"Data calculated for Q10\"\n",
+ "I_D=I_B;\n",
+ "print round(I_D*1e6),\"= I_D (microA)\"\n",
+ "g_m=2*I_D/V_OV;\n",
+ "print round(g_m*1e3,1),\"= g_m (mA/V)\"\n",
+ "r_o=V_A/I_D;\n",
+ "print int(r_o/1000),\"= r_o (Kohm)\"\n",
+ "WbyL=2*I_D/(k_p*V_OV**2); # WbyL =W/L\n",
+ "print WbyL,\"= W/L\"\n",
+ "print \"Data calculated for Q11\"\n",
+ "I_D=I;\n",
+ "print round(I_D*1e6),\"= I_D (microA)\"\n",
+ "g_m=2*I_D/V_OV;\n",
+ "print round(g_m*1e3,1),\"= g_m (mA/V)\"\n",
+ "r_o=V_A/I_D;\n",
+ "print r_o/1000,\"= r_o (Kohm)\"\n",
+ "WbyL=2*I_D/(k_n*V_OV**2); # WbyL =W/L\n",
+ "print WbyL,\"= W/L\"\n",
+ "gmro=160; # gmro=g_m*r_o\n",
+ "print gmro,\"= g_m*r_o for all transistors is (V/V)\"\n",
+ "V_GS=1;\n",
+ "print V_GS,\"= V_GS for all transistors is (V)\"\n",
+ "V_ICMmin=-V_SS+V_OV+V_OV+V_t;\n",
+ "print V_ICMmin,\"= The lowest value of input common mode voltage (V)\"\n",
+ "V_ICMmax=V_DD-V_OV+V_t;\n",
+ "print V_ICMmax,\"= The highest value of input common mode voltage (V)\"\n",
+ "v_omin=-V_SS+V_OV+V_OV+V_t;\n",
+ "print v_omin,\"= The lowest value of output swing allowable (V)\"\n",
+ "v_omax=V_DD-V_OV-V_OV;\n",
+ "print v_omax,\"= The highest value of output swing allowable (V)\"\n",
+ "r_o2=200.0*10**3; # r_o calculated for Q2\n",
+ "r_o10=80.0*10**3; # r_o calculated for Q10\n",
+ "R_o4=gmro*(r_o2*r_o10)/(r_o2+r_o10);\n",
+ "r_o8=133333.0; # r_o calculated for Q8\n",
+ "R_o6=gmro*r_o8;\n",
+ "R_o=R_o4*R_o6/(R_o4+R_o6);\n",
+ "print round(R_o/1e6,1),\"= Output resistance (Mohm)\"\n",
+ "G_M=0.0008;\n",
+ "A_v=G_M*R_o;\n",
+ "print round(A_v),\"= Voltage gain (V/V)\"\n",
+ "f_t=G_M/(2*math.pi*C_L);\n",
+ "print round(f_t/1e6,1),\"= Unity gain bandwidth (MHz)\"\n",
+ "f_P=f_t/A_v;\n",
+ "print round(f_P/1e3),\"= Dominant pole frequency (KHz)\"\n",
+ "SR=I/C_L;\n",
+ "print round(SR/1e6),\"= Slew Rate (V/microsecond)\"\n",
+ "I_t=0.5*10**-3; # total current\n",
+ "V_S=5; # Supply voltage\n",
+ "P_D=I_t*V_S;\n",
+ "print round(P_D*1e3,1),\"= Power dissipated (mW)\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Data calculated for Q1\n",
+ "100.0 = I_D (microA)\n",
+ "0.8 = g_m (mA/V)\n",
+ "200.0 = r_o (Kohm)\n",
+ "32.0 = W/L\n",
+ "Data calculated for Q2\n",
+ "100.0 = I_D (microA)\n",
+ "0.8 = g_m (mA/V)\n",
+ "200.0 = r_o (Kohm)\n",
+ "32.0 = W/L\n",
+ "Data calculated for Q3\n",
+ "150.0 = I_D (microA)\n",
+ "1.2 = g_m (mA/V)\n",
+ "133 = r_o (Kohm)\n",
+ "120.0 = W/L\n",
+ "Data calculated for Q4\n",
+ "150.0 = I_D (microA)\n",
+ "1.2 = g_m (mA/V)\n",
+ "133 = r_o (Kohm)\n",
+ "120.0 = W/L\n",
+ "Data calculated for Q5\n",
+ "150.0 = I_D (microA)\n",
+ "0.0012 = g_m (mA/V)\n",
+ "133 = r_o (Kohm)\n",
+ "48.0 = W/L\n",
+ "Data calculated for Q6\n",
+ "150.0 = I_D (microA)\n",
+ "1.2 = g_m (mA/V)\n",
+ "133 = r_o (Kohm)\n",
+ "48.0 = W/L\n",
+ "Data calculated for Q7\n",
+ "150.0 = I_D (microA)\n",
+ "1.2 = g_m (mA/V)\n",
+ "133 = r_o (Kohm)\n",
+ "48.0 = W/L\n",
+ "Data calculated for Q8\n",
+ "150.0 = I_D (microA)\n",
+ "1.2 = g_m (mA/V)\n",
+ "133 = r_o (Kohm)\n",
+ "48.0 = W/L\n",
+ "Data calculated for Q9\n",
+ "250.0 = I_D (microA)\n",
+ "2.0 = g_m (mA/V)\n",
+ "80 = r_o (Kohm)\n",
+ "200.0 = W/L\n",
+ "Data calculated for Q10\n",
+ "250.0 = I_D (microA)\n",
+ "2.0 = g_m (mA/V)\n",
+ "80 = r_o (Kohm)\n",
+ "200.0 = W/L\n",
+ "Data calculated for Q11\n",
+ "200.0 = I_D (microA)\n",
+ "1.6 = g_m (mA/V)\n",
+ "100.0 = r_o (Kohm)\n",
+ "64.0 = W/L\n",
+ "160 = g_m*r_o for all transistors is (V/V)\n",
+ "1 = V_GS for all transistors is (V)\n",
+ "-1.25 = The lowest value of input common mode voltage (V)\n",
+ "3.0 = The highest value of input common mode voltage (V)\n",
+ "-1.25 = The lowest value of output swing allowable (V)\n",
+ "2.0 = The highest value of output swing allowable (V)\n",
+ "6.4 = Output resistance (Mohm)\n",
+ "5120.0 = Voltage gain (V/V)\n",
+ "25.5 = Unity gain bandwidth (MHz)\n",
+ "5.0 = Dominant pole frequency (KHz)\n",
+ "40.0 = Slew Rate (V/microsecond)\n",
+ "2.5 = Power dissipated (mW)\n"
+ ]
+ }
+ ],
+ "prompt_number": 34
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.3:pg-908"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 9.3 : To determine input offset voltage\n",
+ "r_e=2.63*10**3; # (ohm)\n",
+ "R=1000; # (ohm)\n",
+ "I=9.5*10**-6; # (A)\n",
+ "deltaRbyR=0.02; # 2% mismatch between R_1 and R_2\n",
+ "G_m1=10**-3/5.26; # (A/V)\n",
+ "deltaI=deltaRbyR/(1+deltaRbyR + r_e/R); # Change of deltaI in I_E (A)\n",
+ "V_OS=deltaI/G_m1/1e2;\n",
+ "print round(V_OS,1),\"= Offset voltage (mV)\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "0.3 = Offset voltage (mV)\n"
+ ]
+ }
+ ],
+ "prompt_number": 42
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file |