{

 "metadata": {

  "name": "",

  "signature": "sha256:862d4d2200cef4afafe4b0610190ff2ff686b747269183b5312528ef1b293d1a"

 },

 "nbformat": 3,

 "nbformat_minor": 0,

 "worksheets": [

  {

   "cells": [

    {

     "cell_type": "heading",

     "level": 1,

     "metadata": {},

     "source": [

      "Chapter01:Analog Integrated Circuit Design"

     ]

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex1.1:Pg-10"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 1.1\n",

      "import math\n",

      "VDD=1.8;#V\n",

      "IREF=50;#micro A\n",

      "IO=IREF;#micro A\n",

      "L=0.5;#micro m\n",

      "W=5;#micro m\n",

      "Vt=0.5;#V\n",

      "Kn_dash=250;#micro A/V**2\n",

      "VGS=math.sqrt(IO/(1/2.0*Kn_dash*(W/L)))+Vt;#V\n",

      "print VGS,\" is the Value of VGS(V) \"\n",

      "R=(VDD-VGS)/(IREF*10**-6);#ohm\n",

      "print R/1000,\" is the Value of R(kohm) \"\n",

      "VDS2=VGS-Vt;#V\n",

      "VO=VDS2;#V\n",

      "print VO,\" is the Lowest value of VO(V) \"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "0.7  is the Value of VGS(V) \n",

        "22.0  is the Value of R(kohm) \n",

        "0.2  is the Lowest value of VO(V) \n"

       ]

      }

     ],

     "prompt_number": 1

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex1.3:Pg-12"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 1.3\n",

      "\n",

      "VDD=1.8;#V\n",

      "Vt=0.6;#V\n",

      "mpCox=100;#a A/V**2\n",

      "IREF=80;#micro A\n",

      "VOmax=1.6;#V\n",

      "VSG=VDD-VOmax+Vt;#V\n",

      "VGS=-VSG;#V\n",

      "VS=VDD;#V\n",

      "VG=VGS+VS;#V\n",

      "R=VG/(IREF*10**-6);#ohm\n",

      "ID=IREF;#micro A\n",

      "WbyL=2*ID*10**-6/(mpCox*10**-6)/(VGS+Vt)**2;#unitless\n",

      "print VGS,\"= Value of VGS(V) \"\n",

      "print VG,\"= Value of VG(V) \"\n",

      "print R/1000,\"= Value of R(kohm) \"\n",

      "print WbyL,\"= W/L ratio \"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "-0.8 = Value of VGS(V) \n",

        "1.0 = Value of VG(V) \n",

        "12.5 = Value of R(kohm) \n",

        "40.0 = W/L ratio \n"

       ]

      }

     ],

     "prompt_number": 4

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex1.4:Pg-19"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 1.4\n",

      "\n",

      "Beta=80;#unitless\n",

      "print \"IREF=IC1+IC1/Beta+IO/Beta)\"\n",

      "print \"IO/IREF=m implies IC1=IO/m as IC1=IREF\"\n",

      "print \"IREF=IO*(1/m+1/m/Beta+1/Beta)\"\n",

      "print \"IO/IREF=m/(1+1/Beta+m/Beta)\"\n",

      "print \"IO/IREF=m*(1-5/100)\"#for large Beta\n",

      "m=(1/(1-5.0/100)-1)*Beta-1;#Current transfer ratio\n",

      "print round(m,2),\" is Largest current transfer ratio \"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "IREF=IC1+IC1/Beta+IO/Beta)\n",

        "IO/IREF=m implies IC1=IO/m as IC1=IREF\n",

        "IREF=IO*(1/m+1/m/Beta+1/Beta)\n",

        "IO/IREF=m/(1+1/Beta+m/Beta)\n",

        "IO/IREF=m*(1-5/100)\n",

        "3.21  is Largest current transfer ratio \n"

       ]

      }

     ],

     "prompt_number": 7

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex1.7:pg-37"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 1.7\n",

      "\n",

      "Beta=80;#untless\n",

      "print \"g8=IC1+IC1/Beta+IO/Beta\"\n",

      "print \"IO/IREF=m implies IC1=IO/m as IC1=IREF\"\n",

      "print \"IREF=IO*(1/m+1/m/Beta+1/Beta\"\n",

      "print \"IO/IREF=m/(1+1/Beta+m/Beta\"\n",

      "print \"IO/IREF=m*(1-5/100)\"#for large Beta\n",

      "m=(1/(1-5.0/100)-1)*Beta-1;#Current transfer ratio\n",

      "print round(m,2),\"Largest current transfer ratio  \"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "g8=IC1+IC1/Beta+IO/Beta\n",

        "IO/IREF=m implies IC1=IO/m as IC1=IREF\n",

        "IREF=IO*(1/m+1/m/Beta+1/Beta\n",

        "IO/IREF=m/(1+1/Beta+m/Beta\n",

        "IO/IREF=m*(1-5/100)\n",

        "3.21 Largest current transfer ratio  \n"

       ]

      }

     ],

     "prompt_number": 63

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex1.9:Pg-39"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 1.9\n",

      "\n",

      "\n",

      "Beta=20.0;#unitless\n",

      "IObyIREF=1/(1+2/Beta);#Current gain\n",

      "print round(IObyIREF,2),\" is Current gain  \"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "0.91  is Current gain  \n"

       ]

      }

     ],

     "prompt_number": 10

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex1.10:Pg-39"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 1.10\n",

      "\n",

      "IREF=2;#mA\n",

      "IO=IREF;#mA\n",

      "VA2=90.0;#V\n",

      "Vo1=1.0;#V\n",

      "Vo2=10.0;#V\n",

      "ro2=VA2/IO;#kohm\n",

      "delVO=Vo2-Vo1;#V\n",

      "delIO=delVO/ro2;#mA\n",

      "Change=delIO/IO*100;#%\n",

      "print Change,\" % is Change in Io \"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "10.0  % is Change in Io \n"

       ]

      }

     ],

     "prompt_number": 13

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex1.11:Pg-40"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 1.11\n",

      "\n",

      "import math\n",

      "VBE3=0.7;#V\n",

      "VBE1=0.7;#V\n",

      "IREF1=100.0;#micro A\n",

      "IC1=IREF1;#micro A\n",

      "IREF2=1.0;#mA\n",

      "IC2=IREF2;#mA\n",

      "Beta=200.0;#unitless\n",

      "#IC2/IC1=(IS*exp(VBE2/VT))/(IS*exp(VBE1/VT))\n",

      "VT=26.0;#mV\n",

      "deltaVBE=VT*10**-3*math.log(IC2/IC1);#V(deltaVBE=VBE2-VBE1)\n",

      "deltaVx=2*deltaVBE;#V\n",

      "IO=IREF1/(1+2.0/(Beta**2+Beta));#micro A\n",

      "delIO=IC1-IO;#micro A\n",

      "Change=delIO/IO*100;#%\n",

      "print round(Change,4),\" % is Change in Io\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "0.005  % is Change in Io\n"

       ]

      }

     ],

     "prompt_number": 18

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex1.12:Pg-41"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 1.12\n",

      "\n",

      "Iout=8;#micro A\n",

      "VBE=0.7;#V\n",

      "VCC=20.0;#V\n",

      "Beta=80.0;#unitless\n",

      "IREF=Iout*(1+2/Beta);#micro A\n",

      "print IREF,\" is Reference current in micro A : \"\n",

      "R=(VCC-VBE)/(IREF);#Mohm\n",

      "print round(R,2),\" is Resistance in Mohm \"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "8.2  is Reference current in micro A : \n",

        "2.35  is Resistance in Mohm \n"

       ]

      }

     ],

     "prompt_number": 22

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex1.13:Pg-42"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 1.13\n",

      "\n",

      "Iout=1;#mA\n",

      "VBE=0.7;#V\n",

      "VCC=30.0;#V\n",

      "Beta=100.0;#unitless\n",

      "IREF=Iout*(1+2/Beta);#mA\n",

      "print IREF,\" is Reference current in (mA) \"\n",

      "R=(VCC-VBE)/(IREF);#kohm\n",

      "print round(R,1),\"is Resistance in (kohm) \"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "1.02  is Reference current in (mA) \n",

        "28.7 is Resistance in (kohm) \n"

       ]

      }

     ],

     "prompt_number": 25

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex1.14:Pg-42"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 1.14\n",

      "\n",

      "Iout=0.5;#mA\n",

      "VBE=0.7;#V\n",

      "VCC=5.0;#V\n",

      "Beta=50.0;#unitless\n",

      "IREF=Iout*(1+2/Beta);#mA\n",

      "print IREF,\" is Reference current in (mA) \"\n",

      "R=(VCC-VBE)/(IREF);#kohm\n",

      "print round(R,3),\" is Resistance in (kohm) \"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "0.52  is Reference current in (mA) \n",

        "8.269  is Resistance in (kohm) \n"

       ]

      }

     ],

     "prompt_number": 28

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex1.15:Pg-43"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 1.15\n",

      "\n",

      "Iout=8;#micro A\n",

      "VBE=0.7;#V\n",

      "VCC=20.0;#V\n",

      "Beta=100.0;#unitless\n",

      "IREF=Iout*(1+2/Beta/(Beta+1));#micro A\n",

      "print round(IREF,2),\" is Reference current in (micro A)  \"\n",

      "R=(VCC-2*VBE)/(IREF);#Mohm\n",

      "print round(R,2),\" is Resistance in (Mohm) \"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "8.0  is Reference current in (micro A)  \n",

        "2.32  is Resistance in (Mohm) \n"

       ]

      }

     ],

     "prompt_number": 31

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex1.16:Pg-45"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 1.16\n",

      "\n",

      "Beta=120;#unitless\n",

      "VBE=0.7;#V\n",

      "VCC=10.0;#V\n",

      "R=5.6;#kohm\n",

      "#IREF=IC1+I1;as Beta>>1\n",

      "#I1=IC2+IB3;as Beta>>1\n",

      "IREF=(VCC-VBE)/R;#mA\n",

      "#IREF=IC*(2+1/Beta) or IREF=2*IC;as Beta>>1\n",

      "IC=IREF/2;#mA\n",

      "Iout=IC;#mA\n",

      "print round(Iout,2),\"is Iout for the circuit in (mA) \"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "0.83 is Iout for the circuit in (mA) \n"

       ]

      }

     ],

     "prompt_number": 33

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex1.17:Pg-45"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 1.17\n",

      "import math\n",

      "Iout=6;#micro A\n",

      "IREF=1.2;#mA\n",

      "VBE2=0.7;#V\n",

      "VT=26.0;#mV\n",

      "VCC=20.0;#V\n",

      "Beta=120;#unitless\n",

      "R=(VCC-VBE2)/IREF;#kohm\n",

      "IC2=(IREF-Iout/Beta)/(1+1/Beta);#mA\n",

      "RS=VT/Iout*math.log(IC2*1000/Iout);#kohm\n",

      "print int(R),\"Kohm and \",round(RS,2),\"kohm are the Values of resistance R & Rs for widlar current source design\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "16 Kohm and  22.96 kohm are the Values of resistance R & Rs for widlar current source design\n"

       ]

      }

     ],

     "prompt_number": 40

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex1.18:Pg-47"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 1.18\n",

      "\n",

      "import math\n",

      "IREF=1;#mA\n",

      "IO2=20.0;#micro A\n",

      "IO3=40.0;#micro A\n",

      "VBE1=0.7;#V\n",

      "VT=26;#mV\n",

      "VCC=10;#V\n",

      "VEE=-VCC;#V\n",

      "R=(VCC-VBE1-VEE)/IREF;#kohm\n",

      "RE2=VT*10**-3/(IO2*10**-6)*math.log((IREF*10**-3)/(IO2*10**-6));#ohm\n",

      "RE2=RE2/1000;#kohm\n",

      "RE3=VT*10**-3/(IO3*10**-6)*math.log((IREF*10**-3)/(IO3*10**-6));#ohm\n",

      "RE3=RE3/1000;#kohm\n",

      "print R,\", \",round(RE2,3),\"and \", round(RE3,2),\" are Values of resistance R, RE2 & RE3 for widlar current source design in kohm \"\n",

      "VBE2=VBE1-RE2*IO2*10**-3;#V\n",

      "VBE3=VBE1-RE3*IO3*10**-3;#V\n",

      "\n",

      "print round(VBE2,3),\"and\",round(VBE3,3),\" are Values of VBE2 & VBE3 in V \"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "19.3 ,  5.086 and  2.09  are Values of resistance R, RE2 & RE3 for widlar current source design in kohm \n",

        "0.598 and 0.616  are Values of VBE2 & VBE3 in V \n"

       ]

      }

     ],

     "prompt_number": 49

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex1.19:Pg-48"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 1.19\n",

      "\n",

      "Beta=100.0;#unitless\n",

      "VBE=0.715;#V\n",

      "VEE=10.0;#V\n",

      "R=5.6;#kohm\n",

      "IREF=(VEE-VBE)/R;#mA\n",

      "IC1=IREF/(1+2/Beta);#mA\n",

      "print round(IC1,2),\" is Collector current in each transistor is equal as all are identical. It in (mA) \"\n",

      "IRC=3*IC1;#mA\n",

      "print round(IRC,2),\"is Current through resistance Rc in (mA)  \"\n",

      " # the answer is slightly different in textbook due to approximation"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "1.63  is Collector current in each transistor is equal as all are identical. It in (mA) \n",

        "4.88 is Current through resistance Rc in (mA)  \n"

       ]

      }

     ],

     "prompt_number": 52

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex1.20:Pg-49"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 1.20\n",

      "\n",

      "Vout=5.0;#V\n",

      "Beta=180.0;#unitless\n",

      "VBE=0.7;#V\n",

      "VEE=10.0;#V\n",

      "Vout=5;#V\n",

      "R1=22.0;#kohm\n",

      "R2=2.2;#kohm\n",

      "IREF=(VEE-VBE)/R1;#mA\n",

      "IC=(IREF-VBE/R2)/(1+2/Beta);#mA\n",

      "IC1=IC*1000;#micro A(as VBE1=VBE2 IC1=IC2)\n",

      "IC2=IC*1000;#micro A\n",

      "print round(IC2,2),\",\",round(IC1,2),\" are Current IC1 & IC2 in micro A  \"\n",

      "RC=(VEE-Vout)/(IC1*10**-3);#kohm\n",

      "print round(RC,2),\"is Value of Rc in (kohm) \"\n",

      "\n",

      "#Answer is different in the textbook due to approximation\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "103.4 , 103.4  are Current IC1 & IC2 in micro A  \n",

        "48.36 is Value of Rc in (kohm) \n"

       ]

      }

     ],

     "prompt_number": 56

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex1.21:Pg-51"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 1.21\n",

      "\n",

      "AQ2byA1=0.5;\n",

      "AQ3byA1=0.25;\n",

      "AQ4byA1=0.125;\n",

      "VBE=0.7;#V\n",

      "VCC=15.0;#V\n",

      "R=20.0;#kohm\n",

      "IC1=(VCC-VBE)/R;#mA\n",

      "IC2=IC1*AQ2byA1;#mA\n",

      "IC3=IC1*AQ3byA1;#mA\n",

      "IC4=IC1*AQ4byA1;#mA\n",

      "print round(IC2,4),\",\",round(IC3,3),\"and\",round(IC4,3),\"are the Values of current IC2, IC3 & IC4 in (mA)  \"\n",

      "#Value of IC4 is displayed wrong in the textbook.\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "0.3575 , 0.179 and 0.089 are the Values of current IC2, IC3 & IC4 in (mA)  \n"

       ]

      }

     ],

     "prompt_number": 62

    }

   ],

   "metadata": {}

  }

 ]

}