summaryrefslogtreecommitdiff
path: root/Microelectronic_Circuits_by_A.S._Sedra_and_K.C._Smith/Chapter10.ipynb
blob: 1ea303b00bcbd36c5d3220a2fd985dbdd585792e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
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": {}

  }

 ]

}