# Chapter09:Operational-Amplifier and Data-Converter Circuits¶

## Ex9.1:pg-881¶

In :
A_v=4000.0; # (V/V)
V_A=20.0; # (V)
k_p=80.0*10**-6; # k'_n=k_n (A/V**2)
k_n=200.0*10**-6; # k'_p=k_P (A/V**2)
V_SS=1.65; # (V)
V_DD=1.65; # (V)
V_tn=0.5; # (V)
V_tp=0.5; # (V)
C_1=0.2*10**-12; # (F)
C_2=0.8*10**-12; # (F)
I_D=100.0*10**-6; # (A)
V_OV=math.sqrt(V_A**2/A_v);
WbyL_1=I_D*2/(V_OV**2*k_p); # WbyL_1=(W/L)_1
print WbyL_1,"= Required (W/L) ratio for Q_1"
WbyL_2=WbyL_1; # WbyL_2=(W/L)_2
print WbyL_2,"= Required (W/L) ratio for Q_2"
WbyL_3=I_D*2/(V_OV**2*k_n); # WbyL_3=(W/L)_3
print WbyL_3,"= Required (W/L) ratio for Q_3"
WbyL_4=WbyL_3; # WbyL_4=(W/L)_4
print WbyL_4,"= Required (W/L) ratio for Q_4"
I_D=200*10**-6;
WbyL_5=I_D*2/(V_OV**2*k_p); # WbyL_5=(W/L)_5
print WbyL_5,"= Required (W/L) ratio for Q_5"
I_D=500*10**-6;
WbyL_7=2.5*WbyL_5; # WbyL_7=(W/L)_7
print WbyL_7,"= Required (W/L) ratio for Q_7"
WbyL_6=I_D*2/(V_OV**2*k_n); # WbyL_6=(W/L)_6
print WbyL_6,"= Required (W/L) ratio for Q_6"
WbyL_8=0.1*WbyL_5; # WbyL_8=(W/L)_8
print WbyL_8,"= Required (W/L) ratio for Q_8"
V_ICMmin=-V_SS+V_OV+V_tn-V_tp;
print round(V_ICMmin,2),"= The lowest value of input common mode voltage"
V_ICMmax=V_DD-V_OV-V_OV-V_tp;
print round(V_ICMmax,2),"= The highest value of input common mode voltage"
v_omin=-V_SS+V_OV;
print round(v_omin,2),"= The lowest value of output swing allowable"
v_omax=V_DD-V_OV;
print  round(v_omax,2),"= The highest value of output swing allowable"
R_o=20/(2*0.5);
print R_o,"= Input resistance is practically infinite and output reistance is (Kohm)"
G_m2=2*I_D/V_OV;
print round(G_m2*1e3,1),"= G_m2 (mA/V)"
f_P2=3.2*10**-3/(2*math.pi*C_2);
print round(f_P2/1e6),"= f_P2 (MHz)"
R=1/G_m2;
print int(R),"= To move the transmission zero to s=infinite , r value selected as (ohm)"
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
print round(f_t/1e6),"= f_t (MHz)"
G_m1=2*100*10**-6/V_OV; # I_D = 100uA
C_C1=G_m1/(2*math.pi*f_t);
print round(C_C1/1e-12,1),"= C_C1 (picoF)"
SR=2*math.pi*f_t*V_OV;
print round(SR/1e6),"= SR (V/micros)"

25.0 = Required (W/L) ratio for Q_1
25.0 = Required (W/L) ratio for Q_2
10.0 = Required (W/L) ratio for Q_3
10.0 = Required (W/L) ratio for Q_4
50.0 = Required (W/L) ratio for Q_5
125.0 = Required (W/L) ratio for Q_7
50.0 = Required (W/L) ratio for Q_6
5.0 = Required (W/L) ratio for Q_8
-1.33 = The lowest value of input common mode voltage
0.52 = The highest value of input common mode voltage
-1.33 = The lowest value of output swing allowable
1.33 = The highest value of output swing allowable
20.0 = Input resistance is practically infinite and output reistance is (Kohm)
3.2 = G_m2 (mA/V)
637.0 = f_P2 (MHz)
316 = To move the transmission zero to s=infinite , r value selected as (ohm)
171.0 = f_t (MHz)
0.6 = C_C1 (picoF)
339.0 = SR (V/micros)


## Ex9.2:pg-889¶

