ece4902 lab 5 simulation simulationcourses.ece.wpi.edu/ece4902/labs/lab5/l5c.pdfece4902 lab 5...

22
ECE4902 Lab 5 Simulation Simulation Export data for use in other software tools (e.g. MATLAB or excel) to compare measured data with simulation Be sure to have your lab data available from Lab 5, Common Source Amplifier with Active Load. Also, be sure you use the updated model files using the parameters you developed and verified in Labs 3 and 4. Following is an overview of the sections of this lab S5-1. Common Source amplifier with active load Here you draw the schematic and set up the simulation for the common source amplifier from Lab 5 S5-2. DC sweep, finding operating point From the DC sweep of the common source amplifier, you find the DC operating point to use for the AC sweep in part S5-4. S5-3. Using calculator to find gain from DC sweep plot The low-frequency small-signal gain is the slope of the DC input-output plot at the operating point. The Calculator function in cadence can be used to calculate functions of waveforms, for example, derivatives. S5-4. AC sweep at operating point Here we use the simulator to sweep frequency (rather than DC voltage). The result is a plot of behavior vs. frequency. If we plot magnitude and phase of gain vs. frequency, we have a Bode plot S5-5. Using Bode plot to find gain, f3dB, fT The Bode plot can be used to find the bandwidth (3-dB frequency f 3dB ) and the unity gain frequency (f T ) S5-6. Exporting to MATLAB Data can be exported for use in other software tools (e.g. MATLAB or excel) to compare measured data with simulation S5-1. Common source amplifier with active load Using the techniques you've practiced in simulating Labs 1 and 3, draw the schematic of the common source amplifier with active load. Your schematic should look something like this:

Upload: others

Post on 13-Jul-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ECE4902 Lab 5 Simulation Simulationcourses.ece.wpi.edu/ece4902/labs/lab5/L5c.pdfECE4902 Lab 5 Simulation Simulation Export data for use in other software tools (e.g. MATLAB or excel)

ECE4902 Lab 5 Simulation

Simulation

Export data for use in other software tools (e.g. MATLAB or excel) to compare measured data with simulation Be sure to have your lab data available from Lab 5, Common Source Amplifier with Active Load. Also, be sure you use the updated model files using the parameters you developed and verified in Labs 3 and 4. Following is an overview of the sections of this lab

S5-1. Common Source amplifier with active load

Here you draw the schematic and set up the simulation for the common source amplifier from Lab 5

S5-2. DC sweep, finding operating point

From the DC sweep of the common source amplifier, you find the DC operating point to use for the AC sweep in part S5-4.

S5-3. Using calculator to find gain from DC sweep plot

The low-frequency small-signal gain is the slope of the DC input-output plot at the operating point. The Calculator function in cadence can be used to calculate functions of waveforms, for example, derivatives.

S5-4. AC sweep at operating point

Here we use the simulator to sweep frequency (rather than DC voltage). The result is a plot of behavior vs. frequency. If we plot magnitude and phase of gain vs. frequency, we have a Bode plot

S5-5. Using Bode plot to find gain, f3dB, fT

The Bode plot can be used to find the bandwidth (3-dB frequency f3dB) and the unity gain frequency (fT)

S5-6. Exporting to MATLAB

Data can be exported for use in other software tools (e.g. MATLAB or excel) to compare measured data with simulation

S5-1. Common source amplifier with active load

Using the techniques you've practiced in simulating Labs 1 and 3, draw the schematic of the common source amplifier with active load. Your schematic should look something like this:

Page 2: ECE4902 Lab 5 Simulation Simulationcourses.ece.wpi.edu/ece4902/labs/lab5/L5c.pdfECE4902 Lab 5 Simulation Simulation Export data for use in other software tools (e.g. MATLAB or excel)

Note the input source V_IN. In class we have usually drawn the input as two separate sources, a DC bias source setting the operating point and a small signal source in series. While we could draw two sources in the schematic, it is more common practice to set the DC and AC source values in one source. To see how this is done, let's look at the Properties window for the V_IN source:

Page 3: ECE4902 Lab 5 Simulation Simulationcourses.ece.wpi.edu/ece4902/labs/lab5/L5c.pdfECE4902 Lab 5 Simulation Simulation Export data for use in other software tools (e.g. MATLAB or excel)

