Simulation Practices
Simulation Practices
Simulation Practices
Introduction
E lectronics and Microelectronics Engineering have been highly strengthen by the micro and
nanotechnology advances which have provided a wide range of applications and solutions in
benefit of mankind. Particularly, the miniaturization and integration of complete systems into
integrated circuits have provided a wide spectrum of different problem solutions to develop
procedures and devices in telecommunications, transportation systems, bioengineering,
biotechnology, instrumentation, automation, mechatronics, information systems, computer
systems, autotronics, avionics and process control systems.
The vast variety of new electronic devices available on a day to day basis, which are
manufactured in very highly integrated fashion, has produced systems that fulfill demanding
necessities by our industrialized society. Moreover, the electronic instrumentation has evolved in
such a way that many innovations and new circuit design strategies are used to synthesize more
intelligent and simpler solutions to complex problems. On the way to achieve very reliable
electronics and microelectronics devices, an intermediate procedure is necessary to validate the
conceptual and analytical electronic design conceived by electronic engineers. This procedure is
the computer simulation, which is responsible for reducing the developing time for engineers and
scientists.
In Electrical Engineering, the SPICE (Simulation Program with Integrated Circuits Emphasis)
program has provided the fundamental tool to perform any kind of serious computer simulation
involving electronic circuits. The evolution of this important tool has produced a number of very
sophisticated and reliable versions of the program, such as PSPICE, HSPICE, LTSPICE, etc. The
results obtained from a SPICE computer simulation are then validated against the analytical and
conceptual performance devised by the design engineer.
If the performance results are reasonable and validate the idea, then the next step would be
the fabrication process, which includes considerations such as process technology
(Complementary metal–oxide–semiconductor, CMOS; BiCMOS; Bipolar Junction Transistor, BJT,
etc).
This book provides a guide for simulation sessions. It begins with the very elementary topics
covered in electric circuits or electric networks courses. It continues with more intermediate topics
covered in applied electronics and instrumentation. With this foundation, the book closes with
advanced topics addressed in microelectronics (both analog and digital). Blue prints for the
Integrated Circuit, IC, chip could be obtained by students and practicing engineers.
The main objective of this book is to establish a solid instructional platform about
simulation procedures and techniques, which are standardized around the SPICE program.
The book is a companion tool for learning electronics and microelectronics design through
college. It starts with circuitsnetworks and ends with the microelectronics part that includes
the layout and design file generation. The book also includes support sections that allow
the reader to study or review: the annotated concepts, formulas and models, the annotated
specialized bibliography, the basic SPICE simulation procedures, the fundamental
integrated circuit (IC) layout software tool, Electric VLSI, CMOS process model files and the
fundamental printed circuit board (PCB) layout techniques.
The book supports simulation practices pertaining to the following courses:
We have followed a sequence of subjects that may go from the early stages of the electronics
engineer student education to the more advanced topics of microelectronics design. However, the
implementation of a non-linear navigation throughout the book allows for its study at any
intermediate or advanced topic. This scheme is particularly useful to senior undergraduate
students, graduate students or practicing engineers who wish to revisit design and simulation
concepts. In addition, some of the advanced topics in microelectronics simulation and design are
directed to graduate students who would use the simulation practices to prepare the blue prints
(GSB files) for prototypes of integrated circuits.
The final manuscript is the result of a consolidated experience teaching the following courses:
electric networks, electronics, analog electronics, analog integrated circuits, junior engineering
design, senior engineering design, microelectronics, CMOS analog microelectronics, design of
digital integrated circuits, digital integrated circuits, engineering projects, and other capstone
design courses both, at Trinity University in the United States and at ITESM in Mexico. The
structure of the navigation scheme is flexible enough to allow the selection of topics according to
the needs of the students in the course or those of practicing engineers. Table I illustrates the
general computer simulation experiments covered in the book.
Table I. General topics, subjects and applications. Full size image here.
Finally, the simulation practices for electronics and microelectronics engineering will support
courses in the EE curricula that contain the following major contents:
The software tools needed for the simulation practices are contained in LTspice, which is a full
blown SPICE version from Linear Technologies and Electric VLSI CAD system available thanks to
the research group headed by Dr. S. Rubin.
Chapter 1. Electric Networks
Introduction
T he fundamental laws of circuits are developed through a set of formal simulation experiments
and its tools. Students and practicing engineers will have the capability of understanding the
basic tricks to perform a computer simulation of an electrical network. In this section we review the
Ohm´s law, the networks theorems, the power transfer principles and other circuit analysis tools,
along with a consistent set of corresponding experiments. We expect that these practices will give
enough experience to initiate the study of electronic circuits using SPICE and other design tools.
Related Links
Home of the Electric VLSI software platform for simulation and layout of Integrated Circuits
» Staticfreesoft
Linear Technologies web page to access and download the LTSpice software.
» Linear Technologies web page
Support Section
» LTSpice Guide
Figure 1.1 Schematic capture and Spice deck of a simple voltage divider circuit with a bias
point analysis setup. Full size image here.
1. We will begin this simulation practice capturing the schematic circuit from Figure 1.1 and
running a bias point analysis (using the .op directive). This will generate a “.net” file for your
circuit, which is the Spice deck version (you can see the “.net” version of your circuit directly on
LTspice or in any other text editor).
2. As you can see, the name of the schematic file appears in the first line of the Spice deck
(The “.asc” extension corresponds to a schematic file on LTspice) and this is always a comment
line. The second through the fourth lines correspond to the circuit components. The second line
describes a sinusoidal voltage source placed between nodes 1 and 0; the third line is a resistor
placed between nodes 2 and 1; and the fourth line is one more resistor placed between nodes 2
and 0 (ground). It is important for you to notice that in the schematic version, there is one more
element, the ground element which always has to be placed when you are on schematic capture,
because this is what LTspice interprets as the reference node. On the other hand, on the Spice
deck version, you always have to name the reference node as zero “0”.
3. A bias point analysis has been set, so when you run your simulation a text window will pop
up showing the DC node voltages and loop currents present in the circuit. As you know, both
resistors are 100 Ohms (Ω) and you have a series circuit; for this reason the voltage value of the
source is divided equally on these elements. You can calculate the drop voltage at R1 by
subtracting V(1) - V(2).
Even if you are working with AC signals, you can perform a bias point simulation to analyze the
DC characteristics of your circuit.
1.1.2 Input and Output Resistances
4. Set a DC transfer function analysis using the DC source V1 as the input source and the
voltage drop at node 2 as the output node. Notice that the voltage at node 2 is the one across
R2. Figure 1.2 shows the settings for both, schematic and Spice deck versions.
Figure 1.2 Schematic capture and Spice deck of a voltage divider circuit with a transfer
function analysis setup. Full size image here.
With Spice is also possible to mesure the input and output resistances of a circuit. This is
done by running a transfer function analysis (.TF directive) through which you will obtain
the transfer function of the circuit and the input and outpuy resistances (or impedances for
a reactive circuit).
1.1.3 Transient Analysis
We now use a sinusoidal voltage source in our voltage divider circuit. As you can see, we have
set a 500 mV offset, 1 V amplitude and 100 Hz frequency voltage source. Also, a transient
analysis of 50 ms with steps of 100 µs will run this time.
Figure 1.3 Schematic capture and Spice deck of a voltage divider circuit with a transient
analysis setup. Full size image here.
6. Make these changes on either your Spice deck or the schematic diagram. Run the analysis.
7. If you plot the V(2) voltage you should get a sinusoidal waveform similar to the one below.
Figure 1.4 Voltage at V(2) of the circuit.
This waveform corresponds to the voltage across node 2 and ground, which is the voltage
drop at R2. In the same way than in our bias point analysis, because both R1 and R2 are 100
Ohms, the voltage drop through both resistors is the same in amplitude, phase and frequency
(resistors are linear elements); additionally, the sum of both voltages corresponds to the voltage
supplied by V1.
8. Inspecting the V(2) trace, the amplitude of the voltage signal is 500 mV, 250 mV offset and
10 ms of period time (or 100 Hz of frequency); however, sometimes it is necessary to know the
exact value of such and any other parameters (for instance, when working with non-ideal
components). Although it is easy to approximate a value using grids and cursors in the plot
screen, a more accurate way is to take advantage of the Spice deck capabilities.
9. First, let’s bring back the Spice deck generated by LTspice of the previous circuit.
10. As you probably noticed, the Spice deck above does not specify a trace to be plotted after
the simulation has finished. We want to plot V(2), so we should add a Spice directive to do this
automatically. This directive is:
Consult the LTspice guide for more information about this command. You can run your
simulation at this time before we continue.
11. If you are working with AC waveforms it is more convenient to measure the root mean
square value (RMS) than its peak or peak to peak value (for instance, when feeding a circuit with
a transformer plugged into an AC outlet). We can easily measure the RMS using the Spice deck.
At first, you have to measure the maximum value (peak value) of the sinusoidal waveform, and
then divide such value by sqrt(2):
.MEASURE TRAN val_max MAX V(2)
Then,
.MEASURE TRAN val_rms PARAM val_max/sqrt(2)
12. Your Spice deck must be similar to this:
13. Once you have captured these directives on the Spice deck, run your simulation.
14. As you could expect, the V(2) trace will automatically be plotted. To see the RMS value of
the V(2) node, open the file with extension “.log” located in the same folder where your schematic
and Spice deck files are, by going to View -> Spice error log. Notice that the fact that this file
exists does not mean that your circuit has errors.
Along with the additional information about your circuit, two lines similar to the ones shown
below must be present in that file:
val_max: MAX(v(2))=0.499411 FROM 0 TO 0.05
val_rms: val_max/sqrt(2)=0.353137
The first line shows the maximum value of the sinusoidal waveform, and the second line shows
the calculated RMS value.
As you can assume, besides an RMS calculation, you can evaluate any other mathematical
expression using the Spice deck. For further information about this, refer to the LTspice user
guide.
Activity 1.1
» Basics on Spice Simulation for Electric Networks
2. For each resistor in the circuit, calculate the resistance value using the node voltages and
loop currents given by the simulator. Fill out a table comparing the resistance value assigned for
you in the schematic capture, and the calculated value using the bias point analysis of the circuit.
1.2.2 The Kirchoff’s Voltage Law
As you could have deduced, the Kirchhoff’s voltage and current laws can also be
demonstrated through the bias point analysis again, since the results of such analysis are the
node voltages and loop currents.
1. Kirchhoff’s voltage law (KVL) states that the sum of the voltages around a closed path is
equal to zero.
The circuit below has 4 meshes and 4 nodes (plus the reference node). For a better
understanding on how LTspice interprets the signs on the elements, you can take a look at the
auto-generated Spice deck version of the circuit shown below.
Figure 1.6 Voltage signs and current directions of the resistors. Full size image here.
2. On resistors, the first node is the positive node and the second node is the negative node.
In the schematic capture the signs and the direction of the current in each resistor were placed
manually.
3. We can demonstrate the KVL by adding the voltage drops on any loop, for example the loop
formed by R1, R2, R3, R5 and R7. Going from R1 through R7, we have:
4. Using LTspice we can perform this addition with the following line of the Spice deck:
Notice that we get the voltage drop on each resistor by assigning a reference node
different from zero. In this case, V(b,a) refers to the voltage between the nodes b and a,
taking b as the positive node and a as the negative node.
5. Run your simulation and open the .log file to see the .measure directive results. As
expected, you should get zero:
6. Now, the Kirchhoff’s current law (KCL) states that the sum of the currents entering a node is
equal to zero. You can demonstrate this by modifying your Spice deck and adding the currents
entering any of the nodes of the circuit. For example, for node C we could use:
7. After running the analysis, you should get something similar to the following:
Figure 1.7 Circuit to be represented by its Thevenin equivalent. Full size image here.
1. To find the Thevenin’s voltage Vth, first “remove” the load resistor RL. In LTspice you can
actually remove such resistor and let an open circuit, or represent it using a very high resistance
value, like 1 TeraOhm (1x1012), which can be assumed as an infinite value.
2. Run the bias point analysis and take a look at the results. Notice that node voltages at
nodes a and out are the same due to the open circuit. This value is the Thevenin’s voltage, Vth .
3. Now, run a transfer function analysis to determine the output resistance, which will be the
Thevenin’s resistance Rth . Use the following analysis setup:
4. Once you have your Thevenin equivalent, capture it and run a bias point analysis with the
load resistor (1 kOhm). Show if the voltage and current in the load resistor are the same for both,
the complete circuit and its Thevenin equivalent.
1.2.4 Maximum Power Transfer Theorem
To demonstrate the maximum power transfer theorem follow the procedure below:
Full size image here.
1. Capture the circuit of a voltage divider like the one shown in Figure 1.8:
Figure 1.8 Voltage divider with a variable resistor {R}. Full size image here.
2. Using LTspice IV capture the circuit above. Notice that you have to set the RL value as “{R}”
to be able to sweep this parameter. Set the following Spice directive:
3. With this directive you indicate Spice that you will sweep the value of RL from 1 Ohm to 10
kilo-Ohm in steps of 100 Ohms. Also, set a bias point analysis and run your simulation.
4. You should get a curve similar to the one in Figure 1.9 This curve describes the output
voltage V(out) versus the resistance sweep of RL.
5. Right-click on the V(out) label and capture the following equation to display the output
power instead of the output voltage:
The equation above describes the DC power dissipated by the resistor RL for all the
swept values of RL.
6. You must obtain a new curve similar to Figure 1.10:
Figure 1.10 Power dissipation of RL vs resistance sweep.
7. Notice that this time the dependent axis’ unit is Watts. Place the cursor on the maximum of
the curve to find the resistance value that gives the maximum power dissipated by the resistor.
What is this value? Does the maximum power transfer theorem is satisfied with your results?
1.2.5 The Superposition Theorem
To demonstrate the superposition theorem, it is necessary to prove first the principle of
linearity which stands that: for a linear circuit element, the relationship between the voltage
across it and the current through it is always constant. For instance, as we have seen
before, the relationship between voltage and current in a resistor is always V=R×I.
1. Capture the following circuit, which is useful to demonstrate the principle of linearity.
Figure 1.11 Spice setup to prove the linearity principle. Full size image here.
2. As you can see above, a DC sweep analysis for V1 has been set. As its name says, the
value of V1 will be swept from 1 V to 10 V by 1 V increments. In the resulting plot, set by the
.PRINT statement, the linear behavior of R1 must be visualized.
As you can see below, the slope m of the V-I curve is the conductance value of the resistor,
which is the inverse of the resistance. In both cases, a linear behavior is expressed.
3. You are able to plot the resistance value of R1 through all the swept values of V1. You do
this by right-clicking on the I(R1) label and writing the following expression:
V(1,2) is the voltage across nodes 1 and 2, and across the resistor. I(R1) is the current
through this same element, so the ratio V(1,2)/I(R1) is the resistance of such element; this
resistance is constant for all the values of the voltage source. With this, now you are able to
demonstrate the superposition theorem.
Activity 1.2
» Ohm´s and Networks Laws
Figure 1.13 RC network to find its time constant. Full size image here.
2. Capture the circuit in Figure 1.13 using LTspice, and set the voltage source as follows:
3. Set a transient analysis with a stop time of 1 ms and increments of 10 μs. Run your
simulation.
4. The input and output waveforms must be similar to Figure 1.14:
Figure 1.14 Time response of the circuit with a step voltage input.
5. Using the results you just obtained, determine the time constant of the circuit ( τRC).
τ
Remember that s is the time that takes to charge the capacitor at 63.2% of the output stable
state voltage, or the time that takes to discharge the capacitor at 36.8% of the output stable state
voltage.
6. For the stable state sinusoidal response analysis, change the input voltage source to a
sinusoidal waveform of 10 V amplitude and 1 KHz frequency. Also set the transient analysis to plot
only one cycle of the input waveform.
7. Run your simulation and plot both the input and output nodes. You should get two curves
slightly lagged, similar to the ones in Figure 1.15. This is the effect introduced by the
capacitance.
Figure 1.15 Transient analysis results of the RC network.
Through simulation, you are able to measure the magnitude and phase angle between
the two plotted curves. One way to do this is by using the cursors available in the pane
window of LTspice. Although it is a fast measurement method, it is not the most accurate.
The other method is to add some Spice directives to your circuit or Spice deck to perform
the measurement by itself, so each time you run the analysis the phase angle is given
automatically.
8. Add the following Spice directives to your diagram or Spice deck:
As you have done before, first measure the maximum value for both signals, then the time in
which those values occur. Variable m is the magnitude of V(out); variable tphase is the time between
both maximum values; and dphase is the conversion of tphase in to degrees using the following
equation:
Here, T is the period of the signal that is the same for the input and the output waveforms.
9. Run your simulation and open the Log file to see the resulting measurements. You can
verify your results by performing a one-step analysis on the frequency of interest. With this, the
V(out) phasor will be displayed; it contains its gain and phase angle.
10. Figure 1.16 shows an RL network:
Figure 1.16 RL network to find its time constant. Full size image here.
11. Capture the schematic circuit and set the voltage source as follows:
12. Set the transient analysis for a stop time of 1 ms and run the simulation. Plot the current
through the inductor and you should get a curve similar to Figure 1.17.
13. Using this plot, determine the time constant τRL of the RL network.
Activity 1.3
» RL and RC Networks
2. At node 2, this circuit behaves as a second-order function when fed with a step voltage
source. To analyze such behavior using LTspice, it is necessary to perform a transient simulation
and observe the response in the time domain. Capture the circuit in your preferred way on
LTspice, and run the transient analysis as described on the Spice deck:
3. Plot the voltage across node 2 of the circuit (automatically done with the text version of the
circuit). Your resulting voltage plot must be similar to the curve below.
Figure 1.19 Time response of the RLC network.
5. Capture the circuit of Figure 1.20 on LTspice, and set the transient analysis as follows:
6. As you did before, the voltage source will describe a step function. To set the step function,
configure your voltage source as shown in the Spice deck of Figure 1.20.
7. Run your simulation and plot the step input voltage waveform and the voltage across the
resistor R1. What type of damped response does this circuit present?
1.4.3 Sinusoidal Steady-state Analysis
5. Figure 1.21 shows an electric network using resistors, capacitors and inductors. To find the
equivalent input impedance of this circuit, it is necessary to use a test source and perform an AC
analysis. You can use both, current and voltage sources as test sources but for simplicity of this
case, you will use a current source with 1A magnitude, 0º (degrees) phase.
Figure 1.21 RLC network for a steady-state analysis. Full size image here.
6. Capture the circuit depicted in Figure 1.21, and set the analysis to be an AC analysis using
a linear sweep with only one step. You will determine the frequency assuming an angular
frequency of ω=5 rad/seg:
8. The 0.79577 is the frequency in Hz of the AC current source. Run your simulation and
notice that the results will be displayed as a list of node voltages and loop currents in polar
coordinates, due to your analysis using only one frequency step. A plot of values for each voltage
node or loop current would be displayed ff two or more steps were set.
9. The vector V(in) is the magnitude and phase of the complex voltage, and the equivalent
input impedance is:
10. Now that we know the value of I(in) and V(in), we can calculate the complex input
impedance.
Activity 1.4
» RLC Networks
2. Capture this circuit on LTspice and set an AC value of 1V to the voltage source.
Remember that for an AC analysis, you always have to set an AC value for the source.
3. Set the AC analysis for a range of frequencies from 5 Hz to 100 KHz as shown in the Spice
deck. Also set the .measure directives to automatically calculate the -3dB (cut-off) frequency of
the filter.
4. The magnitude and phase of the filter must be similar to the one in Figure 1.23:
The gain scale in decibels is on the left side of the pane; the phase scale is on the right side.
4. Since we have a low-pass filter, the frequency response of the filter is as we expected. From
the .measure directives used to measure the cut-off frequency of the filter we have:
5. The value of v_peak shows the maximum voltage value on the V(out) curve, which is
approximately at 0dB. The v_3db shows the frequency at V(out)/sqrt(2), which is the -3dB value.
6. By changing the capacitor by an inductor you switch the filter to have a high-pass response.
Change the capacitor for a 20 mH inductor and the analysis setup for a range of frequencies from
100 Hz to 500 KHz.
7. Plot V(out) and calculate the cut-off frequency using the .measure statements.
Figure 1.24 Low-pass filter frequency response 4 Low-pass filter frequency response. Full
size image here.
Activity 1.5
» Electric Filters
Support Section
You can consult the additional textbooks listed in the Support Section of this eBook, in order to
amplify your knowledge and skills about Electrical Networks.
Review Activities
Practice your knowledge with the following Caption Projects:
EC-01. Defibrillator Circuit
EC-02. Wideband Band-pass Audio Filter
EC-03. Low Pass and High Pass Noise Filters
EC-04. Transmission Line Lumped Parameter Model
Chapter 1. Conclusion
T he theory of electric circuits is the fundamental tool to understand the operation of electronic
devices. Microelectronic simulation practices provide the basic techniques to incorporate
simulation experiments in our day to day engineering practice. The experiments developed were:
Basics on Spice Simulation for Electronic Networks, Electric Networks Rules, Laws and Theorems,
AL and AC Networks, ALC Networks, and Electric Filters. moreover, a set of basic capstone
projects provided an insight to the possible applications of the fundamental circuit knowledge.
Chapter 1. Activities
Review Activities
• Activity 1.1 Basics on Spice Simulation for Electric Networks
• Activity 1.2 Ohm’s and Networks Laws
• Activity 1.3 RL and RC Networks
• Activity 1.4 RLC Networks
• Activity 1.5 Electric Filters
Capstone Projects
• EC-01. Defibrillator Circuit
• EC-02. Wideband Band-pass Audio Filter
• EC-03. Low Pass and High Pass Noise Filters
• EC-04. Transmission Line Lumped Parameter Model
Chapter 1. Resources
Related links
Linear Technologies web page to access and download the LTSpice software. The complete
simulation software will be available for use only in your PC. Note, the simulator has the UC-
Berkeley’s complete version and it can run the complete BSIM4 models of the MOSFET
transistors.
• Linear Technologies web page
Home of the Electric VLSI software platform for simulation and layout of Integrated Circuits
• Staticfreesoft
Support Section
• LTSpice User Guide
• Support Section A – Chapter 1
• Annotated Bibliography