In :
# Consider a design of the folded-cascode op amp
I=200*10.0**-6; # (A)
I_B=250.0*10**-6; # (A)
V_OV=0.25; # (V)
k_n=100.0*10**-6; # k_n=k'_n (A/V**2)
k_p=40*10.0**-6; # k_p=k'_p (A/V**2)
V_A=20.0; # V_A=V'_A (V/um)
V_DD=2.5; # (V)
V_SS=2.5; # (V)
V_t=0.75; # (V)
L=1*10.0**-6; # (m)
C_L=5*10.0**-12; # (F)
print "Data calculated for Q1"
I_D=I/2;
print round(I_D*1e6),"= I_D (microA)"
g_m=2*I_D/V_OV;
print round(g_m*1e3,1),"= g_m (mA/V)"
r_o=V_A/I_D;
print r_o/1000,"= r_o (Kohm)"
WbyL=2*I_D/(k_n*V_OV**2); # WbyL =W/L
print WbyL,"= W/L"
print "Data calculated for Q2"
I_D=I/2;
print round(I_D*1e6),"= I_D (microA)"
g_m=2*I_D/V_OV;
print round(g_m*1e3,1),"= g_m (mA/V)"
r_o=V_A/I_D;
print r_o/1000,"= r_o (Kohm)"
WbyL=2*I_D/(k_n*V_OV**2); # WbyL =W/L
print WbyL,"= W/L"
print "Data calculated for Q3"
I_D=I_B-I/2;
print round(I_D*1e6),"= I_D (microA)"
g_m=2*I_D/V_OV;
print round(g_m*1e3,1),"= g_m (mA/V)"
r_o=V_A/I_D;
print int(r_o/1000),"= r_o (Kohm)"
WbyL=2*I_D/(k_p*V_OV**2); # WbyL =W/L
print WbyL,"= W/L"
print "Data calculated for Q4"
I_D=I_B-I/2;
print round(I_D*1e6),"= I_D (microA)"
g_m=2*I_D/V_OV;
print round(g_m*1e3,1),"= g_m (mA/V)"
r_o=V_A/I_D;
print int(r_o/1000),"= r_o (Kohm)"
WbyL=2*I_D/(k_p*V_OV**2); # WbyL =W/L
print WbyL,"= W/L"
print "Data calculated for Q5"
I_D=I_B-I/2;
print round(I_D*1e6),"= I_D (microA)"
g_m=2*I_D/V_OV;
print g_m,"= g_m (mA/V)"
r_o=V_A/I_D;
print int(r_o/1000),"= r_o (Kohm)"
WbyL=2*I_D/(k_n*V_OV**2); # WbyL =W/L
print WbyL,"= W/L"
print "Data calculated for Q6"
I_D=I_B-I/2;
print round(I_D*1e6),"= I_D (microA)"
g_m=2*I_D/V_OV;
print round(g_m*1e3,1),"= g_m (mA/V)"
r_o=V_A/I_D;
print int(r_o/1000),"= r_o (Kohm)"
WbyL=2*I_D/(k_n*V_OV**2); # WbyL =W/L
print WbyL,"= W/L"
print "Data calculated for Q7"
I_D=I_B-I/2;
print round(I_D*1e6),"= I_D (microA)"
g_m=2*I_D/V_OV;
print round(g_m*1e3,1),"= g_m (mA/V)"
r_o=V_A/I_D;
print int(r_o/1000),"= r_o (Kohm)"
WbyL=2*I_D/(k_n*V_OV**2); # WbyL =W/L
print WbyL,"= W/L"
print "Data calculated for Q8"
I_D=I_B-I/2;
print round(I_D*1e6),"= I_D (microA)"
g_m=2*I_D/V_OV;
print round(g_m*1e3,1),"= g_m (mA/V)"
r_o=V_A/I_D;
print int(r_o/1000),"= r_o (Kohm)"
WbyL=2*I_D/(k_n*V_OV**2); # WbyL =W/L
print WbyL,"= W/L"
print "Data calculated for Q9"
I_D=I_B;
print round(I_D*1e6),"= I_D (microA)"
g_m=2*I_D/V_OV;
print round(g_m*1e3,1),"= g_m (mA/V)"
r_o=V_A/I_D;
print int(r_o/1000),"= r_o (Kohm)"
WbyL=2*I_D/(k_p*V_OV**2); # WbyL =W/L
print WbyL,"= W/L"
print "Data calculated for Q10"
I_D=I_B;
print round(I_D*1e6),"= I_D (microA)"
g_m=2*I_D/V_OV;
print round(g_m*1e3,1),"= g_m (mA/V)"
r_o=V_A/I_D;
print int(r_o/1000),"= r_o (Kohm)"
WbyL=2*I_D/(k_p*V_OV**2); # WbyL =W/L
print WbyL,"= W/L"
print "Data calculated for Q11"
I_D=I;
print round(I_D*1e6),"= I_D (microA)"
g_m=2*I_D/V_OV;
print round(g_m*1e3,1),"= g_m (mA/V)"
r_o=V_A/I_D;
print r_o/1000,"= r_o (Kohm)"
WbyL=2*I_D/(k_n*V_OV**2); # WbyL =W/L
print WbyL,"= W/L"
gmro=160; # gmro=g_m*r_o
print gmro,"= g_m*r_o for all transistors is (V/V)"
V_GS=1;
print V_GS,"= V_GS for all transistors is (V)"
V_ICMmin=-V_SS+V_OV+V_OV+V_t;
print V_ICMmin,"= The lowest value of input common mode voltage (V)"
V_ICMmax=V_DD-V_OV+V_t;
print V_ICMmax,"= The highest value of input common mode voltage (V)"
v_omin=-V_SS+V_OV+V_OV+V_t;
print v_omin,"= The lowest value of output swing allowable (V)"
v_omax=V_DD-V_OV-V_OV;
print v_omax,"= The highest value of output swing allowable (V)"
r_o2=200.0*10**3; # r_o calculated for Q2
r_o10=80.0*10**3; # r_o calculated for Q10
R_o4=gmro*(r_o2*r_o10)/(r_o2+r_o10);
r_o8=133333.0; # r_o calculated for Q8
R_o6=gmro*r_o8;
R_o=R_o4*R_o6/(R_o4+R_o6);
print round(R_o/1e6,1),"= Output resistance (Mohm)"
G_M=0.0008;
A_v=G_M*R_o;
print round(A_v),"= Voltage gain (V/V)"
f_t=G_M/(2*math.pi*C_L);
print round(f_t/1e6,1),"= Unity gain bandwidth (MHz)"
f_P=f_t/A_v;
print round(f_P/1e3),"= Dominant pole frequency (KHz)"
SR=I/C_L;
print round(SR/1e6),"= Slew Rate (V/microsecond)"
I_t=0.5*10**-3; # total current
V_S=5; # Supply voltage
P_D=I_t*V_S;
print round(P_D*1e3,1),"= Power dissipated (mW)"