Note that the Properties window allows entries for both the AC magnitude (value of the small signal component) and the DC voltage (the DC bias level). A little explanation is in order here:

1. DC voltage For the DC bias, we will sweep the value of the variable vdc_in to find the correct input operating point to give an output operating point of +2.5V. This corresponds to your procedure in lab, when you adjusted the DC offset of the function generator to get the correct DC operating point at your circuit output.

2. AC magnitude This is supposed to be the "small signal" -- but there is an AC magnitude of 1V entered!?! From your lab measurements you know that a 1V input amplitude is much too big to satisfy the "small signal" assumption, and would result in clipping

Page 4: ECE4902 Lab 5 Simulation Simulationcourses.ece.wpi.edu/ece4902/labs/lab5/L5c.pdfECE4902 Lab 5 Simulation Simulation Export data for use in other software tools (e.g. MATLAB or excel)

at the output. To measure the gain in lab, you applied a small input magnitude (for example, maybe 10mV peak), then measured the output magnitude (of order 1V peak), then divided | vout | / | vin | to get the small-signal gain.

The key here is that the AC analysis we will be doing uses the linearized small-signal model. It doesn't check for sanity in the output amplitude. If the small signal gain of your circuit is 100, and you apply an AC input of 1V peak, it will tell you the output is 100V peak. As an experienced designer you know this won't really happen. But, the reason we use a 1V input is that we can see the gain directly without having to divide by the input magnitude -- since the input is 1, the output magnitude corresponds directly to the gain. So, with this background information, let's proceed to the simulations.

S5-2. DC sweep, finding operating point Do a DC sweep of vdc_in, the DC value of the input source V_IN. Because of the steep slope of the input-output plot in the high gain region, you will need to reduce the sweep increment to around 1mV to be sure of seeing the gain behavior in the high gain region.

1) Start Analog Environment

Once you've saved the schematic and started the Analog Environment tool, click on the Edit > Copy from Cell view to enter the vdc_in variable name. You need to supply some value for the simulator to run, so just enter something reasonable like 2V for now. You will be sweeping the DC value to get a precise operating point shortly.

Page 5: ECE4902 Lab 5 Simulation Simulationcourses.ece.wpi.edu/ece4902/labs/lab5/L5c.pdfECE4902 Lab 5 Simulation Simulation Export data for use in other software tools (e.g. MATLAB or excel)

2) Set up DC sweep

Choose a DC analysis. Click on the "Component Parameter" button and select the V_IN component on the schematic. Sweep the dc value over a range that (based on your lab measurements) you know will include the high gain portion of the input-output plot. In this example I chose a Start point of 1V and a Stop point of 3V. Choose a Linear Sweep, with a Step Size of 1mV to be sure of seeing the high gain region.

Page 6: ECE4902 Lab 5 Simulation Simulationcourses.ece.wpi.edu/ece4902/labs/lab5/L5c.pdfECE4902 Lab 5 Simulation Simulation Export data for use in other software tools (e.g. MATLAB or excel)

3) Choose outputs to be plotted

On the schematic, choose two quantities to plot: the output voltage and the drain current of the NMOS device. Use the Outputs > To Be Plotted > Select On Schematic and remember to click on a node wire to plot a voltage; on an element terminal to plot a current.

Page 7: ECE4902 Lab 5 Simulation Simulationcourses.ece.wpi.edu/ece4902/labs/lab5/L5c.pdfECE4902 Lab 5 Simulation Simulation Export data for use in other software tools (e.g. MATLAB or excel)

4) Run the simulation

The Analog Environment should now look like this, ready to run the simulation:

Page 8: ECE4902 Lab 5 Simulation Simulationcourses.ece.wpi.edu/ece4902/labs/lab5/L5c.pdfECE4902 Lab 5 Simulation Simulation Export data for use in other software tools (e.g. MATLAB or excel)

Do not forget to set the model libraries!

After sweeping the DC value of V_IN from 1V to 3V with 1mV resolution, your output should be similar (not identical!) to the following:

