ECE 3410, Utah State University
A MOSFET device in SPICE is instantiated by starting a line with the letter M
:
In an integrated circuit, MOSFETs can be made with varying sizes, resulting in different channel width and length, and also differing areas and perimeters around their source and drain terminals. These geometry parameters can optionally be specified for each individual device. Although optional, geometry parameters are necessary for accurate simulation.
A MOSFET depends physically on the voltage at four nodes: drain, gate, source, and substrate. The substrate usually has one of these configurations:
In this lab we will use the CD4007 integrated circuit in which all N-type substrates are connected to -VSS, and all P-type substrates are connected to VDD. To ensure proper substrate biasing, it is essential to connect positive and negative power supplies to the indicated pins.
In this course we are using the CD4007 MOSFET array chip which contains a mix of N-type and P-type devices with partially completed wiring as shown below.
Models for the N-type and P-type models are provided in models/mosfets.md
.
To use the models, the model file must first be included in the spice netlist. Then the MOSFETs may be placed using statements like this:
MOSFET model parameters describe the device’s material composition and physical parameters. SPICE supports many different “levels” of MOS models, from very simple square-law models up to advanced models with dozens of equations and parameters.
The simplest model is Level 1. Here are some of the level 1 model parameters for the CD4007 N device:
Parameter | SPICE Symbol | Value |
---|---|---|
Threshold voltage VthN | VT0 | 2V |
Scale factor KN′ = μnCox | Kp | 111μA/V2 |
Channel length modulation λN | lambda | 0.01V − 1 |
The level-1 parameters for a P-type device:
Parameter | SPICE Symbol | Value |
---|---|---|
Threshold voltage VthP | VT0 | -1.5V |
Scale factor KP′ = μpCox | Kp | 55μA/V2 |
Channel length modulation λP | lambda | 0.04V − 1 |
The Level 1 model has up to 45 parameters to account for various attributes like terminal capacitances, threshold voltage variation, device noise, and manufacturing imperfections.
First we will simulate an N-type device and compare it to our hand-analysis equations. This schematic is implemented in a file named netlists/nmos_iv.sp
. Study the each part of the netlist file until you understand each part of it.
To simulate the circuit, a testbench is provided in a file named tests/nmos_iv_test.sp
. This testbench implements a DC sweep simulation for vds
, varying it from 0V to 9V in steps of 0.1V. Open the file and study it carefully.
A collection of DC simulations is generated using a foreach
loop. In each pass through the loop, vgs
is changed using the alter
command, so that we repeat the I/V simulation for a sequence of different gate voltages. This allows us to visualize how the current depends on both VDS and VGS.
When successive DC simulations are performed, the results are stored under names dc1.
, dc2.
, and so on. The control commands shown below will produce the desired simulations and overlay the results in a single plot. The I/V curves are saved in plots/nmos_iv.svg
.
Your simulation should produce a family of standard I/V plots like the one shown below. When VDS is increased beyond Vov, the current flattens out (mostly), indicating the saturation mode. The saturation current level is controlled by the gate voltage. Each curve represents a different gate voltage, therefore a different saturation level.
Next we will modify the testbench to show the prediction from hand analysis.
Within the foreach
loop, add the calculations and plot commands shown below. These commands calculate Vov, determine whether the device is in saturation (the ge
operator is used, meaning “greater than or equal to”), then calculate the saturation and triode current equations, and finally combine them to predict the NMOS current. The prediction is based on the standard MOSFET device equations:
For each value of the gate voltage, you should see a plot like the one shown below. Since the prediction and simulated result are very close, the pointplot
option was used so they can be distinguished more easily. You should notice that the prediction is close, but not exact.
The current is predicted more accurately if we account for channel length modulation (CLM). To do so, we introduce the correction factor (1+lambda*VDS).
Add these lines within the foreach
loop in your testbench:
As seen in the plot below, the CLM correction is able to correct for most of the discrepancy between the predicted and simulated currents.
Open the file named netlists/pmos_iv.sp
which implements the schematic shown below. Study the file carefully until you completely understand it.
For this schematic, repeat all the simulations and analyses that you performed for the NMOS device. In all the filenames for netlists, testbenches, and plots, change nmos
to pmos
. When calculating predictions, you will need to replace NMOS model parameters with the appropriate PMOS values (see table data provided in the earlier slide).
Create a file named netlists/nmos_rtl_inverter.sp
and implement the schematic shown below. Notice that this schematic includes a 0V “meter source” named Vm
. The meter source is used to observe the branch current, since SPICE saves current data for voltage sources.
Create a testbench named tests/nmos_rtl_test.sp
and perform these simulations:
b
with gate/drain voltages vg_b
and vd_b
.c
with drain voltage vd_c
.Record your hand calculations and comparisons in a text file named analysis.txt
. Include a separate section for each resistor value.
Perform the simulations using a foreach
construct like this:
Next, alter the testbench so that it computes the derivative of ID with respect to VG. You may recall that diD/dvG is the transconductance of the MOSFET device. Also calculate the derivative of VD with respect to VG, which measures the voltage gain. In SPICE, the deriv
command is used to calculate derivatives. After a DC sweep simulation, all derivatives are calculated with respect to the sweep variable (VG in this case).
The NMOS RTL circuit can be used as an analog amplifier. In that application, the gain is the derivative dVout/dVin. If VG is the input and VD is the output, then the amplifier’s gain is dVD/dVG. Note that the gain varies for different values of VG. To make a high-gain amplifier, we need to know the offset VG where the derivative is largest.
SPICE measures the maximum value using the MAX
measurement. To measure the corresponding voltage at VG, we use the MAX_AT
measurement and save the result in a variable named offset
. Also measure the transconductance at that point, using the FIND/AT
measurement, and save the result in a variable named maxgm
.
In your analysis.txt
file, explain how the offset
relates to the saturation boundary voltages vg_b
,vd_b
. Include numerical comparisons.
There are now three sets of DC simulation results. They can be accessed using prefix dc1
, dc2
, and dc3
as in the lines below.
plot dc1.nd dc2.nd dc3.nd
plot dc1.id dc2.id dc3.id
plot dc1.gain dc2.gain dc3.gain
plot dc1.gm dc2.gm dc3.gm
hardcopy plots/nmos_rtl_vd.svg dc1.nd dc2.nd dc3.nd
hardcopy plots/nmos_rtl_id.svg dc1.id dc2.id dc3.id
hardcopy plots/nmos_rtl_gain.svg dc1.gain dc2.gain dc3.gain
hardcopy plots/nmos_rtl_gm.svg dc1.gm dc2.gm dc3.gm
end
.endc
.end
The transfer characteristic shows a weak logic inversion when R1 is low (case dc1, the red curve), and a better response when R1 is highest (case dc3, the orange curve). A higher resistance also produces a steeper curve – this predicts that the gain should be higher when the resistance is higher.
Since we are sweeping VG, the current follows the square law when VG is small. ID increases parabolically until the device crosses into the triode mode. Since the transconductance is gm=dI/dV, we expect gm to be maximum where the curve is steepest, at the boundary between saturation and triode.
In saturation mode, the MOSFET can be considered as a transconductance amplifier where the input is a voltage (at the gate) and the output is a current (at the drain). Under this interpretation, the transconductance gain is maximized at the boundary between triode and saturation, as seen here:
For a small-signal input vg, the MOSFET (in saturation) acts like a transconductance amplifier with gain gm and load R1. The output current is id = gmvg, and is scaled by R1 to produce the drain voltage vd = − idR1 = − gmvgR1. Therefore the voltage gain is dvD/dvG = vd/vg = − gmR1. The gain magnitude is gm*R1.
Since the gain is gm*R1, the gain curves follow the same shape as the gm curve, but their magnitudes are re-ordered since they are scaled by R1.
Next, alter the testbench to simulate the RTL inverter as a signal amplifier. Do do so, use the alter
command to create a sinusoidal input at VG with an offset voltage equal to the measured offset
value, an amplitude equal to 1mV, and a frequency of 1kHz. Use the PP
measurement to measure the output peak-to-peak amplitude. The signal gain is the amplitude ratio VD(pp)/VG(pp).
To perform all these tasks, add these lines within the foreach
loop:
alter @vg[sin] = [ $&offset 1m 1k ]
tran 1u 6m
meas tran vopp pp v(nd)
let transient_gain=vopp/2m
echo "Transient gain is " $&transient_gain
* subtract the average signal levels to see the small signal:
let insig = ng - avg(ng)
let outsig = nd - avg(nd)
plot insig outsig
hardcopy plots/nmos_rtl_tran_{$r}.svg insig outsig
After subtracting the average signal levels, we see the AC variations in the output (drain) compared to the input (gate). The output amplitude is bigger than the input amplitude, so the signal has been amplified.
In your analysis.txt
file, edit the sections for each resistor value and record all SPICE measurement results. The maximum gain
result from the DC simulation should be close to the transient gain. How do they compare?
The measured gain values should also be close to gmR1 for each case. Using the measurement maxgm
as the transconductance, calculate gmR1 for each case and note how closely it matches the other gain measurements.
The preferred way to turn in your work is to use git
. From the Linux terminal:
git add *
git commit -a -m "Submitting SPICE 4 assignment"
git push origin master
Alternatively you can upload a ZIP file to Canvas containing all your assignment files.