Data calculated for Q1
100.0 = I_D (microA)
0.8 = g_m (mA/V)
200.0 = r_o (Kohm)
32.0 = W/L
Data calculated for Q2
100.0 = I_D (microA)
0.8 = g_m (mA/V)
200.0 = r_o (Kohm)
32.0 = W/L
Data calculated for Q3
150.0 = I_D (microA)
1.2 = g_m (mA/V)
133 = r_o (Kohm)
120.0 = W/L
Data calculated for Q4
150.0 = I_D (microA)
1.2 = g_m (mA/V)
133 = r_o (Kohm)
120.0 = W/L
Data calculated for Q5
150.0 = I_D (microA)
0.0012 = g_m (mA/V)
133 = r_o (Kohm)
48.0 = W/L
Data calculated for Q6
150.0 = I_D (microA)
1.2 = g_m (mA/V)
133 = r_o (Kohm)
48.0 = W/L
Data calculated for Q7
150.0 = I_D (microA)
1.2 = g_m (mA/V)
133 = r_o (Kohm)
48.0 = W/L
Data calculated for Q8
150.0 = I_D (microA)
1.2 = g_m (mA/V)
133 = r_o (Kohm)
48.0 = W/L
Data calculated for Q9
250.0 = I_D (microA)
2.0 = g_m (mA/V)
80 = r_o (Kohm)
200.0 = W/L
Data calculated for Q10
250.0 = I_D (microA)
2.0 = g_m (mA/V)
80 = r_o (Kohm)
200.0 = W/L
Data calculated for Q11
200.0 = I_D (microA)
1.6 = g_m (mA/V)
100.0 = r_o (Kohm)
64.0 = W/L
160 = g_m*r_o for all transistors is (V/V)
1 = V_GS for all transistors is (V)
-1.25 = The lowest value of input common mode voltage (V)
3.0 = The highest value of input common mode voltage (V)
-1.25 = The lowest value of output swing allowable (V)
2.0 = The highest value of output swing allowable (V)
6.4 = Output resistance (Mohm)
5120.0 = Voltage gain (V/V)
25.5 = Unity gain bandwidth (MHz)
5.0 = Dominant pole frequency (KHz)
40.0 = Slew Rate (V/microsecond)
2.5 = Power dissipated (mW)


## Ex9.3:pg-908¶

In :
r_e=2.63*10**3; # (ohm)
R=1000; # (ohm)
I=9.5*10**-6; # (A)
deltaRbyR=0.02; # 2% mismatch between R_1 and R_2
G_m1=10**-3/5.26; # (A/V)
deltaI=deltaRbyR/(1+deltaRbyR + r_e/R); # Change of deltaI in I_E (A)
V_OS=deltaI/G_m1/1e2;
print round(V_OS,1),"= Offset voltage (mV)"

0.3 = Offset voltage (mV)