Page 9: ECE4902 Lab 5 Simulation Simulationcourses.ece.wpi.edu/ece4902/labs/lab5/L5c.pdfECE4902 Lab 5 Simulation Simulation Export data for use in other software tools (e.g. MATLAB or excel)

5) New Sub-window feature

To see the values more clearly, it's usually beneficial to plot both graphs on separate axes. To plot on separate axes, click on the "New Sub-window" button (circled in red above), then select and drag one of the traces to the new window. You should see a plot similar to the following:

Page 10: ECE4902 Lab 5 Simulation Simulationcourses.ece.wpi.edu/ece4902/labs/lab5/L5c.pdfECE4902 Lab 5 Simulation Simulation Export data for use in other software tools (e.g. MATLAB or excel)

Now you can use the crosshairs to identify the value of V_IN that corresponds to an output DC bias level of 2.5V. In the example shown above, the top cursor is at an output of 2.5V; both devices are in the active region) for an input voltage of 1.871V You will use this value as the DC component of V_IN for the AC sweep later. In this example, for vout to be at 2.5V, the variable vdc_in should be at 1.871V.

The µA, bottom cursor shows that the DC drain current at this operating point is 105 which should be close to the current measured in the lab.

Page 11: ECE4902 Lab 5 Simulation Simulationcourses.ece.wpi.edu/ece4902/labs/lab5/L5c.pdfECE4902 Lab 5 Simulation Simulation Export data for use in other software tools (e.g. MATLAB or excel)

6) Deleting a plot

Once you've verified the DC current at the operating point, you can delete the plot of drain current to simplify the display and focus on the output voltage behavior. Simply click in the sub-window and hit the delete key. It should disappear and you will be back to a single plot of only vout.

Now you can use the delta cursor to select points around the center of the linear range. To select the delta cursor hit 'd' or go to Trace > Delta cursor. Here the "slope = -90.5" tells us to expect a small signal gain (slope of the input-output plot) of -90.5 when we do the AC analysis.

Page 12: ECE4902 Lab 5 Simulation Simulationcourses.ece.wpi.edu/ece4902/labs/lab5/L5c.pdfECE4902 Lab 5 Simulation Simulation Export data for use in other software tools (e.g. MATLAB or excel)

5-3. Using calculator to find gain from DC sweep plot

The DC gain is the slope or derivative of the DC sweep plot. You can plot the derivative using the 'deriv' function of the calculator.

1) Go to Tools > Calculator to open this tool.

Page 13: ECE4902 Lab 5 Simulation Simulationcourses.ece.wpi.edu/ece4902/labs/lab5/L5c.pdfECE4902 Lab 5 Simulation Simulation Export data for use in other software tools (e.g. MATLAB or excel)

2) First delete anything that may be in the equation area. We now need to select the output waves to do calculations on. Click on the button marked wave, and then in the simulation output plot window. Click on the output waveform. Next find and select deriv from the functions list on the right, and then click plot (circled in red above) to plot the resulting equation.

Page 14: ECE4902 Lab 5 Simulation Simulationcourses.ece.wpi.edu/ece4902/labs/lab5/L5c.pdfECE4902 Lab 5 Simulation Simulation Export data for use in other software tools (e.g. MATLAB or excel)

You should see a plot like this:

Page 15: ECE4902 Lab 5 Simulation Simulationcourses.ece.wpi.edu/ece4902/labs/lab5/L5c.pdfECE4902 Lab 5 Simulation Simulation Export data for use in other software tools (e.g. MATLAB or excel)

Zoom in on the high gain region to get a better look.

Page 16: ECE4902 Lab 5 Simulation Simulationcourses.ece.wpi.edu/ece4902/labs/lab5/L5c.pdfECE4902 Lab 5 Simulation Simulation Export data for use in other software tools (e.g. MATLAB or excel)

Note a few things from this zoomed-in view:

• The derivative is not constant in the high gain region! Even though the plot of vout looks kind of linear, it really isn't, as is shown by the varying derivative. The reason is that the actual current-voltage characteristic at the drain, which we represent with a small signal output resistance rds, isn't really linear. To get linear behavior from our eventual op-amp design, we will need to use negative feedback around the high gain op-amp.

