Two stage op amp design on cadence
-
Upload
haowei-jiang -
Category
Engineering
-
view
206 -
download
13
Transcript of Two stage op amp design on cadence
![Page 1: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/1.jpg)
i
University at Buffalo
Department of Electrical Engineering
EE491/591 Analog Circuit
Two Stage Op-Amp Design on Cadence
& Mosek Optimization
Prepared by
Haowei Jiang
ID 5016 6365
Electrical Engineering
11 December 2015
![Page 2: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/2.jpg)
ii
3114 Deer Lakes Dr.
Amherst, NY, USA
14228
11 December 2015
Haowei Jiang, Graduate student
Electrical Engineering
University at Buffalo
Buffalo, NY
14260
Dear Sir:
This report, entitled " Two Stage Op-Amp Design on Cadence & Mosek Optimization”, was prepared
as my Project Report for the University at Buffalo. This report is in fulfillment of the course
EE491/591 Analog Circuit. The purpose of this report is to demonstrate the basic method of two
stage Op-Amp design, simulation on Cadence and optimization using Mosek. It is a self-study
report.
An acknowledgment of any assistance you received. I hereby confirm that I have received no further
help other than what is mentioned above in writing this report. I also confirm this report has not
been previously submitted for academic credit at this or any other academic institution.
Sincerely yours
Haowei Jiang
5016 6365
![Page 3: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/3.jpg)
iii
Contributions
This is a self-study project report not based on the experienced gained at my previous co-op project.
My tasks consisted of hand calculation of Op-Amp parameters, cadence schematic plot, DC & AC
analysis, modification based on specification, introduction of Mosek Optimization and simulation
on Matlab.
![Page 4: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/4.jpg)
iv
Summary
The main purpose of the report is to show the basic methods for designing a two stage Op-Amp
based on Cadence, and demonstrates and DC schematic plot and AC analysis simulation.
It comes that the result is highly close but not perfectly to the required specification.
Besides, this report presents the geometry optimization concerning the input configuration on
Matlab. However, it is a rather time-consuming process the software goes into NO-response. It
should be worked well with less subjective constraints.
![Page 5: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/5.jpg)
v
List of Figures
Figure 1.1. Hand calculation Stage-1 Input. ............................................................................ 2
Figure 1.2. Hand calculation Stage-2 output & Gain &Power Dissipation. ............................ 3
Figure 2.1. Two-stage Op-Amp design schematic. ................................................................. 5
Figure 3.1.1 DC operating point of all transistors (Vin,CM,min=1V). ................................... 6
Figure 3.1.2 DC operating point of all transistors (Vin,CM,max=2V). .................................. 7
Figure 3.2.2.1 Modified parameters of transistors in 2-Stage Op-amp. .................................. 9
Figure 3.2.2.2 Modified DC operating points of transistors in 2-Stage Op-amp
(Vin,CM,min=1V). ................................................................................................................... 10
Figure 3.2.2.3 Modified DC operating points of transistors in 2-Stage Op-amp
(Vin,CM,min=2V). ................................................................................................................... 10
Figure 3.2.3.1 Gain VS GBW VS PM plot. .......................................................................... 12
Figure 4.1.1 Two Stage Op-Amp Biasing Conditions. .......................................................... 15
Figure 4.1.2 Objective Function & Subjective Constraints. .................................................. 16
![Page 6: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/6.jpg)
vi
List of Tables
Table 1.1. Hand Calculation design parameters of 2-Stage Op-amp. ..................................... 4
![Page 7: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/7.jpg)
vii
Table of Contents
Introduction ……………….……………………………….………………………………………………………………………………1
1.0 Hand calculations for SPICE Level-1 model………………………………………………………………………………2
2.0 Design Schematic……………………………………………………………………………………………………………………5
3.0 Design Verification…….……………………………………………………………………………………………………………6
3.1 DC Analysis ....................................................................................................................... 6
3.2 AC Analysis ....................................................................................................................... 8
3.2.1 Manual calculation for gain ...................................................................................... 8
3.2.2 Modification ............................................................................................................. 9
3.2.3 ADE analysis & Discussion .................. ………………………………………………………………..12
4.0 Mosek Optimization……………………………….…………………………………………………………………………….13
4.1 Biasing Constraints Hand Writing ................................................................................... 16
4.2 Result .............................................................................................................................. 17
Conclusions ..................................................................................................................................... 18
Appendix …………………………………………………….…………………………………………………………………………….19
![Page 8: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/8.jpg)
1
Introduction
This report presents the design of two-stage Op-Amp and TSMC025 simulation based on Cadence,
including hand calculations for SPICE level 1 model, design schematic, and simulation verification
which followed by specifications shown as below:
(a) Phase margin 60°
(b) AV > 7500 V/V= 77.5dB
(c) VDD = 3.3V
(d) VSS = 0 V
(e) GB = 10MHz
(f) SR > 10V/µV
(g) Vout Range = 0.4 to 2.9 V
(h) ICMR = 1 V to 2V
(i) Pdiss < 5mW
(j) CL = 10pF
The report also shows the optimization of Level 1 design based on Mosek
![Page 9: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/9.jpg)
2
1.0 Hand calculations for SPICE Level-1 model
We choose Lmin=250nm to keep the channel modulation parameter constant. Scanned version and
parameters table are shown as below:
(Assuming: Sn= (W/L)n, βn= Kn*Sn)
Fig 1.1 Hand calculation Stage-1 Input
![Page 10: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/10.jpg)
3
Fig 1.2 Hand calculation Stage-2 output & Gain &Power Dissipation
![Page 11: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/11.jpg)
4
Table 1.1 Hand Calculation design parameters of 2-Stage Op-amp
Input Output
Cc 5pF gm6 4e-3Ω-1
I5 100μA gm3=gm4 8.52e-5Ω-1
S3=S4 3 S6 141
gm1=gm2 4e-4Ω-1 I6 3e-3A
S1=S2 24 S7 2700
VDS5 0.164V (>0.1V)
S5=S8 108
Av 142.2
Pdiss 8.35mW
![Page 12: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/12.jpg)
5
2.0 Design Schematic
As shown in Fig 2.1 below (based on hand calculation):
Fig 2.1 Two-stage Op-Amp design schematic
![Page 13: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/13.jpg)
6
3.0 Design Verification:
3.1 DC analysis:
We have to run DC analysis before AC analysis. Based on the hand calculation on Fig 1.1, the we
choose bias current I5=100μA, Vin,CM,min=1V Vin,CM,max=2V, then run the DC analysis to check
whether all transistors are in region 2, that is, saturation, and the DC operating point of each
transistors are shown in Fig 3.1.1 and Fig 3.1.2:
Fig 3.1.1 DC operating point of all transistors (Vin,CM,min=1V)
We could see that when Vin,CM,min=1V, each transistor is in saturation. Vds5 = 341.527mV > 100mV
![Page 14: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/14.jpg)
7
Fig 3.1.2 DC operating point of all transistors (Vin,CM,max=2V)
When Vin,CM,max=2V , all the transistors are in saturation too. Vds5 = 1.14499V > 100mV
![Page 15: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/15.jpg)
8
3.2 AC Analysis:
3.2.1 Manual calculation for gain:
We use Vin,CM,min=1V, then run DC analysis first:
Fig 3.2.1.1 gds ad gm in M2
Fig 3.2.1.2 gds ad gm in M4
Fig 3.2.1.3 gds ad gm in M6
Fig 3.2.1.4 gds ad gm in M7
Av1=gm2 / (gds2+gds4) = 584.732μ / (16.7393μ + 8.10513μ) = 23.54
Av2=gm6 / (gds6+gds7) = 5.56525m/ (461.164μ + 588.948 μ) = 5.3
Total gain = Av1 * Av2 = 124.726, close to hand calculation result
Then we use Vin,CM,max=2V, and run DC analysis again:
Fig 3.2.1.5 gds ad gm in M2
Fig 3.2.1.6 gds ad gm in M4
Fig 3.2.1.7 gds ad gm in M6
Fig 3.2.1.8 gds ad gm in M7
Av1=gm2 / (gds2+gds4) = 783.492μ / (26.0794μ + 11.3768μ) = 20.91
Av2=gm6 / (gds6+gds7) = 5.56565m / (462.618μ + 589.157μ) = 5.3
Total gain = Av1 * Av2 = 110.8, close to hand calculation result
The Gains are Too low! So we have to modify the model parameters in some of the transistors
![Page 16: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/16.jpg)
9
3.2.2 Modification:
We should follow this table to change the parameters in transistors to meet requirements.
Fig 3.2.2.1 Modified parameters of transistors in 2-Stage Op-amp
![Page 17: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/17.jpg)
10
Fig 3.2.2.2 Modified DC operating points of transistors in 2-Stage Op-amp (Vin,CM,min=1V)
Fig 3.2.2.3 Modified DC operating points of transistors in 2-Stage Op-amp (Vin,CM,max=2V)
![Page 18: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/18.jpg)
11
Follow the method in 3.2.1, so the Gain calculation: (Vin,CM,min=1V)
clear;
clc;
I5=22.4005e-6;
I6=-1.67135e-6;
gm2=57.4031e-6;
gds2=492.186e-9;
gds4=2.85409e-6;
gm6=26.4362e-6;
gds6=662.927e-9;
gds7=35.6442e-9;
a1=gm2/(gds2+gds4)
a2=gm6/(gds6+gds7)
a=a1*a2
pdiss=3.3*(I5+I6)
a1 = 17.1543
a2 = 37.8432
a_total = 649.1752 (has increased!)
pdiss = 6.8406e-05
![Page 19: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/19.jpg)
12
3.2.3 ADE Analysis & Discussion:
Gain & phase: Result Direct plot AC magnitude & phase
Power: output save all choose input all run result browser dc-op dc
It appears that the gain we calculated above is still not big enough.
To ensure the GBW, we have already set Cc to min that is: Cc >= 0.22CL=2.2pF, we take Cc =
2.3pF.
To ensure the SR >10e6, in this case, I5 = 22.4005e-6 (close to minimum value!), so the
SR=I5/Cc, close to 10e6.
Power dissipation= 6.8406e-05 < 5mW
However, the gain is not qualified.
So, this simulation still needs to be modified and be tested enough times to meet the required
specification.
AC response is shown as below, the final plot should be like
Fig 3.2.3.1 Gain VS GBW VS PM plot
We could see that the gain is 75dB close to 20*log(7500)=77dB,where the GBW is 8.8MHz close to
required 10 MHz, and phase margin is 66 degree close to 60 degree.
![Page 20: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/20.jpg)
13
4.0 Mosek Optimization:
Here we use geometry optimization method where we apply the mskgpopt function in Matlab.
There are three input matrix variables in this function: A, c, map. Each row of A and c describes
one term, that is, each row of A represents the factors of unknowns, each row of c means the
coefficient of each term and map indicates he vector map indicated whether a term belongs to the
objective or to a constraint. If mapk equals zero, the kth term belongs to the objective function,
otherwise it belongs to the mapkth constraint.
If the A matrix size is m x n, that means there are m number of terms covered in functions and
constraints; n number of unknowns.
Example code:
(Please infer the code from Appendix)
We could derive that there are 26 terms and 10 unknowns, so the
Objective Functions: (to minimize)
2 × 𝑡1 × 𝑡2 + 2 × 𝑡3 × 𝑡4 + 2 × 𝑡5 × 𝑡6 + 𝑡7 × 𝑡8 + 𝑡9 × 𝑡10
Subjective constraints:
0.333 × 𝑡3−0.5 × 𝑡40.5 ≤ 1
0.111 × 𝑡1−0.5 × 𝑡20.5 + 0.222 × 𝑡5−0.5 × 𝑡60.5 ≤ 1
180 × 𝑡9−0.5 × 𝑡100.5 ≤ 1
1.8𝑒 − 7 × 𝑡2−1 ≤ 1
1.8𝑒 − 7 × 𝑡4−1 ≤ 1
1.8𝑒 − 7 × 𝑡6−1 ≤ 1
1.8𝑒 − 7 × 𝑡8−1 ≤ 1
1.8𝑒 − 7 × 𝑡10−1 ≤ 1
100
√2× 𝑡1−0.5 × 𝑡20.5 × 𝑡7−0.5 × 𝑡80.5 ≤ 1
100
√2× 𝑡10.5 × 𝑡2−0.5 × 𝑡7−0.5 × 𝑡80.5 ≤ 1
1.888 × 𝑡1−0.5 × 𝑡20.5 ≤ 1
3.3
√2× 𝑡10.5 × 𝑡2−0.5 × 𝑡7−0.5 × 𝑡80.5 +
1
√2× 𝑡10.5 × 𝑡2−0.5 × 𝑡70.5 × 𝑡81.5
+1.1
√2× 𝑡1 × 𝑡2−1 × 𝑡82 ≤ 1
4.5𝑒 − 8 × 𝑡1−1 ≤ 1
4.5𝑒 − 8 × 𝑡3−1 ≤ 1
4.5𝑒 − 8 × 𝑡5−1 ≤ 1
![Page 21: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/21.jpg)
14
4.5𝑒 − 8 × 𝑡7−1 ≤ 1
4.5𝑒 − 8 × 𝑡9−1 ≤ 1
30 × 𝑡5−1 × 𝑡6 ≤ 1
![Page 22: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/22.jpg)
15
4.1 Bias Constraints Hand Writing:
Fig 4.1.1 Two Stage Op-Amp Biasing Conditions
![Page 23: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/23.jpg)
16
Fig 4.1.2 Objective Function & Subjective Constraints
![Page 24: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/24.jpg)
17
4.2 Result:
(Please infer the code from Appendix)
It took quite a long time to calculate that the Matlab is always in BUSY status. And my software
showed no response.
![Page 25: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/25.jpg)
18
Conclusion:
In this report, we have shown how to design a two-stage Op-Amp with required specification with
Cadence.
First, you need to do the hand calculations to choose design parameters on each transistors based
on their relationships chipped inside the circuit.
Second, plot the schematics and input the calculated results in the Cadence, runs both DC and AC
analysis.
Last, one has to modified the parameters and simulate several times until it meets all of the
specifications.
Also, we represent a Geometry Optimization method based on MOSEK Matlab to gain a better
design. However, we only shows derivations of objective function, subjective constraints and the
codes but did not get a result since the calculation is too time-consuming.
It should be worked well with less subjective constraints.
![Page 26: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/26.jpg)
19
Appendix:
Example:
%%op-amp%% simulation
c = [2 2 2 1 1 ...
0.333 ...
0.111 0.222 ...
180 ...
180.0000e-09 ...
180.0000e-09 ...
180.0000e-09 ...
180.0000e-09 ...
180.0000e-09 ...
99.999/sqrt(2) ...
99.999/sqrt(2) ...
1.888 ...
3.3/sqrt(2) 0.999/sqrt(2) 1.111/sqrt(2) ...
45.0000e-09 ...
45.0000e-09 ...
45.0000e-09 ...
45.0000e-09 ...
45.0000e-09 ...
30
]';
%generate spare matrix
a = sparse([[1 1 0 0 0 0 0 0 0 0]; [0 0 1 1 0 0 0 0 0 0]; [0 0 0 0 1
1 0 0 0 0]; ...
[0 0 0 0 0 0 1 1 0 0]; [0 0 0 0 0 0 0 0 1 1]; ...
[0 0 -0.5 0.5 0 0 0 0 0 0]; ...
[-0.5 0.5 0 0 0 0 0 0 0 0]; [0 0 0 0 -0.5 0.5 0 0 0 0]; ...
[0 0 0 0 0 0 0 0 -0.5 0.5];
[0 -1 0 0 0 0 0 0 0 0]; [0 0 0 -1 0 0 0 0 0 0]; [0 0 0 0 0 -1 0 0 0
0]; ...
[0 0 0 0 0 0 0 -1 0 0]; [ 0 0 0 0 0 0 0 0 0 -1]; ...
[-0.5 0.5 0 0 0 0 -0.5 0.5 0 0]; ...
[0.5 -0.5 0 0 0 0 -0.5 0.5 0 0]; ...
[-0.5 0.5 0 0 0 0 0 0 0 0]; ...
[0.5 -0.5 0 0 0 0 -0.5 0.5 0 0]; [0.5 -0.5 0 0 0 0 0.5 1.5 0 0]; [1 -
1 0 0 0 0 0 2 0 0]
[-1 0 0 0 0 0 0 0 0 0]; [0 0 -1 0 0 0 0 0 0 0]; [0 0 0 0 -1 0 0 0 0
0]; ...
[0 0 0 0 0 0 -1 0 0 0]; [0 0 0 0 0 0 0 0 -1 0]; ...
[0 0 0 0 -1 1 0 0 0 0]]);
![Page 27: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/27.jpg)
20
map = [0 0 0 0 0 ...
1 2 2 3 4 5 6 7 8 ...
9 10 11 ...
12 12 12 ...
13 14 15 16 17 ...
18]';
Simulation Code:
clear;
clc;
Kn=6.94e-5;
Kp=2.42e-5;
%%op-amp%% simulation
%variable sequence:W1 L1 W2 L2 W3 L3 W4 L4 W5 L5 W6 L6 W7 L7 W8 L8 Ibias
% 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
%template [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
% 27 total terms
%coefficient
c = [Kn^(1/2)/2e-12 ... %objective function 1 term
1 1 ... %W1,W2 match 2 terms
1 1 ... %L1,L2 match 2 terms
1 1 ... %W3,W4 match 2 terms
1 1 ... %L3,L4 match 2 terms
1 1 ... %L5,L8 match 2 terms
1 1 ... %L7,L8 match 2 terms
1 1 ... %L5,L7 match 2 terms
1/(0.57*(Kn)^(1/2)) 2^(1/2)/(0.57*(Kn)^(1/2)) ... %M1 Vcm,min 2 terms
1/(0.57*(Kn)^(1/2)) 2^(1/2)/(0.57*(Kn)^(1/2)) ... %M2 Vcm,min 2 terms
1/(1.12*(Kp)^(1/2)) ... %M1 Vcm,max 1 term
1/(1.12*(Kp)^(1/2)) ... %M2 Vcm,max 1 term
2^(1/2)/(0.57*(Kp)^(1/2)) ... %M6 Vout,max 1 term
2^(1/2)/(0.57*(Kn)^(1/2)) ... %M7 Vout,min 1 term
3.3/5e-4 ... %power 3 terms
3.3/5e-4 ... %power
3.3/5e-4 ... %power
1e-4 ... %Slew Rate 1 term
]';
![Page 28: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/28.jpg)
21
%generate spare matrix
a = sparse([[0.5 -0.5 0 0 0 0 0 0 0.5 0 0 0 0 0 -0.5 0
0]; ... %objective function 1 term
[1 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; [-1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
0]; ... %W1,W2 match 2 terms
[0 1 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0]; [0 -1 0 1 0 0 0 0 0 0 0 0 0 0 0 0
0]; ... %L1,L2 match 2 terms
[0 0 0 0 1 0 -1 0 0 0 0 0 0 0 0 0 0]; [0 0 0 0 -1 0 1 0 0 0 0 0 0 0 0 0
0]; ... %W3,W4 match 2 terms
[0 0 0 0 0 1 0 -1 0 0 0 0 0 0 0 0 0]; [0 0 0 0 0 0 -1 0 1 0 0 0 0 0 0 0
0]; ... %L3,L4 match 2 terms
[0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 -1 0]; [0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 1
0]; ... %L5,L8 match 2 terms
[0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 -1 0]; [0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 1
0]; ... %L7,L8 match 2 terms
[0 0 0 0 0 0 0 0 0 1 0 0 0 -1 0 0 0]; [0 0 0 0 0 0 0 0 0 -1 0 0 0 1 0 0
0]; ... %L5,L7 match 2 terms
[-0.5 0.5 0 0 0 0 0 0 0.5 0 0 0 0 0 -0.5 0 0.5]; [0 0 0 0 0 0 0 0 0 0.5 0
0 0 0 -0.5 0 0.5]; ... %M1 Vcm,min 2 terms
[0 0 -0.5 0.5 0 0 0 0 0.5 0 0 0 0 0 -0.5 0 0.5]; [0 0 0 0 0 0 0 0 0 0.5 0
0 0 0 -0.5 0 0.5]; ... %M2 Vcm,min 2 terms
[0 0 0 0 -0.5 0.5 0 0 0.5 0 0 0 0 0 -0.5 0
0.5]; ... %M1 Vcm,max 1 term
[0 0 0 0 0 0 -0.5 0.5 0.5 0 0 0 0 0 -0.5 0
0.5]; ... %M2 Vcm,max 1 term
[0 0 0 0 0 0 0 0 0 0 -0.5 0.5 0.5 0 -0.5 0
0.5]; ... %M6 Vout,max 1 term
[0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 -0.5 0
0.5]; ... %M7 Vout,min 1 term
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1]; ... %power 3
terms
[0 0 0 0 0 0 0 0 1 0 0 0 0 0 -1 0
1]; ... %power
[0 0 0 0 0 0 0 0 0 0 0 0 1 0 -1 0
1]; ... %power
[0 0 0 0 0 0 0 0 -1 0 0 0 0 0 1 0 -
1]; ... %Slew Rate 1
term
]);
map = [0 ... %objective function 1 term
1 2 ... %W1,W2 match 2 terms
![Page 29: Two stage op amp design on cadence](https://reader034.fdocuments.in/reader034/viewer/2022042500/58eedace1a28ab02628b4583/html5/thumbnails/29.jpg)
22
3 4 ... %L1,L2 match 2 terms
5 6 ... %W3,W4 match 2 terms
7 8 ... %L3,L4 match 2 terms
9 10 ... %L5,L8 match 2 terms
11 12 ... %L7,L8 match 2 terms
13 14 ... %L5,L7 match 2 terms
15 15 ... %M1 Vcm,min 2 terms
16 16 ... %M2 Vcm,min 2 terms
17 ... %M1 Vcm,max 1 term
18 ... %M2 Vcm,max 1 term
19 ... %M6 Vout,max 1 term
20 ... %M7 Vout,min 1 term
21 21 21 ... %power 3 terms
22 ... %Slew Rate 1 term
]';
[res] = mskgpopt(c,a,map);
fprintf('\nPrimal optimal solution to original gp:');
fprintf(' %e',exp(res.sol.itr.xx));
fprintf('\n\n');
% Compute the optimal objective value and the constraint activities.
v = c.*exp(a*res.sol.itr.xx);
% Add appropriate terms together.
f = sparse(map+1,1:27,ones(size(map)))*v;
% First objective value. Then constraint values.
fprintf('Objective value: %e\n',f(1));
fprintf('Constraint values:');
fprintf(' %e',log(f(2:end)));
fprintf('\n\n');
% Dual multipliers (should be negative)
fprintf('Dual variables (should be negative):');
fprintf(' %e',res.sol.itr.y);
fprintf('\n\n');