========ANALOG
ART===================
1) Productivity
Tools and Templates
In Electronics there always seems to be opportunity to spend time to
save time.
Some times it is far easier to just create yourself
a tool in order to save a lot of work.
A) Recording Reverse Polish calculator
B) R_C_F calculator
C) R_C_L_F
calculator
D) Formula
_calculator
E) 3D_FFT_calculator
F) Other Javascript Calculators
Getting
something to work often requires far more attention to detail
than the help files provide.
Working examples need to have all the required details in
place just to work.
The following "work in progress" organized working examples intended
for cut and paste use.
A) macspice/winspice Template web page
B) SIMetrix
Template web page
C)
javascript
Template web page
D) Perl
Template web page
E) Ccode
Template web page
F) Xcode
Template web page
G) Web Page
Template web page
H)
Icarus Verilog Template web page
I) LabView
Template web page
J) ICEDIT
Template web page
K) Quartz
Template web page
L) MacUnix
Template web page
M) FINK
Template web page
N) XCircuit
Template
web page
N) Excel
Template
web page
O) AquaTerm
Template
web page
P) Dynagraph
Template
web page
Q) GnuPlot
Template
web page
R) GerberView
Template web page
S) Mathomatic
Template web page
T) Open
Old Mac Files Template web page
U) SciLab
Template web page
V) Arduino
Template web page
W) SVG
Template web page
X) MS_WORD
Template web page
Z) OCTAVE
Template web page
The
following is the second generation of template how to files.
This version is getting bigger in size and includes
resources.
Please note that it s starting to get impossible to avoid
all forms of trouble.
Including code and resources can help in most cases.
A healthy ability to debug missing details looks like it
is becoming a requirement.
A) GIMP_SCRIPT
Templates, and Resources
B) QUARTZ_JAVASCRIPT_KERNEL Templates,
and Code,
and Resources
C) PHOTOSHOP_JAVASCRIPT
Templates,
and Code
D) HTML_5
Templates
E) NGSPICE
Templates
F) ILLUSTRATOR_JAVASCRIPT
Templates
G) GIMP_PYTHON_COPY & PASTE
Templates,
and pdf and Resources
H) PROCESSING_COPY & PASTE
Templates,
and pdf and Resources
2)
Free Spice
Several free or semi-free versions of spice are
available off the web.
SIMetrix is a cadence/pspice
like limited free version
for
windows.
Macspice is a spice-standard
free version
for
OS X which allows scripting.
Winspice is the spice-standard free
version
for windows which almost works
using the same code.
This simple little PLL transient simulation runs off the exact
same code.
A simpler PLL transient simulation can be done using
eight lines of Spice Code..
3) Spice Models QA
The design engineer using a model is the really the one responsible for
the model being accurate.
Sometimes the TC of a diode needs to be sanity checked
in order to design a bandgap reference.
Matching a model to a curve tracer
is typically the first thing to do.
The extended bipolar dynamic range of
today's BiCMOS makes a Gummel Poon
Plot more critical.
The old standard bipolar transistors
behaved more like this.
Subthresshold behavior of MOS transistors
should be sanity checked as well.
4) Spice Scripting
Designing something like an Op Amp requires testing a circuit
over all the "corners".
Many permutations need to be tested because a
design will typically fail at a subtle "corner condition".
The permutations typically involves
3 temperatures, 2 supply voltages, multi-applications, and several
"process corners".
A scripting ability in Spice allow the changing of
its internal simulation conditions on the fly.
This enable a single
multi dimensional simulation to effectively test
everything.
The results can be stored in a text file which can
be further processing by a perl program.
Simulators such as Macspice/Winspice and cadence
(Ocean)
and SIMetrix(not_free) allows
scripting.
The scripting resource can be used to do
customized testing of things like THD,
capacitance, and F_tau.
5) BSIM4 simplified
The latest BSIM4 manual off the web
describes about 300 model parameters.
If one downloads the following 180nm to 22nm
BSIM files off the web.
That adds up
3300
BSIM model parameters which may or not may be critical .
It would be convenient if all the data could be
reorganized as a table.
Acrobat Pro allows the
conversion of a pdf file to the following
text file which has been slightly cleaned up.
A
simple perl program can dump all
the model files into
a single
text file.
Another perl program can use
the previous two text files to create a
table of all parameters versus process.
The
table can further be color coded
to view the trends.
6) PERL and text files
Production test data for an Analog IC is usually available as a text
file.
The previous BSIM4
simplified example shows how perl can read and reorder text
data
such as a data log.
This feature can also come in handy for the previous Spice Automatic Testing example.
The previous perl program that combines
directories into a single text file gets a lot of use.
Another handy program can reorganize
the data within a single text file.
7) The Most Beautiful
Equation in the World.
Euler identity
has been described by some as "the Most Beautiful Equation in the
World".
A FFT is really just mapping analog signal to Euler identity.
This can be better seen when the results of
a FFT is plotted in 3D.
A javascript calculator as been
developed which can also do the 3D plotting.
8) Transient Noise Simulations
Spice programs like SIMetrix
allow noise to be simulated in transient analysis
.
For spice programs like Macspice/Winspice, a RandomPWL javascript can created
the data.
SPICE can read the PWL file and simulate and plot both
transient and spectrum results.
Using a Noise Transient Analysis, it is possible
to see how two noise sources add together.
Macspice allows for the creation and simulation of Arbitary
Waveform Random Data.
Some vector spice processing can show how noise adds with power.
It is even possible to create and transient simulate 1/f noise.
It is also possible to histogram flat noise and guassian noise.
9) THD Simulation using Sprectrum Analysis
Simulating THD in
transient analysis shows the
actual distorted waveforms.
Selected elements of the spectrum output
can be mathematically processed to get THD .
The classical
distortion over
temperature of a differential input is a good place to start.
Adjustments of area ratios for distortion cancellation
for an alternative input can also be viewed.
The distortion profile of differential input stages all track
absolute temperature.
Sometimes a detail look at the distortion harmonics
is desirable.
Plotting lines can be useful when looking for things like third order intercept is desirable.
Viewing distortion that happens at either the input stage or output stage is sometimes needed
10) Extremely Easy Ways to Generate Spice
Waveforms
By making a voltage ramp that tracks time, waveforms can be generated
using equations.
Some examples are Triangle waves, Square waves, and Ramp
waveforms .
This can be extended to making PWM waves that can also be made to be in sync .
Equations for Amplitude
Modulation and Phase modulation also work.
But this makes it real easy to Sweep
Parameters of the Input Signal over time.
11) Play with Transmission Line Reflections
The EDN
trade
magazine has written some good articles about Time-domain reflectometry.
Modeling transmission lines as LC subcircuits
may give some vision as
to what is happening .
The various impedance mismatches
can be all simulated.
The results are all the same but all
internal node voltages and currents are visible.
The cable speed appears to simply
track the time constants of resonance elements.
Identifying and tweeking out cable discontinuities
can also be played with.
The modeling of transmission lines are usually more complex.
12) Watch Noise Cancellation Work Inside
an
Op Amp.
In negative feedback, an amplifier will try to cancel out all internal
noise sources.
A Noise Transient Analysis applied to an
Amplifier
can show everything working .
Modeling an accurate Audio frequency Noise waveform
can be very useful .
Transistor
subcircuits can then be modeled to have their noise properly
track bias current.
Observing how current noise can be modeled
as input noise voltage is a good sanity check.
Noise
operating in an Operational Transconductance Amplifier
can also be observed.
13) Simulate a Pinch Resistor.
A subcircuit can be made to follow the equations of a pinch resistor.
14) The Balanced Low Voltage BandGap.
Need an accurate low voltage bandgap that works down to 900mV over temperature?
The age old design technique of balancing out errors
still works .
But balancing is only as good as it is possible
to know all the errors.
15) State Variable Filters Map Equations
to Circuit Components.
Relating the equations to the simple term of Q is a good
starting point.
The Q terms in the equation maps
to feedback in State Variable Filters.
The frequency terms map independently to the
integrator terms.
The equation works on
resistor ratios and not absolute values.
Operational
Transconductance Amplifier can replace the integrators
This allows voltage to
control the frequency of a State Variable
Filter.
It also allows complete IC integration of
analog audio frequency filters.
The mapping comes in handy making Butterworth and Bessel filters
16) FFT Your Company's Stock Using Spice
Reading a file as a PWL voltage source allow the import of REAL
Input Signal.
It only requires a spreadsheet
and a text editor to input any data.
Software is being written to convert computers into oscilloscopes.
A PC's line-in port can be used to digitize Audio frequency waveforms.
And USB hardware is being developed
to digitize higher frequencies.
17) Make Some Pretty Waveforms.
Generating Lissajous waveforms involves
using the X/Y features of spice.
Another X/Y oscilliscope
application is for BH curves.
Lorenz Chaos and Chua Chaos can also produces
some pretty curves.
18) Measure Stray Capacitance Within Spice.
The scripting features in Spice can be used to measure and print out capacitance.
This feature extends to measuring all
the strays capacitance's within a MOS
device.
The feature further extends into making
a CV plot of gate capacitance.
19) Investigate f_tau Parameters using
Spice scripting.
Page 72 of the
Gummel-Poon Toolkit describes
the f-tau situation.
Observes the effects of changing TF or CJE or IKF or ITF or VTF or XTF.
In MacSpice, the
unknown array can be used
to
plot ftau versus say TF.
20) Voltage Controlled Filters
State Variable
filters can vary their frequency if made using gm_C stages.
The Low Phase distortion of a Bessel filter will hold over all
VCF frequencies.
The flat pass band response for a Butterworth will hold as well.
The Phase distortion of a Butterworth
does change with VCF frequency.
21) Group Delay on Phase Distortion.
The
Bessel filter shows why good
group delay means low phase distortion.
The
Butterworth filter shows the
source of phase distortion.
MacSpice provides better ways to observe
group delay in Bessel and
Butterworth filters.
22) New Thermal Concerns.
Silicon Oxide has
one tenth the thermal conductivity of silicon.
Oxide Isolation thermally isolates transistors.
This simulation investigates real lab measured
thermal
self heating.
23) Simple Logic Functions in Spice.
Sometimes simple
logic
functions can be defined with a single spice line.
Only ten lines of spice code are need
generate a clockless ADC and DAC.
Adding a sample and hold turns a clockless ADC into a normal ADC.
Edge detection circuits require
some timing elements.
Convergence may require Flip Flops to have break before make timing.
24) Interesting Effects of Distortion in
Filters
Distortion with feedback allows filter operation under multiple states
Chaos type plots can show these
effects in active filters.
Chaos such as
Chua or
Lorenz could be thought of as
multi dimensional instability.
Distortion also
can generate a
"hang on" and
"snap back" effect
25) Generating FM In Spice May Be Easy By Using PM
Frequency
Modulation in Spice is really Phase Modulation
And Phase Modulation is really
Double Frequency
Modulation.
An alternative way of generating a
FM
signal is through PM
This allows
FM
or PM to be done in a Piece Wise Linear Fashion.
Or view
an
FM
Spectrum
as a Polar to Rectangular Conversion.
The
FM Spectrum can be fully
visualized in this way.
26) Automotive Power Amplifier Design
How a Full Automotive Amplifier was
built using only 5 leads
The
AB_Bias versus
CrossOver
Distortion tradeoffs.
Bottom
side output stage saturation and top
side
hang on.
Bottom
side Fuzzies.
Why the
short lead rule.
Top side composite stablity
and the
Invention that addresses it.
Chrysler thermal shut
down problem.
Output transistor
IR drop
and transistor layout.
27) An AB_Biased
Operational Transconductive Input Stage
It is
possible to lower noise and offset while also lowering distortion.
A
differential Bipolar Input stage's distortion
tracks
absolute temperature.
A
dual differential Bipolar
Input stage can reduce distortion.
The distortion of a dual differential
Bipolar Input stage
also tracks absolute
temperature.
A new
AB_Biased Input has
adjustable cross over distortion.
And it has an
adjustable
current gain over its DC current.
And the distortion
also tracks absolute
temperature.
To
compare to a LM3080
architecture, offset, distortion and noise needs to be simulated.
The comparision is made by putting the
AB_Biased input
stage in a LM3080 application.
28) Plotting a Root Locus Using Spice
Spices's Pole/Zero analysis can be sanity checked against
a
plotted a Root Locus.
29) Bipolar and CMOS Noise Parameters
An attempt to match the
Noise Voltage and
Noise Current of a LM394 .
The Noise voltage for a
BiCMOS NPN is as expected.
But
1/f Noise for a CMOS transistor
may be getting interesting.
30) Bipolar RRIO Operational Amplifier
Design
The
LM324 leads to the RRIO Op Amps.
Bipolar
input requirements and Supply Voltage.
Preferred
input steering and
using vertical pnps.
The need for
input clamp diodes.
A
clamp
to slew rate invention.
An
AB
Bias Dual Input Turnaround.
Shortening
the signal path.
Balancing
out beta loading.
GraceFull
death at the output stage.
Shortening the signal path at the output.
Saturation
current limit.
31) A Perfect RRIO Operational
Amplifier
Design
Chopper Amplifiers frequency
shifts both offset and 1/f noise.
This however can lead to an
input
aliasing problem.
The aliasing problem is
commonly
fixed using spread spectrum.
An
FM
limiter gain stage shows how to take a lot of gain.
This same gain can be
done
using an on chip capacitor.
The DC offset is cancelled out using
a subHertz integerator.
The chopper signal gain stage
tends
to remove offset and 1/f noise anyway.
A similar gain stage can be
used to quietly spreadspectrum an
oscillator.
If the chopper signal is integrated,
it becomes a low frequency precision Op Amp.
This precision Op Amp can extend the
gain
of another Op Amp.
Together the two Op Amps can compose
a
composite Op Amp.
An the
composite
Op can bury both offset and noise.
It may also be possible
to
reduce noise input current as well.
32) Different Spectrum Formats
Using the
Euler Format may be the most
precise.
But
SPICE may need to
use a
different format.
The
format
MacSpice uses is as such.
Spectrums can and may need to be formatted as
pure
AM or PM.
33) Simple Math Processing in SPICE
Things like
a RMS value can be
calculated from any waveform.
Specific points in a spectrum
can be printed out.
A spectrum printout may be required to
see
AM from PM sidebands.
34) Jitter Analysis in SPICE
Jitter analysis can show
edge timing over time.
But Jitter involves a process of
accumulating random timing error.
And
accumulated random noise accumulates
error with time.
35) Pulse Width Modulation without Phase
Modulation?
Spectrum analysis says that
a
balanced PWM has no Phase shift.
A bandpass filter and an
inverter
verifies that fact.
Jitter Analysis shows how
jitter can happen with zero Phase shift.
36) Some Noise Surprises in Transient
Analysis
The
difference between rms and magnitude
can create confusion.
How to
lower the bandwidth of noise while keeping
the same rms.
37) Oscillator Phase Noise in Transient Analysis
Import a noise file into a
free running oscillator's spectrum.
Export jitter from a noisy free
running oscillator.
Phase modulate a signal
to match a free running oscillator's spectrum.
Predict how white noise will
appear on a free running oscillator's spectrum.
An even better discussion can be found
here
and
also here.
38) Mathematically process SPICE's Output
waveforms within Spice.
Extract and plot
prop
delays vs supply voltage applied to CMOS inverters.
Extracted and
average time periods to
precisely measure a crystal oscillator's frequency.
The frequency of a crystal can be
mathematically extrapolate from an AC
simulation.
How a varactor can
vary the frequency of crystal oscillator
can be precisely measured.
Removing SPICE's phase wrap around
can makes viewing a crystal's phase easier.
39) Digital
filter simulations using behavioral models in Spice.
A behavioral model to meet the need for
a
two phase clock.
Behavioral Models using switches
show the theoretical limitations.
Two phase clock
switching
of a capacitor behaves like resistors.
Two sample and hold stages makes
an analog delay element.
Analog delay elements are the
basic building blocks in digital filters.
Low pass filters
average
what happens in the past with the present.
High pass filter
compare
differences between the past and present.
Delayed analog signals in feed back
behave like analog filters.
40) Eye
Diagram Simulation resources in Spice.
Spice has the resources to
plot a Eye Diagram using random
digital signals.
Digital randomness can be done
digitally or
linearly.
Viewing
how an Eye Diagram is actually being
degraded can be be intuitive.
The
BER requirements need to be
considered.
41) Different
architectures for CMOS current mirrors.
How does a
pure cascode CMOS current mirror
compare to a BiCMOS mirror?
Some mirrors use CMOS transistors like
degeneration resistors.
A
self cascode architecture has
its features as well.
42) Perfect
Logic versus Real Logic in SPICE.
Using Behavioral Logic in most cases
does not present a problem.
Some Behavioral Flip-Flops will converge
if care is taken to
hold all inputs stationary.
A
Behavioral Flip-Flop used in a counter
application may require break before make to converge.
Building
Phase Frequency detectors may
need this feature to converge,
43) Load
Sweeping Transient Analysis.
Sometimes it might be useful to sweep
the load current of
a Charge Pump over a
large dynamic range.
Sweeping the load current with time can
verify the output impedance of
a Voltage Multiplier.
44) Duty
Cycle Sweeping Transient Analysis.
Transient analysis can provide an easy
to graph the Output of a
Buck Converter versus Duty Cycle.
Output Voltage versus Duty Cycle
versus Output Resistance can be plotted for a
Buck Converter .
The same can be done for a
Boost Converter, a
Boost Buck Converter , and a
SEPIC Converter.
45) More
Spice Features
Having working examples of what
all the
Waveform processing function do
leaves nothing out.
The
waveform Sort Function is
powerful but not straight forward on how to use it.
Transient
timing is
not consistent for things like square waves.
Sine waves that are
sampled close to nyquist appear
to have an attentuation
compared to normal.
Piece Wise Linear wave forms have
inconsistent timing which can be
fixed with a linearize statement.
If a version of Spice has funny blanking for
X/Y plots, it is
due to the curve tracer application.
It is possible to build an
Arbitrary
WaveForm Generator in SPICE.
============
SOURCE CODE FOR
ABOVE=======================
46) FFT
Windowing Fun
Windowing divides up signal into
time frames while
reducing Spectrum Leakage at the
same time.
Windowing typically converts a
sine wave into
a Classical AM spectrum located
at three frequency bins.
The Spectrum leakage is reduced when
input signal is converted into
Window Distortion Harmonics.
Sometimes
adding
2nd and 3rd harmonic distortion to the window can reduce
Spectrum leakage
.
Testing of all the Windowing
functions
can be automated.
There are ways to plot all of
the Windowing function results
on a single plot.
============
SOURCE CODE FOR
ABOVE=======================
47) New
FFT/IFFT Functions for MacSpice
The
New FFT/IFFT functions appear to
operate in both a Euler format and a Frequency format.
Some attention needs to be placed
on
having consistent timing in the
waveform.
A normal square wave has some
timing details that should be addressed.
Adjustments in timing can
fix
Spectrum leakage.
Triangle waves work as expected.
Sine waves can show the
limits
to precision.
Spectrum
leakage can be view as a waveform.
Butterworth filters can now be
better tested for group delays.
Bessel filters can now be better tested
for group delays.
Input
distortion can now be extracted and viewed is a waveform.
Output
distortion can now be extracted and viewed is a waveform.
============
SOURCE CODE FOR
ABOVE=======================
48) Redefining
Ohm's Law
Where is energy lost in a
Full Wave Rectifier?
Where is energy lost in
Switched Capacitors?
Where is energy lost in
Switched Supplies?
Class
D output stages as found in audio.
A
Class D Op Amp.
Building a Current Source using
Feedback.
A
Class D Current
Source.
A
Dual Supply Class D output stage.
A
Class D Resistor and
Ohm's Law
The
Energy
Harvesting Resistor.
============
SOURCE CODE
FOR ABOVE=======================
49) Randomness
for Better or Worst
When you take N samples, how
well
can you trust the result?
A
random transient simulation is
easy to do in spice.
A random transient simulation can
demonstrate noise adding with power.
Digital randomness is repeatable,
which makes it quite useful.
How low does a standard deviation
need to be for a given Bit error rate?
It is easy to
generate a random stream of ones and zeros.
Undersampling noise only
packages the same RMS power into less bandwidth.
Accumulated noise
is different from normal randomness.
A jitter transient simulation
can be done in spice.
A transient
eye chart simulation shows the
impact of cable limited bandwidth.
Personally modeling a cable may
be much more trust worthy in the end.
The spectrum for a simple
AM signal shows the spectrum's scaling.
The spectrum for a simple
PM signal
attempts to match that of a AM signal.
Phase modulation by a random signal
has a predictable spectrum.
Phase modulation by
accumulated noise maps nicely to the PM
noise spectrum.
Only ten lines of spice code are
need generate
a clockless ADC and DAC.
Adding a sample and hold turns
a clockless ADC into a normal ADC.
Spread Spectrum Sampling for
ADCs spreads out all harmonics.
A Spread Spectrum Sampled ADC
(SSS)
does not alias.
Quantization error was a problem
for early digital audio.
The
dithering
technique solved the Quantization error problem.
============
SOURCE
CODE FOR ABOVE=======================
50) Can
this be a Simple way to predict
Oscillator Phase Noise?
How can a
Graph
and a Calculator predict Phase Noise?
How does the
accumulation of Phase Noise
Work?
How much does
Low Phase Noise Cost?
How does
supply voltage effect Phase
Noise?
How does
Phase Modulation resembles Amplitude
Modulation?
How does Noise gets
spread out during sampling?
How does Noise
react to under sampling?
How can a
random PM spectrum can be easily predicted?
How does a tuned circuit's
bandwidth really
equal frequency over Q?
============
SOURCE
CODE FOR ABOVE=======================
51) DC
controlled Spice Subcircuits to make Universal Analog/Digital Filters
Transient simulating a
DC
controlled Universal Analog Filter Block.
Demonstration how to
DC
control the filter type of a Universal Analog Filter.
Demonstration
how
a Digital "z" block can work like an Analog "s" block.
Substituting and running "z" for "s"
blocks in the same circuit .
Classical Brickwall filter approximations
using analog filter blocks.
Using FFT/IFFT to
simulate a perfect Brickwall filter on a
square wave.
Using FFT/IFFT to
simulate
a perfect Brickwall filter's impulse response.
DC
applying a perfect Brickwall filter's impulse response to a FIR Digital filter.
Demonstrating how
a
FIR with Brickwall filter's impulse
response filters correctly.
How a Phase shifting
Hilbert filter is needed for single
sideband transmission.
DC
controlling a 6 pole ALLPASS to be a have linear frequency to phase
shift.
Using two 6 pole ALLPASS filters
to
create
two outputs which have 90 degrees of offset.
Using FFT/IFFT to simulate a
Hilbert
Filter applied to a square wave.
Using FFT/IFFT to simulate
impulse response of a Hilbert Filter.
DC applying a impulse response of
a
Hilbert
to a FIR Digital filter.
Demonstrating how a FIR with the
impulse
response of a Hilbert filters correctly.
============
SOURCE
CODE FOR ABOVE=======================
52) Delta
Modulation and Sigma
Delta, etc...
Reinventing Delta Modulation,
and some
background history.
Sigma Delta and Noise Shaping
transient and FFT spice simulation.
Second
order Sigma Delta and Noise Shaping transient and FFT spice
simulation.
A spice simulation that
demonstrates
how OverSampling works.
Doing spice transient and FFT
simulation of Decimation.
A digital filter spice simulation
which
demonstrates Interpolation.
============
SOURCE
CODE FOR ABOVE=======================
53) Analog
to Digital Conversion using (when something happens) Event Sampling
Reading
about
Folding ADCs turned up
an easy architecture to perform
the same function
Folding and
Flash architectures have been
around for some time, but
none this simple.
Asynchronous Analog to Digital Conversion
using
Level Crossing definitely
follows different rules
When
Asynchronous Analog to Digital Conversion
is sampled with a clock, things return to normal
Initially,
Threshold Sampling look like it is
truncating data.
An easy extrapolation method is
shown here, and
more advanced methods are found here.
Extrapolation actually works quite well
even using simple methods.
Adding some
Additional Event Sampling to Threshold
Sampling can greatly enhance full signal capture.
============
SOURCE
CODE FOR ABOVE=======================
When we remember we are all mad, the mysteries disappear and life
stands explained.
- Mark Twain
Any fool can criticize, condemn
and complain, and most fools do.
- Ben Franklin
Your worth consists in what you
are and not in what you have.
- Thomas Edison
You may fail many times, but
you are still not a failure until you begin to blame someone
else.
????
The most exciting
phrase to hear in science, the one that heralds the most discoveries,
is not ‘Eureka!’
but ‘That’s
funny…’”
- Isaac Asimov
Be who you are and say what you feel, because those who mind don't
matter and those who matter
don't
mind.
- Dr. Seuss
Don Sauer... DSauerSanJose@Aol.com