• The maximum value of the derivative, -97.7, is larger in magnitude than what we predicted from the slope between the delta cursors. To get the maximum small signal gain, we should use an input DC operating point of 1.87V in the AC analysis. We should then expect something about -97.7 for the DC gain of the circuit.

S5-4. AC sweep at operating point

1) Set up for AC sweep in analog Environment

In

• Open the Analysis window and select ac. • Click on Frequency for the Sweep Variable • Set Frequency range for 1 to 1G (1GHz), and a Logarithmic sweep of 20

points per decade. This will give good resolution for your Bode plot

Page 17: ECE4902 Lab 5 Simulation Simulationcourses.ece.wpi.edu/ece4902/labs/lab5/L5c.pdfECE4902 Lab 5 Simulation Simulation Export data for use in other software tools (e.g. MATLAB or excel)

3) Simulate

Set the DC value of the input source vdc_in to the VIN from the previous part corresponding to the output being at the intended operating point. To simplify the output plot, delete the dc analysis and the output plot of drain current - just look at vout

Page 18: ECE4902 Lab 5 Simulation Simulationcourses.ece.wpi.edu/ece4902/labs/lab5/L5c.pdfECE4902 Lab 5 Simulation Simulation Export data for use in other software tools (e.g. MATLAB or excel)

Run the simulation and you will get the AC magnitude as a function of frequency. It's not a Bode plot yet, since there's no phase and the vertical axis is in linear units, not dB. Check that the low frequency (~DC) gain corresponds with the value you got earlier from the derivative of the input-output DC plot. In this case, the low frequency value of 97.68 matches up well.

Page 19: ECE4902 Lab 5 Simulation Simulationcourses.ece.wpi.edu/ece4902/labs/lab5/L5c.pdfECE4902 Lab 5 Simulation Simulation Export data for use in other software tools (e.g. MATLAB or excel)

4) Go back to the Analog Environment simulation interface, and click on Results > Direct Plot > AC Magnitude and Phase.

Page 20: ECE4902 Lab 5 Simulation Simulationcourses.ece.wpi.edu/ece4902/labs/lab5/L5c.pdfECE4902 Lab 5 Simulation Simulation Export data for use in other software tools (e.g. MATLAB or excel)

5) Go to the schematic window. Click on the 'vout' net. Then hit the Esc key to finish the selection. On the Waveform separate the axes again to get a better look at what's going on. You should see a plot like the one below:

S5-5. Using Bode plot to find gain, 3dB bandwidth f3dB, Unity Gain Frequency fT

The low frequency gain should match the DC gain from the previous part. Use the cursors to find the 3-dB frequency and the unity gain frequency and compare to your measured results. In the plot above, the low frequency DC gain is 39.8dB, which converts to 10(39.8/20) = 97.7. At a frequency of 920 Hz, the gain magnitude has dropped to a value 3dB

Page 21: ECE4902 Lab 5 Simulation Simulationcourses.ece.wpi.edu/ece4902/labs/lab5/L5c.pdfECE4902 Lab 5 Simulation Simulation Export data for use in other software tools (e.g. MATLAB or excel)

below its maximum - so the bandwidth is 920Hz. The plot below shows the gain has dropped to approximately 0dB (unity) at a frequency of 87.8 kHz. Note that 97.7 X 920Hz = 89.8 kHz ~ 87.8 kHz, a preview of the gain-bandwidth product relationship!

S5-6. Exporting to MATLAB, Excel, etc.

1) Go back to the waveform window. In this example, it is the Bode plot just created. 2) Open Tools > Calculator. Click the 'Wave' button and select the waveform you want. In this example, it is the magnitude plot (in dB). 3) Click the button 'tabular results display' (circled in red below) and click 'ok'.

Page 22: ECE4902 Lab 5 Simulation Simulationcourses.ece.wpi.edu/ece4902/labs/lab5/L5c.pdfECE4902 Lab 5 Simulation Simulation Export data for use in other software tools (e.g. MATLAB or excel)

You have to set the range you are looking for:

To get any use from this information you need to be able to access it from MATLAB or some other program. To do this, select

File > Save as CSV

to save the data as a comma delimited file, which can then be read into MATLAB.