ECD Lab
ECD Lab
SPICE (Simulation Program for Integrated Circuits Emphasis) is a general purpose analog circuit
simulator that is used to verify circuit designs and to predict the circuit behaviour. PSpice is a PC
version of SPICE and HSpice is a version that runs on workstations and larger computers. PSpice
has analog and digital libraries of standard components.
Types of Analysis:1)DC analysis
2)Transient analysis
3)Linear AC Analysis
4)Noise analysis
5)Fourier analysis
5) And more...
COMPONENTS:-
DEPPARTMENT OF ECE
Fig:- MOSFET
We perform PSPICE schematics circuit simulation according to following steps:Design your circuit in schematics. This can be divided into following sub steps:1). First insert all the parts without considering their values (for example, place a resistor without
considering the resistance value of it, etc.).
2). Make the necessary rotations for the parts, and move the parts to appropriate locations.
3). Make all the necessary wire connections.
4). Mark the nodes you are interested in with labels.
5). Set the values for all the parts, for example, the resistance values of resistors, the width (W)
and length (L) of transistor, etc.
2. Define the SPICE model for NMOS and PMOS transistors.
3. Setup analysis to tell SPICE what simulation you need (transient analysis, DC sweep, etc.)
4. Run the simulation.
5. Observe the simulation results (traces of signals) in OrCAD PSpice A/D Demo.
DEPPARTMENT OF ECE
Step 1. Design you circuit in Schematics:Before we start our design, first please create your own folder in C: drive. Because our lab
computer has some access limitation on certain system folders, if you are working in a system
directory, you may not be able to save your design or your spice library. Thus first please click
onWindows start menu: StartAll ProgramsAccessoriesWindows Explorer. In Windows
Explorer, click on C: drive symbol to select C: drive, and click menu FileNewFolder, as
shown below
You will see a new folder is created on C: drive. Rename the new folder to any name you like,
for example, John or something else, and remember this folder path and name. By creating
your own folder, you will have full access to it. You will save all your design files into this
folder.
DEPPARTMENT OF ECE
DEPPARTMENT OF ECE
PSpice Schematics will launch and you see the following interface.
DEPPARTMENT OF ECE
2. Click on menu FileNew, a new blank schematic sheet will appear as below. Now you can
design your circuit schematic on it.
3. First please save your schematic design as a file. Please click on menu FileSave, you will
see popup window, please select the directory you created just now, for example, c:\john on C:
drive.
Select that folder in your Save in line. You also need to define a name for the file. You can use
any filename you like, just type it in File name row. Then click Save.
DEPPARTMENT OF ECE
4. Now we are ready to design the circuit in schematics. First you need to place all the parts
inyour circuit. In this circuit, we only have a few parts: two DC voltage sources, one analog
ground, one resistor, and one NMOS transistor. You can find these parts from the schematic
libraries.
Please click on menu DrawGet new part. Alternatively, you can just click on the
smallshortcut icon of Get New Part, as circled in the following figure.
Now you will see following popup window. In the line below Part Name:, please type
Vdc.This is the part name of simple DC voltage source. Each part have a unique part name,
you can just type the part name to find the part. Now please click Place and Close.
DEPPARTMENT OF ECE
After that you will see a DC voltage source symbol moving with your mouse. Click your mouse
at two different locations, you will see that you have inserted two DC voltage source instances on
schematic. If you dont want DC source anymore, just press the ESC button on your keyboard
and you will exit the mode of inserting DC source. Now your schematic should look like follow.
Please note that currently we dont worry about the values of the DC source (both of them are 0V
now). We will set the values of the parts later. Please also note that you can click on a part to
select it, its color will turn to red. You can click and drag it to move it to anywhere in your
schematic, and release the button to release it. Also you can select it and then press delete key
in your keyboard to delete it.
DEPPARTMENT OF ECE
5. Repeat the similar procedure as step 5 to insert a resistor and analog ground. Please use R
as part name to find resistor, and use part name GND_ANALOG to find analog ground. For
the MOS transistors, generally in CMOS VLSI circuit schematic NMOS and PMOS are drawn
as 3-terminal devices, as shown in the following figure.
However, this is only a simplified expression. Real NMOS and PMOS devices are 4
terminaldevices. In PSPICE, you have different choices for NMOS and PMOS devices. For
example, NMOS device symbols include MbreakN3, MbreakN3D, MbreakN4, MbreakN4D, as
shown in following figure. The meaning of the names are: Mbreak: indicating its a MOS
transistor, N: indicating its NMOS, 3 or 4: indicating its 3 terminal or 4 terminal. 3
terminal symbol is actually a 4-terminal symbol with its bulk (B) shorted to source (S). D:
indicating its depleted device (threshold voltage Vth<0). If D is not specified, its an enhanced
NMOS device (threshold voltage Vth>0). Generally we use enhanced instead of depleted
devices.
Generally, we will use MbreakN4 device for NMOS transistor in our circuit design, that is, 4terminal enhanced NMOS device. Please double check to make sure you are using t correct
NMOS transistor MbreakN4 (enhanced device), not MbreakN4D (depleted device). Otherwise
you will get a wrong result for your circuit. Please also note that you will need to connect the
bulk (B) of the MbreakN4 to lowest voltage level in your circuit (analog ground or most negative
power source Vss if any). Now please use part name MbreakN4 to place an instance of
MbreakN4 transistor to your schematics.
DEPPARTMENT OF ECE
Note: Similarly, for PMOS device you also have different choices: MbreakP3, MbreakP3D,
MbreakP4, MbreakP4D. Generally we will use MbreakP4 symbol for PMOS transistors in our
VLSI circuit, that is, 4-terminal enhanced PMOS device. Please double check to make sure you
are using t correct PMOS transistor MbreakP4 (enhanced device), not MbreakP4D (depleted
device).
Otherwise you will get a wrong result for your circuit. Please also note that you will need to
connect the bulk (B) of the MbreakP4 to highest voltage level in your circuit (Vdd
powerSource).
.
6. After you placed all the parts, now your circuit should look like this.
10
DEPPARTMENT OF ECE
Now we are going to rotate some parts if it is required. For example, in our circuit we need to
rotate resistor R1. Please left click to select the resistor so that its color urn to red. Then click on
menu EditRotate, you will see the resistor R1 is rotated by 90. Again, with R1 selected,
click on menu EditFlip. This will flip R1 upside down. This is to ensure the resistor R1 will
have correct current polarity: current flows from node 1 to 2, instead of from node 2 to 1. Now
your circuit should look like follow.
7. Now we are going to connect all the parts with wires. Please click on the small Draw Wire
icon, which is circled as shown below. Please be sure you click on the Draw Wire icon instead
of the Draw Bus icon right beside it: they look very similar to each other, but one is for wire
and another is for bus.
11
DEPPARTMENT OF ECE
Now your cursor has changed the shape into a pencil. Please click on one end of a part and then
move to the end of another part to make the corresponding wire connection between them. Please
note that if you draw a wrong wire, you can press the ESC button on your keyboard to exit
wire mode, and then click to selected the wrong wire and press delete button on your keyboard
to delete it. If a part is connected with wires, you can click this part to select it, and drag it to
other place, then you will see that the wire connection also move together with the part. After
you finish all the wire connection, please press ESC button on keyboard to exit the wire mode.
Now your schematic should look like follow. Please note that we connected the bulk (B) of the
NMOS transistor to the lowest voltage level (analog ground) in this circuit.
8. Now we will mark the nodes we are interested in with labels (names). This will be very
helpful when you wish to observe the current or voltage signals in certain nodes after the
simulation because you can easily find these signals by the label names. For example, we are
interested in the gate, drain and source of the transistor M1, then we will mark the nodes with
names of Mg, Md, Ms separately. Please double click on the wire segment (node) of the gate
of transistor M1, a popup window appears as follow. Type Mg in the row below LABEL,
and click OK. You will see the gate node of transistor M1 is marked with label Mg now.
Similarly, you can also mark the other nodes with Md and MsS, and your circuit will look
likebelow.
12
DEPPARTMENT OF ECE
9. Now we are going to set the values of all the parts. For example, first please double click on
the 0V value of DC voltage source V1, a popup window appears as below. Please make sure
you are double clicking on the value of 10V instead of the Vdc symbol or the name of V1,
otherwise you will get the popup window for editing the property of Vdc or the name of V1,
instead of the following popup window for changing the voltage value. If you cannot get the
following popup
13
DEPPARTMENT OF ECE
window, please just click to select the part, and then click menu EditAttributes, you would
be able to get the popup window. Input 10V in the row below DC, as shown above, and click
OK. You will see that the value of DC voltage source V1 has been changed to 10V now.
Similarly, you can also double click on the values of other parts (V2, R2), and change value of
V2 to 7V, change value of R2 to 2k. Now we also need to change the size (length L and
width W) of transistor M1. Double click on transistor M1, a popup window appears as below:
14
DEPPARTMENT OF ECE
Click on the row of L=, the name will be shown as L, and in the row below Value,
pleaseinput 1e-6. This indicates L=1m. Then click on Save Attr, you will see the value of
1e-6 is given to L= line. Similarly, click on the row of W=, and input 10e-6 in the value
line, then click Save Attr. This will set width of transistor as W=10 m. Now please click on
OK to close the window, as shown below. Please be sure you click on OK instead of
Cancel, otherwise your change is not saved. If you have more than oneMOSFETs, you need to
repeat the above process to define the size (W and L) for each MOS transistor individually.
15
DEPPARTMENT OF ECE
Now we need to specify the SPICE parameters for PMOS and NMOS device. SPICE will use
theseSPICE parameters for the simulation. Please click the NMOS transistor M1 so that its color
turnsto red. Then click menu EditModel, a popup window appear as follow.Please click
Edit Instance Model (ModelEditor) to open the model editor window, as below. Ifyou didnt
save your schematic before, you will be asked to save the schematic first. Otherwise,the
ModelEditor window will directly show up. As shown below, you will see PSPICEautomatically
create a new model for the transistor with name of MbreakN-X. This new modelname is
specifically created for your design. You can make any change on its SPICE parameters,however,
the original model of MbreakN of the system is not changed. This is for the protectionof the
system model library.
There is a warning window Failed to update the system registry, please just click OK to
closeit. Now please delete the line of:
.model MbreakN-X NMOS
and replace it with (copy and paste):
.MODEL MbreakN-X NMOS LEVEL = 3
+ TOX = 200E-10 NSUB = 1E17 GAMMA = 0.5
+ PHI = 0.7 VTO = 0.8 DELTA = 3.0
+ UO = 650 ETA = 3.0E-6 THETA = 0.1
+ KP = 120E-6 VMAX = 1E5 KAPPA = 0.3
+ RSH = 0 NFS = 1E12 TPG = 1
+ XJ = 500E-9 LD = 100E-9
+ CGDO = 200E-12 CGSO = 200E-12 CGBO = 1E-10
+ CJ = 400E-6 PB = 1 MJ = 0.5
10
+ CJSW = 300E-12 MJSW = 0.5
16
DEPPARTMENT OF ECE
The click menu of ModelEditor window: FileSave as to save it as a model library file in the
same directory as your schematic file. (Please be sure to save it, otherwise your change for
thetransistor model is not kept and it will be lost). You will see following popup window.
In theSave as row, please find the directory in C: drive you have created at the very beginning
(such asC:\john etc.). In the File name row, by default, the .lib filename will be the same name
as yourschematic file. For example, the schematic file is s1 here, and you will also see s1 in
the filename line for model library file. Please keep this filename and dont change it. (If you
change toother name, your circuit would not be able to use this .lib library file). Here we will
keep the Filename as s1 (the same filename as our schematic file), and click Save.
17
DEPPARTMENT OF ECE
You may see following popup window, just click Yes, as shown below.
18
DEPPARTMENT OF ECE
Note: Please ensure that you click on menu FileSave as instead of FileSave, otherwise
you will see following error. Please dont click FileSave, instead, please click on File
Saveas.Now Click on menu FileExit, you will close the ModelEditor window. Now we
have definedthe SPICE parameters for a MbreakN4-X NMOS model. You will see that the model
name oftransistor M1 has been automatically changed to the new model name MbreakN4-X.
Note: Assume if you have other MbreakN4 NMOS transistors in your circuit, and you also want
touse the same SPICE parameters of MbreakN4-X, all you need to do is to select (click)
19
DEPPARTMENT OF ECE
eachMbreakN4 NMOS transistor, then click menu EditModel, in the popup window as
below:
Please click on Change Model Reference, in the new popup window just input MbreakN-X
inthe Model Name line, and click OK, as shown below.
Then you will see that the model name of that transistor is also changed to MbreakN-X. In this
way, it will use the SPICE model MbreakN-X you just defined. If you have many
MbreakNNMOS transistors, you need to repeat the above procedures for each of them in order
for them to
use the defined MbreakN-X SPICE model. Since we only have one transistor here, we neednt
do this at this time.
20
DEPPARTMENT OF ECE
Please note: In this example we dont have any PMOS transistor. However, if you do have
PMOStransistor device, you can also use similar procedures for PMOS transistor and define
(copy andpaste) its SPICE parameters as:
21
DEPPARTMENT OF ECE
Now please also clickon Transient to setup the transient parameters, a new popup window
shows as below.
22
DEPPARTMENT OF ECE
Please change the Print Step to 0.1ms, the Final Time to 10ms. These are the
transientsimulation step time and final stop time. Now click OK and click Close to close
both popupwindows.
23
DEPPARTMENT OF ECE
Now we finished simulation and we can observe the simulation results. In OrCAD PSpice
A/Dwindow, please click menu TraceAdd Traces, you will see following popup window.
Thiswindow lists all the available voltage and current signals. For example, we want to watch
currentthrough resistor R1, please click on I(R1), and I(R1) will appear on Trace Expression
line.Please click OK, and you will see the waveform window for I(R1) as follow.PSpice can
also perform mathematical operation on multiple signals and plot the results. Assumenow want
to see voltage across drain and source VDS of transistor M1 in a new plot.
24
DEPPARTMENT OF ECE
Please notethat VDS=V(Md)-V(Ms), Md and Ms are the node labels we marked before. Click
menu PlotAdd Plot to Window, a new blank plot will appear in the window. The SEL>>
sign beside theblank plot indicates its the active plot, that is, newly added signal trace will be
displayed in thisplot. Now click menu TraceAdd trace, in the popup window, click V(Md)
in left column,and then click - sign in the right column (Analog Operations and Functions
column), then againclick V(MsS) in the left column, you will see expression V(Md)-V(Ms)
shows up in the TraceExpression line.
Then click OK. You will see the waveform of V(Md)-V(Ms) is plotted in the new window.
25
DEPPARTMENT OF ECE
You may also observe the values of voltage or current of each node directly in schematic
window.Please click on the windows task bar of Pspice Schematics to come back to our
schematicswindow, and click on the V and I icons, as circled in the following figure.
Then you will see PSPICE has marked the voltage and signals of all the nodes, as shown below.
You can directly read the values of voltages and currents of each node directly.
26
DEPPARTMENT OF ECE
Congratulations, you have finished the PSIPICE transient simulation for a simple
circuitsuccessfully. PSPICE is a very powerful tool for analog (and digital) VLSI simulation.
Pleasecontinue to practice its other powerful functions as well.
27
DEPPARTMENT OF ECE
28
DEPPARTMENT OF ECE
The three most important groups for this lab are the frequency, function, and output groups.
The remaining three groups, (sweep, amplitude modulation, and DC offset) will be
brieflycovered in the lab setup procedures. Should you desire more detailed descriptions of these
groups, the Leader Function Generator manual is available in the lab.
Output Group:
1. These controls are used to adjust the amplitude of the generator's output signal. The group
consists of the amplitude-control knob, the three attenuation buttonsand the fused 50 ohm
BNCconnector.
Although the amplitude knob is not indexed, the amplitude ranges from a few millivolts to
approximately 20 volts. We will set the amplitude levels by aligning the white line on the
amplitude knob to the three o'clock position (90 degrees right), the nine o'clock position (90
degrees left), or the twelve o'clock position (straight up). Notice that rotating the knob fully to
the left does not result in a zero amplitude signal.
The attenuation buttons are used to attenuate (decrease) the amplitude of the signal by a factor
measured in decibels. The following relationship will assist in working with the attenuation
buttons:
29
DEPPARTMENT OF ECE
(dB) = -10 * log10 (Pout / Pin) (if power is the unit of measurement)
or
(dB) = -20 * log10 (Vout / Vin) (if voltage is the unit of measurement)
Since the initial input voltage (Vin) was 1 volt the output voltage (Vout) must be 0.3162V or 316
millivolts.
Note: The attenuation buttons are additive. In other words, if the 10 dB and the 20 dB buttons are
both pressed in, the combined attenuation of the input signal is 30 dB.
2. The fused 50 ohm BNC connector is used for connecting the function generator to other
equipment. The most common connection used to connect the function generator to other
equipment is a cable with a BNC connector on one end and two alligator clips on the other end.
One end of the cable, the base, is used to connect the cable to the BNC connector on the
function generator. The other end, which has two alligator clips: one positive (red) and one
negative (black), is used to connect the function generator to the device or circuit under study.
To connect the cable to the function generator:
1. Hold the cable's BNC connector, the base, in one hand.
2. Line up the two grooves on the cable's BNC connector with the two pegs on the outside of the
function generator's BNC connector.
3. Push the cable's BNC connector over the function generator's BNC connector until it is fully
seated.
4. Rotate the cable's BNC connector in a clockwise manner until it is firmly secured to the
function generator's BNC connector.
30
DEPPARTMENT OF ECE
In this lab, you will become familiar with the three fundamental signals (waveforms),
thesinewave, the squarewave, and the triangle wave.
Waveforms:
This section will provide you with some background on waveforms and on measuring
waveforms. It is especially important that you understand how to measure waveforms. This is a
skill that is not only important to this lab, but also to the T-1 Lab and in labs for other
Telecommunications Courses.
There are two types of alternating-current signals, which are also called waveforms:
Periodic
Non-periodic
Periodicsignals, such as sine or triangle waves, behave in a uniform manner and repeat
themselves over a given length of time. Each repetition of a repeating signal is called a periodor
a cycle.
Non-periodicsignals, such as analog voice, behave in a non-uniform manner and do not repeat
themselves over any given length of time.
Note: In this lab, we will only work with periodic signals.
When working with AC signals, there are three properties of the signal that we are concerned
with: amplitude, periodand frequency.
The amplitudeof the wave is defined as the maximum magnitude of the wave. The amplitude is
the vertical component of the signal and is measured in units of volts (V). Since we are dealing
with an AC signal, the voltage will change over a period of time. The maximum voltage of a
signal during its cycle is commonly referred to as the peak voltage (Vp). The amplitude can be
measured from the reference line to the peak (Vp) or from peak-to-peak (Vpp). With a periodic
signal that is symmetrical (equi-distant above and below the reference point), the peak-to-peak
voltage is equal to twice the peak voltage:
Vpp = 2 * Vp
The period (T)of the signal is defined as the time it takes for a signal to complete one full cycle.
The period is the horizontal component of the signal, measured in units of seconds (s). The
period of the signal is measured as 250 milliseconds (250.0 x 10-3s). The frequency (f)of the
signal is defined as the rate at which a periodic signal repeats. It is usually measured in units of
31
DEPPARTMENT OF ECE
Hertz (Hz), where 1 Hz = 1 cycle per second. you can see four(4) cycles occurring within one
second; therefore, the signal has a frequency of 4 Hz. The frequency, f, of a wave is inversely
related to its period (T):
f=1/T
Analyzing the Function Generator:1. Connect an oscilloscope probe to the point labeled Function Out. Selectthe output from the
first op-amp (the square wave). You will now analyze the duty cycle of this square wave. Make
sure that R8, the amplitude knob, is adjusted such that there is no resistance between the DIPswitch output and the oscilloscope probe (i.e. such that the amplitude of the output is at a
maximum). The potentiometer R7 does not need to be turned to a specific resistance. The duty
cycle of a square wave is defined as:
Duty Cycle = 100% amount of time waveform is positive during one period
Duration of one period
For example, if a square wave has a period of 200ms and is positive for 50ms during each period,
then the duty cycle is 25%.Record what happens to the duty cycle as you adjust VCC, the
positive voltage supply to the op-amp.
2. Return VCC and VEE to their respective maximum absolute values. Select the
trianglewaveoutput to be displayed on the oscilloscope. This waveform may not look quite like a triangle
wave at its peaks, so adjust VCC and VEE until it looks as close to a triangle wave as you can get it.
Change the switch to display the square wave and then the sine wave to convince yourself that the
function generator is working properly. Record the values of VCC and VEE that are needed.
3. The potentiometer labeled R7 in Figure 8 controls the frequency of the square wave.Because
the triangle and sine waves will have the same frequency as the square wave, this potentiometer
is the frequency knob for the function generator. Fill in the following table for the maximum and
minimum values of the resistance of the potentiometer, R7, between pins 1 and 2.
32
DEPPARTMENT OF ECE
33
DEPPARTMENT OF ECE
Conclusion
A function generator is usually a piece of electronic test equipment or software used to generate
different type of electrical waveform over a wide range of frequencies. The waveform can be
repeated or single-shot. A function generator is that our observe frequencies corresponding to our
time , we thought that the limited amplitude on the function generator amplifier was responsible
for lacking of vision oscillator.
34
DEPPARTMENT OF ECE
Reference
1) Bakshi, U. A.; Bakshi, A. V.; Bakshi, K. A. (2008).Electronic Measurements and
Instrumentation. Pune, India: Technical Publications
2) Sonde, B. S. (1992). Introduction to System Design Using Integrated Circuits. New Age
International
3) FG 502 Function Generator, Instruction Manual, Beaverton, OR: Tektronix, 1973,
4) "Exar XR-2206 Monolithic Function Generator" (PDF) Exssar.
35
DEPPARTMENT OF ECE