The following constants are defined and may be used in behavioral
sources, expressions or waveform math:
boltz: 1.38062e-023 (Boltzmann constant)
planck: 6.6262e-034 (Planck's constant)
kelvin: -273.15 (degrees C)
echarge: 1.60219e-019 (charge of an electron)
pi: 3.14159
The following operators may be used in waveform math (.ac analysis):
freq: frequency
re(): the real part of the argument
im(): the imaginary part of the argument
ph(): the phase of the argument
mag(): the magnitude of the argument
db(): the magnitude of the argument expressed in dB
invdb(): converts the argument from dB back to plain magnitude
The following operators may be used in waveform math (.tran analysis):
stp(): step - works the same as u()
round(): rounds to the nearest whole number - similar to int()
ddt(): computes the time derivative of its argument
idt(): computes the time-integral of its argument
idtmod(): similar to above but with wrapping
absdelay(): implements the absolute transport delay for continuous
waveforms. The general form is absdelay( input, td [, maxdelay ] )
where "input" is delayed by the amount td. In all cases td shall be
a positive number. If the optional maxdelay is specified, then td can
vary, but it shall be an error if it becomes larger than maxdelay. If
maxdelay is not specified, changes to td shall be ignored. If maxdelay
is specified, changes to td are ignored and the initial value of
maxdelay is used.
This last definition was taken from the Verilog-AMS Language Reference
Manual at http://people.deas.harvard.edu/~guyeon/CAD
I haven't yet checked to see if these functions work in expressions or
behavioral sources. -- analog
Love the title ("What They Don't Want You To Know")
BTW, your suggestion to use the Spice Error Log to help discover which
.STEP'd simulation created which darn plot in the Waveform Viewer was
right on. Very, very useful. I had, just the previous day, asked Mike
Englehardt if he knew of any way to do just that, by, I said, maybe
poking through the results of the simulation by hand, and he said, no.
So -- either the good luck I have with your method is the result of
conincidence, or Mike Englehardt, master of all things LTSpice, doesn't
know of this trick.
Or . . . maybe . . . it's What They Don't Want You To Know. Area 51?
Grassy knoll? Illuminati? You be the judge!
MikeE
>Ok, ok, just an exaggeration, but I *do* have some undocumented
>features to report.
>
>The following constants are defined and may be used in behavioral
>sources, expressions or waveform math:
>
>boltz: 1.38062e-023 (Boltzmann constant)
>planck: 6.6262e-034 (Planck's constant)
>kelvin: -273.15 (degrees C)
>echarge: 1.60219e-019 (charge of an electron)
>pi: 3.14159
Hmmm! Just part of page 3-11 of my Silvaco SmartSpice manual, which
I'm presently trying to understand and run, since a client can't
simulate one of my PSpice designs...
I need to convert (PSpice notation):
E_E3 FM 0 VALUE { V(451K)*V(BIT)/5+V(459K)*(5-V(BIT))/5 }
to an "A" (Analog Behavioral) device.
Can anyone point me in the right direction?
Thanks!
...Jim Thompson
--
| James E.Thompson, P.E. | mens |
| Analog Innovations, Inc. | et |
| Analog/Mixed-Signal ASIC's and Discrete Systems | manus |
| Phoenix, Arizona Voice:(480)460-2350 | |
| Jim-T@analog_innovations.com Fax:(480)460-2142 | Brass Rat |
| http://www.analog-innovations.com | 1962 |
For proper E-mail replies SWAP "-" and "_"
I love to cook with wine. Sometimes I even put it in the food.
>On Fri, 21 Feb 2003 19:15:34 GMT, analog <ana...@ieee.org> wrote:
>
>>Ok, ok, just an exaggeration, but I *do* have some undocumented
>>features to report.
>>
>>The following constants are defined and may be used in behavioral
>>sources, expressions or waveform math:
>>
>>boltz: 1.38062e-023 (Boltzmann constant)
>>planck: 6.6262e-034 (Planck's constant)
>>kelvin: -273.15 (degrees C)
>>echarge: 1.60219e-019 (charge of an electron)
>>pi: 3.14159
>
>Hmmm! Just part of page 3-11 of my Silvaco SmartSpice manual, which
>I'm presently trying to understand and run, since a client can't
>simulate one of my PSpice designs...
>
>I need to convert (PSpice notation):
>
>E_E3 FM 0 VALUE { V(451K)*V(BIT)/5+V(459K)*(5-V(BIT))/5 }
>
>to an "A" (Analog Behavioral) device.
>
>Can anyone point me in the right direction?
>
>Thanks!
>
> ...Jim Thompson
Groping, it looks like it's:
AE_E3 FM 0 V(451K)*V(BIT)/5+V(459K)*(5-V(BIT))/5
> I need to convert (PSpice notation):
>
> E_E3 FM 0 VALUE { V(451K)*V(BIT)/5+V(459K)*(5-V(BIT))/5 }
>
> to an "A" (Analog Behavioral) device.
>
> Can anyone point me in the right direction?
Maybe Silvaco can run this notation:
B1 FM 0 V=V(451K)*V(BIT)/5+V(459K)*(5-V(BIT))/5
LTspice can run both.
--Mike
Whoops, where do those pisky misteaks keep coming from? Of course,
this should have read: The following operators may be used in B-source
expressions (.tran analysis):
> stp(): step - works the same as u()
> round(): rounds to the nearest whole number - similar to int()
>
> ddt(): computes the time derivative of its argument
> idt(): computes the time-integral of its argument
> idtmod(): similar to above but with wrapping
>
> absdelay(): implements the absolute transport delay for continuous
> waveforms. The general form is absdelay( input, td [, maxdelay ] )
> where "input" is delayed by the amount td. In all cases td shall be
> a positive number. If the optional maxdelay is specified, then td can
> vary, but it shall be an error if it becomes larger than maxdelay. If
> maxdelay is not specified, changes to td shall be ignored. If maxdelay
> is specified, changes to td are ignored and the initial value of
> maxdelay is used.
>
> This last definition was taken from the Verilog-AMS Language Reference
> Manual at http://people.deas.harvard.edu/~guyeon/CAD
I used WordPad to browse through the scad3.exe program file in an
attempt to discover undocumented function and parameter names that
may be worth the trouble to learn how to use properly (if one can
guess correctly at their meaning!). While doing this I came across
the names of several Special Function A-sources not mentioned in
the scad3 help file.
Here is a list of the Special Function A-sources I found:
SmBusDAC, SpiDAC, DAC5,
PhaseDet, Modulator, Varistor,
SampleHold, Counter, Timer, ExtOsc,
invPGateDrive, PGateDrive, invGateDrive,
SwitchYard, OTA, Amp,
SerFlop, JKFlop, DFlop, SRFlop,
XOR, OR, AND, Schmitt, Buf
Maybe it would be fun to try to figure out how to use the ones that
aren't already documented. I bet the JKFlop just follows the pattern
of the SRFlop (which is documented). And based on the name alone, I
definitely want to go play in the SwitchYard.
I also found the following list of parameters that seem to belong to
the Special Function A-sources:
Ink Enk In En Ierr Burst EaClk FullDuty Ibuck Powerup Rmux Ioffset
Vhcrow Vtcrow Foldback Crowbar FreqMult Verr Slope Pseudo ClkOffset
Offset Cycles Space Mark Duty Ttol VestRes Vhgo Vtgo InVgo aReset
NoBreak invBurst Reciprocal Rclamp Vhcap Vtcap Vh Vt Td maxOn minOff
minOn AVOL GBW Ref Tfall Trise Tau Vhigh Vlow Isrc Isource Icharge
Idischarge Isink Iout Rhigh Rlow Cout Roff Rout
Some of these are already documented, but what do the hidden
treasures do? Hmmm... analog
Its because of people like you that I have stuff encrypted in the
SuperPSpice exe:-)
Kevin Aylward
sa...@anasoft.co.uk
http://www.anasoft.co.uk
SuperSpice, a very affordable Mixed-Mode
Windows Simulator with Schematic Capture,
Waveform Display, FFT's and Filter Design.
Well, just dump the memory when executed, not the .exe file and there's no
more secrets :-)
Fred.
Happy sims -- analog
Waveform Arithmetic:
The difference of two voltages; e.g., V(a)-V(b); can equivalently
written as V(a,b). The following functions are available (r denotes
real data only, c denotes complex data only):
Name | Function
-------------------+-----------------------------
sin(x) | sine
cos(x) | cosine
tan(x) | tangent
asin(x) | arc sine
acos(x) | arc cosine
atan(x) | arc tangent
atan2(y,x) r arc tangent of y/x
hypot(y,x) r hypotenuse: sqrt(x*x+y*y)
sinh(x) | hyperbolic sine
cosh(x) | hyperbolic cosine
tanh(x) | hyperbolic tangent
asinh(x) | arc hyperbolic sine
acosh(x) | arc hyperbolic cosine
atanh(x) | arc hyperbolic tangent
exp(x) | exponential
ln(x) or log(x) | natural logarithm
log10(x) | base 10 logarithm
sgn(x) r sign (0 if x = 0)
fabs(x) r absolute value
abs(x) | absolute value
sqrt(x) | square root
cbrt(x) | cube root
pow(x,y) r x**y
pwr(x,y) r abs(x)**y
pwrs(x,y) r sgn(x)*abs(x)**y
min(x,y) r the lesser of x or y
max(x,y) r the greater of x or y
limit(x,y,z) r equivalent to min(max(x,y),z)
table(x,x1,y1...) r interpolate values for x
where: x1<x2... r based on a lookup table
r of x-ordered point pairs
uramp(x) r x if x > 0, else 0
u(x) r unit step: 1 if x > 0, else 0
buf(x) r 1 if x > .5, else 0
!(x) or inv(x) r 0 if x > .5, else 1
rand(x) r random number between 0 and 1?
re(x) c real part
im(x) c imaginary part
ph(x) c phase
mag(x) c magnitude
db(x) c magnitude in dB
invdb(x) c 10**(x/20)
Waveform Arithmetic (continued):
The following operations, grouped in order of precedence of evaluation
(for complex data only +, -, *, /, and ** are available):
Symbol | Operation
--------+--------------------------------------------------
! | convert succeeding expression to Boolean then
| invert
** | floating point exponentiation
--------+--------------------------------------------------
/ | floating point division
* | floating point multiplication
% | floating point modulus (real data only)
--------+--------------------------------------------------
- | floating point subtraction
+ | floating point addition
--------+--------------------------------------------------
== | true if preceding expression is equal to
| succeeding expression, otherwise false
>= | true if preceding expression is greater than or
| equal to succeeding expression, otherwise false
<= | true if preceding expression is less than or
| equal to succeeding expression, otherwise false
> | true if preceding expression is greater than
| succeeding expression, otherwise false
< | true if preceding expression is less than
| succeeding expression, otherwise false
--------+--------------------------------------------------
^ | convert adjacent expressions to Boolean then XOR
| | convert adjacent expressions to Boolean then OR
& | convert adjacent expressions to Boolean then AND
True is numerically equal to 1 and False is 0. Conversion to Boolean
converts a value to 1 if the value is greater than 0.5, otherwise the
value is converted to 0.
The following keywords (global variables and constants):
Name | Value | Description
---------+---------------+----------------------------------
time | variable | time in seconds (real data only)
freq | variable | freq in Hertz (cmplx data only)
w | variable | freq in radians (cmplx data only)
i | sqrt(-1) | imaginary unity (cmplx data only)
e | 2.71828 |
pi | 3.14159 |
c | 2.99792e+008 | speed of light in m/s
boltz | 1.38062e-023 | Boltzmann constant
planck | 6.62620e-034 | Planck's constant
echarge | 1.60219e-019 | charge of an electron
kelvin | -2.73150e+002 | absolute zero in degrees C
Happy sims -- analog
B. Arbitrary behavioral voltage or current sources.
Symbol names: BV, BI
Syntax: Bxxx n1 n2 V=<expression>
+ [[ic=<value>] tripdv=<value>] [tripdt=<value>]
+ [Laplace=<func(s)> [window=<time>] [nfft=<number>]]
Bxxx n1 n2 I=<expression> [Rpar=<value>]
+ [ic=<value>] [tripdv=<value>] [tripdt=<value>]
+ [Laplace=<func(s)> [window=<time>] [nfft=<number>]]
The first syntax specifies a behavioral voltage source and the next is
a behavioral current source. For the current source, a parallel
resistance may be specified with the Rpar instance parameter.
Tripdv and tripdt control step rejection. If the voltage across a
source changes by more than tripdv volts in tripdt seconds, that
simulation time step is rejected.
The transfer function of the Laplace circuit element is specified by
its Laplace transform. The Laplace transform must be a function of s.
The frequency response at frequency f is found by substituting s with
sqrt(-1)*2*pi*f. The time domain behavior is found from the impulse
response obtained from the Fourier transform of the frequency domain
response. LTspice must guess an appropriate frequency range and
resolution. The response must drop at high frequencies or an error is
reported. It is recommended that the LTspice first be allowed to make
a guess at this and then check the accuracy by reducing reltol or
explicitly setting nfft and the window. The reciprocal of the value
of the window is the frequency resolution. The value of nfft times
this resolution is the highest frequency considered.
Expressions can contain the following:
o Node voltages, e.g., V(n1)
o Node voltage differences, e.g., V(n1,n2)
o Circuit element currents; for example, I(S1), the current
through switch S1 or Ib(Q1), the base current of Q1. However, it is
assumed that the circuit element current is varying quasi-statically,
that is, there is no instantaneous feedback between the current through
the referenced device and the behavioral source output.
o The keyword "time" meaning the current time in the simulation.
o Any user defined parameters or functions. For details, refer
to the .param and the .func simulator directives defined under the Help
subchapter on Dot Commands.
B. Arbitrary behavioral voltage or current sources (continued).
o The following functions:
Name | Function
-------------------+-----------------------------
sin(x) | sine
cos(x) | cosine
tan(x) | tangent
asin(x) | arc sine
acos(x) | arc cosine
atan(x) | arc tangent
atan2(y,x) | arc tangent of y/x
hypot(y,x) | hypotenuse: sqrt(x*x+y*y)
sinh(x) | hyperbolic sine
cosh(x) | hyperbolic cosine
tanh(x) | hyperbolic tangent
asinh(x) | arc hyperbolic sine
acosh(x) | arc hyperbolic cosine
atanh(x) | arc hyperbolic tangent
exp(x) | exponential
ln(x) or log(x) | natural logarithm
log10(x) | base 10 logarithm
sgn(x) | sign (0 if x = 0)
abs(x) | absolute value
sqrt(x) | square root
square(x) | x**2
pow(x,y) | x**y
pwr(x,y) | abs(x)**y
pwrs(x,y) | sgn(x)*abs(x)**y
round(x) | round to nearest integer
int(x) | truncate to integer part of x
floor(x) | integer equal or less than x
ceil(x) | integer equal or greater than x
min(x,y) | the lesser of x or y
max(x,y) | the greater of x or y
limit(x,y,z) | equivalent to min(max(x,y),z)
if(x,y,z) | if x > .5 then y else z
table(x,x1,y1...) | interpolate values for x
where: x1<x2... | based on a lookup table
| of x-ordered point pairs
uramp(x) | x if x > 0, else 0.
u(x) or stp(x) | unit step, 1 if x > 0, else 0
buf(x) | 1 if x > .5, else 0
!(x) or inv(x) | 0 if x > .5, else 1
rand(x) | random number between 0 and 1
ddt(x) | time derivative
idt(x) or sdt(x) | time integral: idt(x[,ic[,assert]])?
idtmod(x) | time integral with wrapping at 2*Pi
| idtmod(x[,ic[,mod[,offset]]])?
delay(x,y) | delay x by y seconds
absdelay(x,y) | absdelay(x,delay[,max_delay])?
B. Arbitrary behavioral voltage or current sources (continued).
o The following operations, grouped in order of precedence of
evaluation:
Symbol | Operation
--------+--------------------------------------------------
~ or ! | convert succeeding expression to Boolean then
| invert
** | floating point exponentiation
--------+--------------------------------------------------
/ | floating point division
* | floating point multiplication
--------+--------------------------------------------------
- | floating point subtraction
+ | floating point addition
--------+--------------------------------------------------
== | true if preceding expression is equal to
| succeeding expression, otherwise false
>= | true if preceding expression is greater than or
| equal to succeeding expression, otherwise false
<= | true if preceding expression is less than or
| equal to succeeding expression, otherwise false
> | true if preceding expression is greater than
| succeeding expression, otherwise false
< | true if preceding expression is less than
| succeeding expression, otherwise false
--------+--------------------------------------------------
^ | convert adjacent expressions to Boolean then XOR
| | convert adjacent expressions to Boolean then OR
& | convert adjacent expressions to Boolean then AND
True is numerically equal to 1 and False is 0. Conversion to Boolean
converts a value to 1 if the value is greater than 0.5, otherwise the
value is converted to 0.
o The following keywords (global variables and constants):
Name | Value | Description
---------+---------------+----------------------------------
time | variable | time in seconds
pi | 3.14159 |