diff options
Diffstat (limited to 'Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter9.ipynb')
-rwxr-xr-x | Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter9.ipynb | 394 |
1 files changed, 394 insertions, 0 deletions
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 |