幸运飞艇超稳计划群

MacSpice > User's Guide > Interactive Interpreter

MacSpice User's Guide

5 INTERACTIVE INTERPRETER

MacSpice is distributed as a Mac OS X application bundle. It provides an enhanced versions of the Spice 3 simulator and the Nutmeg front-end command interpreter for data analysis and plotting. Installation notes and release notes are published on www.macpsice.com. MacSpice has several mechanisms for inter-process communication幸运飞艇超稳计划群 with other applications and shells.

spice 3 consists of a simulator and a front-end for data analysis and plotting. the front-end may be run as a separate "stand-alone" program under the name nutmeg.

Nutmeg will read in the "raw" data output file created by Spice -r or with the write command in an interactive Spice 3 session. Nutmeg or interactive Spice 3 can plot data from a simulation on a graphics terminal or a workstation display. Most of the commands available in the interactive Spice 3 front end are available in nutmeg; where this is not the case, Spice-only commands have been marked with an asterisk ("*"). Note that the raw output file is different from the data that Spice2 writes to the standard output, which may also be produced by Spice 3 with the "-b" command line option.

Spice and Nutmeg use the X Window System for plotting if they find the environment variable DISPLAY. Otherwise, a graphics-terminal independent interface (MFB) is used. If you are using X on a workstation, the DISPLAY variable should already be set; if you want to display graphics on a system different from the one you are running Spice 3 or Nutmeg on, DISPLAY should be of the form "machine:0.0". See the appropriate documentation on the X Window System for more details.

Command Synopsis

     Spice [ -n ] [ -t term ] [ -r rawfile ] [ -b ] [ -i ] [ inpfile ... ]
     nutmeg [ - ] [ -n ] [ -t term ] [ datafile ... ]

Options are:

-
Don't try to load the default data file ("rawspice.raw") if no other files are given. Nutmeg only.
 
-n (or -N)
Don't try to source the file ".spiceinit" upon startup. Normally Spice and Nutmeg try to find the file in the current directory, and if it is not found then in the user's home directory.
 
-t term (or -T term)
The program is being run on a terminal with mfb name term.
 
-b (or -B)
Run in batch mode. Spice 3 reads the default input source (e.g. keyboard) or reads the given input file and performs the analyses specified; output is either Spice2-like line-printer plots ("ascii plots") or a Spice rawfile. See the following section for details. Note that if the input source is not a terminal (e.g. using the IO redirection notation of "<") Spice 3 defaults to batch mode (-i overrides). This option is valid for Spice 3 only.
 
-s (or -S)
Run in server mode. This is like batch mode, except that a temporary rawfile is used and then written to the standard output, preceded by a line with a single "@", after the simulation is done. This mode is used by the Spice daemon. This option is valid for Spice 3 only.
 
-i (or -I)
Run in interactive mode. This is useful if the standard input is not a terminal but interactive mode is desired. Command completion is not available unless the standard input is a terminal, however. This option is valid for Spice 3 only.
 
-r rawfile (or -P rawfile)
Use rawfile as the default file into which the results of the simulation are saved. This option is valid for Spice 3 only.
 

Further arguments to Spice are taken to be Spice 3 input files, which are read and saved (if running in batch mode then they are run immediately). Spice 3 accepts most Spice2 input file, and output ascii plots, Fourier analyses, and node printouts as specified in .PLOT, .FOUR, and .PRINT control lines. If an out parameter is given on a .WIDTH control line, the effect is the same as set width = .... Since Spice 3 ascii plots do not use multiple ranges, however, if vectors together on a .PLOT control line have different ranges they are not provide as much information as they would in Spice2. The output of Spice 3 is also much less verbose than Spice2, in that the only data printed is that requested by the above control lines.

For Nutmeg, further arguments are taken to be data files in binary or ascii format (see ) which are loaded into Nutmeg. If the file is in binary format, it may be only partially completed (useful for examining Spice2 output before the simulation is finished). One file may contain any number of data sets from different analyses.

幸运飞艇超稳计划群 berkeley spice 3 comprised a simulator and a front-end for data analysis and plotting. the front-end could be compiled separately and run as an independent program named nutmeg. most of the commands available in the interactive spice 3 front-end were available in nutmeg; where this was not the case, spice-only commands have been marked with an asterisk in the list below.

5.1 EXPRESSIONS, FUNCTIONS, AND CONSTANTS

Spice (the simulator) and Nutmeg (the front-end) data is in the form of vectors: time, voltage, etc.. Each vector has a type, and vectors can be operated on and combined in algebraic ways consistent with their types. Vectors are normally created when the simulator performs an analysis, or a data file is read in (see the load command below). They can also be created with the let command.

an expression is an algebraic formula involving vectors and scalars (a scalar is a vector of length 1) and the following operations:

幸运飞艇超稳计划群 +  -  *  /   %  ^  ,

'%' is the modulo operator, '^' is the power operator. The unary minus has a higher precedence than both of these, i.e. -x^2 is interpreted as (-x)^2, but 0-x^2 is interpreted as -(x^2). The comma operator has two meanings: if it is present in the argument list of a user-definable function, it serves to separate the arguments. Otherwise, the term x,y is synonymous with x+j(y).

The relational operations '<', '>', '>=', '<=', '=', and '<>' are available. When used in an algebraic expression they work like they would in C, returning values of 0 or 1. Also available are the logical operations 'and', 'or', 'xor', and 'not'. The traditional Boolean definitions of these operations have been extended by using the floating-point exception value 'NaN' (e.g. 0/0) to represent the 'unknown' state of so-called Kleene tri-state logic. The relational and logical operators have the following synonyms:

& and | or # xor ~ not
> gt >= ge < lt <= le
= eq <> ne >< ne

幸运飞艇超稳计划群 these text synonyms, which are case sensitive, should be used for relational operators when '<' and '>' might be confused with io redirection.

幸运飞艇超稳计划群the following functions were available in berkley spice 3f5:

mag(vector) The magnitude of vector. [Note: magnitude() is a synonym for this.]
ph(vector) The phase of vector. [Note: phase() is a synonym for this.]
real(vector) The real parts of vector.
imag(vector) The imaginary parts of vector.
j(vector) The vector is multiplied by sqrt(−1).
db(vector) 20log10(vector). If vector is complex, its magnitude is taken. MacSpice changes the pre-factor to 10 if the units of vector are identified as being proportional to power.
log(vector) The logarithm (base 10) of vector.
ln(vector) The natural logarithm (base e) of vector.
exp(vector) e to the vector power.
abs(vector) The absolute value of vector.
sqrt(vector) The square root of vector.
sin(vector) The sine of vector.
cos(vector) The cosine of vector.
tan(vector) The tangent of vector.
atan(vector) The inverse tangent of vector.
norm(vector) The vector normalized to 1 (i.e. the largest magnitude of any element is 1).
pos(vector)1 if the real part of vector is positive (greater than zero), 0 otherwise. [Note: present, but undocumented in Berkeley Spice 3.]
rnd(vector)A vector with random integer components in the range [0..n−1] where n is the largest integer not greater than the absolute value of the corresponding component of vector and not greater than 231. The MacSpice (v3.1.20) implementation of rnd() avoids modulo bias and generates a uniform distribution for all values of n≤253. See also the compose command below.
mean(vector) The result is a scalar (a length 1 vector) that is the arithmetic mean of all the elements of vector. Calculated using extended precision summation. See also the average(array) function below.
unitvec(number)The result is a vector of length number, with elements 1. If number is a vector then just the first element is taken, and if it isn't an integer then the floor of the (real) value or (complex) magnitude is used. [Note: present, but undocumented in Berkeley Spice 3.]
vector(number) The result is a vector of length number, with elements 0, 1, ... number−1. If number is a vector then just the first element is taken, and if it isn't an integer then the floor of the (real) value or (complex) magnitude is used.
length(vector) The length of vector.
interpolate(vector)The result of interpolating the named vector onto the current scale of the current plot. This function uses the variable polydegree to determine the degree of interpolation. Both the argument vector, and its scale, must be real.
deriv(vector) Interpolates its argument onto the current scale and differentiates the interpolating polynomial with repect to the current scale. The order is set by the variable dpolydegree. (N.B. Numerical differentiation may produce noisy or inaccurate results, particularly when iterated to obtain nth-order derivatives.) Both the argument vector, and its scale, must be real.

幸运飞艇超稳计划群the following additional functions are available in macspice but may not be compatible with other simulators:

acos(vector) The inverse cosine of vector.
asin(vector) The inverse sine of vector.
integral(vector)Interpolates its argument onto the current scale and integrates the interpolating polynomial with repect to the current scale. The order is set by the variable ipolydegree. Both the argument vector, and its scale, must be real.
unwrap(vector) Unwraps a vector that contains a sequence of phase angles; affected by the current units and unwraptol settings.
wrap(vector) Wraps vector containg a sequence of phase angles so that they all lie within the range [−180°,+180°) or [−π,+π) as indicated by the current units setting.

The following functions operate on array幸运飞艇超稳计划群 argument-types and have this property:

$$ \begin{align*} f( \;\mathbf{a}_0 \;;\; \mathbf{a}_1 \;;\; ... \;;\; \mathbf{a}_n \;) = ( \;f(\; \mathbf{a}_0 ) \;;\; f( \mathbf{a}_1 ) \;;\; ... \;;\; f( \mathbf{a}_n ) \;) \end{align*} $$

Hence, with n-dimensional arguments, these functions iterate over additional dimensions and construct a vector or array of results. (See also the reshape and transpose commands.)

average(array)Returns the arithmetic mean of a vector. Calculated using extended precision summation. See also mean(vector) above.
cumsum(array)Returns the cumulative sum of vector elements. Calculated using extended precision summation.
fft(array)The discrete Fourier transform (DFT) of a vector. See Appendix E for details.
fftconvert(array)Converts the result of the FFT of a real vector between the layouts. See Appendix E for details.
hash(array)Returns a 52-bit integer hash, i.e. 0 ≤ h < 252, for vector keys.
ifft(array)The inverse DFT of a vector. See Appendix E for details.
maximum(array)Returns the maximum element of a real vector. See also §5.3.10.
minimum(array)Returns the minimum element of a real vector. See also §5.3.10.
structure(array)Returns the first-order structure function of a time-series sampled at regular intervals.
transpose(array)Transposes the rows and columns in the last two dimensions of the argument. See also §5.3.54.
sortorder(array) Returns the positions of the elements in a real vector after they have been sorted into increasing order using a stable method (mergesort).

A vector may be either the name of a vector already defined or a floating-point number (a scalar). A number may be written in any format acceptable to Spice, such as 14.6Meg or -1.231e-4. Note that you can either use scientific notation or one of the abbreviations like MEG or G幸运飞艇超稳计划群, but not both. As with Spice, a number may have trailing alphabetic characters after it.

The Spice 3 grammar used by the frontend is difficult to parse. In some cases it may be necessary to delimit element names with spaces, e.g. 'foo[ bar[n] ]'. A related problem arises when refering to vectors with names which start with characters that are a valid number, e.g. '2a'. (See below for a detailed explanation.)

MacSpice defines a semicolon operator to facilitate construction of vectors and n-dimensional matrices. It allows an (n+1)-dimensional vector to be constructed from two n-dimensional vectors, or an n-dimensional vector to be extended by appending/prepending an (n−1)-dimensional element. e.g. the commands:

    let foo = ((11;12);(21;22)) creates a 2×2 matrix
    let bar = (foo;(31;32))     creates a 3×2 matrix
    let baz = (foo;foo)         creates a 2×2×2 matrix
    let qux = (1;(3,4);5)       creates a 3-element complex vector

幸运飞艇超稳计划群 the ()'s protect the semicolon and prevent it being treated as a command separator.

The notation expr[num] denotes the num'th element of expr. For multi-dimensional vectors, a vector of dimension one lower is returned. Also for multi-dimensional vectors, the notation expr[m][n] will return the n'th element of the m'th subvector. If the index is a complex value its real and imaginary parts are interpreted as the first and last elements of a range. So, to get a subrange of a vector, use the form expr[lower,upper].

The notation vector[[lower,upper]] denotes the values in vector corresponding to the range from lower to upper in its scale, so that v(1)[[10,20]] gives all the values of v(1) for which the scale values associated with v(1)幸运飞艇超稳计划群 are in the range 10 to 20 inclusive. If there is one argument it picks out the values which have that scale value. Multi-dimensionality is ignored here; the result is a one-dimensional vector.

To reference vectors in a plot that is not the current plot (see the setplot command below), the notation plotname.vecname can be used.

Either a plotname or a vector name may be replaced by the wild-card all. If the plotname is all, matching vectors from all plots are specified, and if the vector name is all, all vectors in the specified plots are referenced. Note that you may not use binary operations on expressions involving wildcards - it is not obvious what all + all should denote, for instance. Thus some (contrived) examples of expressions are:

     cos(time) + db(v(3))
     sin(cos(log(1;2;3;4;5;6;7;8;9;10)))
     time * rnd(v(9)) - 15 * cos(vin#branch) ^ (7.9e5;8)
     not ((ac3.freq[32] & tran1.time[10]) gt 3)

[Note: Berkeley Spice 3 does not correctly parse vectors so, if code-portability is required, consider using the compose command.]

Vector names in Spice may have a name such as @name[param], where name is either the name of a device instance or model. This denotes the value of the param parameter of the device or model. See Appendix B for details of what parameters are available. The value is a vector of length 1. This function is also available with the show command, and is available with variables for convenience for command scripts.

The grammar of the expressions used by the Spice 3 command line interpreter is ambiguous. Node names can be 'arbitrary character strings' (see section 2.1), but numerical values have the property that 'letters immediately following a number that are not scale factors are ignored'. This means that it is impossible to distinguish node names from numbers merely by inspecting an expression containing them.

MacSpice normally gives precedence to numbers. This means that the value of sin(123m) is 2.146753e-03 and does not depend on whether or not the current plot has a vector called '123m' in it. The 'v()' and 'i()' functions are exceptions to this rule, their arguments are interpreted as character strings. Hence, it is possible to extract the values of vectors whose names are valid numbers by quoting them carefully, e.g.

	MacSpice 1 -> let 123m = 999
	MacSpice 2 -> print 123m
	123m = 1.230000e-01
	MacSpice 3 -> print v(123m)
	v(123m) = 9.990000e+02
	MacSpice 4 -> print \"123m\"
	"123m" = 9.990000e+02
	MacSpice 5 -> 

There are a number of pre-defined constants in Nutmeg. The values in MacSpice (version 3.1.19 et seq.) include yes/no, true/false, and:

piπ, 3.14159...
eThe base of natural logarithms, 2.71828...
iThe square root of −1
cThe speed of light, 299792458 m s−1
kelvinAbsolute zero in centigrade, −273.15 °C
echargeThe elementary charge, 1.602176634×10−19 C
boltzBoltzman's constant, 1.380649×10−23 J K−1
planckPlanck's constant, 6.62607015×10−34 J Hz−1

These are all in SI units. Constants should normally be referred to by including the plotname, e.g. 'const.boltz幸运飞艇超稳计划群', because this will avoid clashes with homonymous variables in the current plot. The above values are recommended exact values for adoption by SI and differ slightly from those used in the original Berkeley Spice 3 and previous versions of MacSpice. It is possible to delete, or modify the values of, the pre-defined vectors in the 'const' plot but this is not normally wise.

there are a number of pre-defined constants in nutmeg. they are:

piπ (3.14159...)
eThe base of natural logarithms (2.71828...)
cThe speed of light (299,792,500 m/s)
iThe square root of −1
kelvinAbsolute zero in centigrade (−273.15°C)
echargeThe elementary charge (1.6021918×10−19 C)
boltzBoltzman's constant (1.3806226×10−23 J/K)
planckPlanck's constant (6.626200×10−34 J/Hz)

幸运飞艇超稳计划群 these are all in mks units. if you have another variable with a name that conflicts with one of these then it takes precedence.

5.2 COMMAND INTERPRETATION

If a word is typed as a command, and there is no built-in command with that name, the directories in the sourcepath list are searched in order for the file. If it is found, it is read in as a command file (as if it were sourced). Before it is read, however, the variables argc and argv are set to the number of words following the filename on the command line, and a list of those words respectively. After the file is finished, these variables are unset. Note that if one command file calls another, it must save its argv and argc幸运飞艇超稳计划群 since they are altered. Also, command files may not be re-entrant since there are no local variables. (Of course, the procedures may explicitly manipulate a stack...) This way one can write scripts analogous to shell scripts for Nutmeg and Spice 3.

Note that for the script to work with Spice 3, it must begin with a blank line (or whatever else, since it is thrown away) and then a line with .CONTROL on it. This is an unfortunate result of the source command being used for both circuit input and command file execution. Note also that this allows the user to merely type the name of a circuit file as a command and it is automatically run. The commands are executed immediately, without running any analyses that may be specified in the circuit (to execute the analyses before the script executes, include a run幸运飞艇超稳计划群 command in the script).

There are various command scripts installed in /usr/local/lib/spice/scripts (or whatever the path is on your machine), and the default sourcepath includes this directory, so you can use these command files (almost) like built-in commands.

5.3 COMMANDS

5.3.1 Ac*: Perform an AC, small-signal frequency response analysis

General form:

     ac [ dec | oct | lin ] N Fstart Fstop

Perform an ac analysis. See the previous sections of this manual for more details.

5.3.2 Alias: Create an alias for a command

General form:

     alias [word] [text ... ]

Causes word to be aliased to text. History substitutions may be used, as in C-shell aliases.

5.3.3 Alter*: Change a device or model parameter

General form [3f4]:

     alter dev = expression
     alter dev param = expression
     alter @dev[param] = expression

Alternative form [pre 3f4]:

     alter device value
     alter device parameter value [ parameter value ]

Alter changes the value for a device or a specified parameter of a device or model. The first form is used by simple devices which have one principal value (resistors, capacitors, etc.) the other forms are for more complex devices (bjt's, etc.幸运飞艇超稳计划群). Model parameters can be changed with the second form if the name contains a '#'.

幸运飞艇超稳计划群 for specifying vectors as values, start the vector with '[', followed by the values in the vector, and end with ']'. be sure to place a space between each of the values and before and after the '[' and ']'.

for specifying vectors as values, either give the name of a vector or start the vector with '(', followed by the values in the vector separated with semicolons, and end with ')'.

Appendix B幸运飞艇超稳计划群 lists the 'input' parameters for each model that can be modified by 'alter'.

5.3.am Altermod*: Change a model parameter

General form:

     altermod mod = expression
     altermod mod param = expression
     altermod @mod[param] = expression

Altermod is a version of the alter command which operates on models and is used in the same manner. [Note: Code for this command was present but inactive in Berkeley Spice 3f4.]

5.3.ap Applescript: Compile and run Applescript

General form:

	applescript [-x] [-v] [-r resvar] line1 [line2 ...]

Example of usage:

	applescript -x -r result 'say "Hello"' 'return { 123, 456 }' 

This command facilitates interaction with other Mac applications. Each line of the script must be appropriately quoted so that it is treated as a single token when parsed. If the '-x' modifier is present the script will be compiled and executed, otherwise the lines will be sent to the application for inspection/testing. The '-r' modifier sets the associated variable resvar to a list of the results. The first element of resvar is used to indicate whether an error has occurred. If so, the second element of resvar幸运飞艇超稳计划群 will be an error message.

幸运飞艇超稳计划群 compiling applescript is a relatively slow process. where possible use the darwin shell bash(1) to execute scripts by using back-quotes. for example:

	set result = "`date`"

幸运飞艇超稳计划群 if the script is more than a few lines long, or the amount of data it returns is more than a few items, consider writing the information into files and passing their names.

See also MacSpice Inter-Process Communications.

5.3.4 Asciiplot: Plot values using old-style character plots

General form:

     asciiplot plotargs

Produce a line printer plot of the vectors. The plot is sent to the standard output, so you can put it into a file with asciiplot args ... > file. The set options width, height, and nobreak determine the width and height of the plot, and whether there are page breaks, respectively. Note that you will have problems if you try to asciiplot something with an x幸运飞艇超稳计划群-scale that isn't monotonic, because asciiplot uses a simple-minded linear interpolation.

5.3.5 Aspice: Asynchronous Spice run

General form:

     aspice input-file [output-file]

Start a Spice-3 run, and when it is finished load the resulting data. The raw data is kept in a temporary file. If output-file is specified then the diagnostic output is directed into that file, otherwise it is thrown away.

5.3.6 Bug: Mail a bug report

General form:

     bug

send a bug report. please include a short summary of the problem, the version number and name of the operating system that you are running, the version of spice that you are running, and the relevant spice input file. (if you have defined bugaddr, the mail is delivered to there.)

5.3.7 Cd: Change directory

General form:

     cd [ directory ]

Change the current working directory to directory, or to the user's home directory if none is given.

5.3.co Compose: Compose a vector

General form:

     compose name values value1 [ value2 ... ]
     compose name parm = val [ parm = val2 ... ]

幸运飞艇超稳计划群the first form takes the values and creates a new vector, the values may be arbitrary expressions.

In the second form possible values for parm are as follows.

for vectors with equally-spaced points:

startValue at which the vector should start.
stopValue at which the vector should end.
centerValue at the midpoint of the vector.
linNumber of points, linearly spaced.
stepDifference between sucessive elements.
spanSpan (start–stop) of values.

for vectors with logarithmically-spaced points:

startValue at which the vector should start.
stopValue at which the vector should end.
centerValue at the midpoint of the vector.
logNumber of points, logarithmically spaced.
ratioRatio between sucessive elements.
rangeRange (stop/start) of values.
decNumber of points per decade.

幸运飞艇超稳计划群for vectors of pseudo-random variates from standard distributions:

unifNumber of random points (uniform [0,1) distribution).
gaussNumber of random points (Gaussian distribution).
meanMean of the Gaussian distribution, default=0.
sdStandard deviation of the Gaussian distribution, default=1.

幸运飞艇超稳计划群for vectors of pseudo-random variates from a user-specified cumulative distribution function:

cdfVector tablulating the distribution.
binnedNumber of random points (discrete distribution)
smoothNumber of random points (continuous distribution)

The vector defining cdf幸运飞艇超稳计划群 must be non-decreasing and real, with the first element zero and the last element unity.

The MacSpice (v3.1.20) generates random variates using . By default, this is seeded with but the seed can be set explicitly using the srandom command below.

[note: the 'compose' command was not fully implemented in berkeley spice 3, however it can be a viable way to create a vector from a list of values in a portable manner.]

5.3.cs Cross: Create a vector

General form:

     cross vecname n [ vector1 vector2 ... ]

Create a new vector vecname from the nth elements of the listed vectors. Note: If any input vector is complex then the output vector will be complex, and vector1[n] will be the value of the first element of vecname. If n is a vector only the real part of its first element is used.

5.3.8 Destroy: Delete a data set

General form:

     destroy [ all | plotname [ plotname2 ... ] ]

幸运飞艇超稳计划群 disposed of the specified plots and recover their memory. if no arguments are given, the current plot is destroyed.

5.3.9 Dc*: Perform a DC-sweep analysis

General form:

     dc source vstart vstop vincr [ source2 vstart2 vstop2 vincr2 ]

Perform a dc transfer curve analysis. See the previous sections of this manual for more details.

5.3.10 Define: Define a function

General form:

     define function(arg1 [ , arg2  ... ]) expression

Define the user-definable function with the name function and arguments arg1, arg2, ... to be expression, which may involve the arguments. When the function is later used, the arguments it is given are substituted for the formal arguments when it is parsed. If expression is not present, any definition for function is printed, and if there are no arguments to define then all currently active definitions are printed. Note that you may have different functions defined with the same name but different arities [i.e. number of arguments].

some useful definitions are:

     define max(x,y) (x > y) * x + (x <= y) * y
     define min(x,y) (x < y) * x + (x >= y) * y

These are pre-defined in Nutmeg, but can be modified or removed with undefine, if required.

幸运飞艇超稳计划群 these original definitions do not handle all values arising from floating-point exceptions (in particular inf) correctly. for commensurate arguments, these alternatives comply with the ieee-754 standard:

     define max(x,y) maximum(transpose(x;y))
     define min(x,y) minimum(transpose(x;y))

They may be supplemented with versions that handle additional arguments, e.g.:

     define max(x,y,z) maximum(transpose(x;y;z))

5.3.dt Deftype: Define type of plot or vector

General form:

     deftype v vectype units
     deftype p plottype pattern [ pattern ... ]

Define addtional vector and plot types. The first form refers to vectors, for example:

     MacSpice 1 -> deftype v money USD
     MacSpice 2 -> let cost = 0.15 * vector(10)
     MacSpice 3 -> settype money cost
     MacSpice 4 -> plot cost vs vector(10)

This second form of this command seems to have been intended for use in the 'Command:' field of rawfiles. It defines additional plot-types. The short name given to a plot with any of the patterns present in its 'Name:' field will be plottypeN幸运飞艇超稳计划群, where N is a distinctive number.

See also settype below.

5.3.dc Delcirc*: Delete a circuit

General form:

     delcirc [ cktname | "" | all ]

Deletes the most recent circuit with a title starting with cktname from the list of available circuits and recovers the memory it was using. The delcirc command without an argument prints a menu of available circuits. Use the empty string, "", to match the current circuit.

See also: setcirc.

5.3.11 Delete*: Remove a trace or breakpoint

General form:

     delete [ all | [ debug-number ... ] ]

Delete the specified breakpoints, traces and saves. The debug numbers are those shown by the status command (unless you use status > file, in which case the debug numbers are not printed).

5.3.12 Diff: Compare vectors

General form:

     diff plot1 plot2 [ vec ...]

compare all the vectors in the specified plots, or only the named vectors if any are given. if there are different vectors in the two plots, or any values in the vectors differ significantly, the differences are reported. the following variables are used to determine what is meant by a significant difference:

diff_abstolabsolute current tolerance,
diff_reltolrelative tolerance,
diff_vntolabsolute voltage tolerance.

5.3.13 Display: List known vectors and types

General form:

     display [ varname ...]

Prints a summary of currently defined vectors, or of the names specified. The vectors are sorted by name unless the variable nosort is set. The information given is the name of the vector, the length, the type of the vector, and whether it is real or complex data. Additionally, one vector is labeled [default scale]. When a command such as plot is given without a vs argument, this scale is used for the X-axis. It is always the first vector in a rawfile, or the first vector defined in a new plot. If you undefine the scale (e.g. unlet time幸运飞艇超稳计划群), an arbitrary member of the remaining vectors becomes the new default scale.

See also setscale.

5.3.di Disto*: Perform a small-signal distortion analysis

General form:

     disto [ dec | oct | lin ] N Fstart Fstop [ F2OVERF1 ]

Perform a distortion analysis. See the previous sections of this manual for more details.

5.3.du Dump: Print node voltages

General form:

     dump

幸运飞艇超稳计划群this prints a diagnostic list of node voltages, and flags any which have not converged.

5.3.14 Echo: Print text

General form:

     echo [ -n ] [ text ... ]

echos the given text to the screen. if the first argument is -n the terminating newline is suppressed.

5.3.15 Edit*: Edit the current circuit

General form:

     edit [ file ]

Print the current Spice 3 input file into a file, call up the editor on that file and allow the user to modify it, and then read it back in, replacing the original file. If a filename is given, then edit that file and load it, making the circuit the current one.

5.3.16 Fourier: Perform a Fourier analysis

General form:

     fourier fundamental [ expression ...]

Performs a Fourier analysis of each expression given, reporting the first ten (including the DC component) multiples of the fundamental frequency (or the first nfreqs, if that variable is set - see below). The output is like that of the .FOUR analysis. The expression is commonly a vector name but may be any valid expression. The values are interpolated onto a fixed-space grid with the number of points given by the fourgridsize variable, or 200 if it is not set. The interpolation is of degree polydegree if that variable is set, or 1. If polydegree幸运飞艇超稳计划群 is 0, then no interpolation is done. However, this will give erroneous results if the time scale is not monotonic.

The Fourier analysis is performed over the interval <TSTOPperiod, TSTOP>, where TSTOP was the final time specified for the transient analysis, and period is one period of the fundamental frequency. For reasonable accuracy, the TMAX parameter (see tran) should be set to no greater than 0.1/(fundamental×nfreqs), and smaller for high-Q幸运飞艇超稳计划群 circuits.

See also the spec command.

5.3.ga Gather: Indexed read from a vector

General form:

      gather dst src map

Gather adds the elements of src specified by the vector map, which must be real-valued, to the destination dst. Values in map that exceed the bounds of src are ignored. Arguments are interpreted as 1-d vectors. If dst does not exist it is created with elements that are initially zero.

this command is useful because indexed access to vectors is relatively slow. for example, the code-equivalent of the scatter command:

        let n = min( length(map), length(dst) )
        let j = 0
        while ( j < n ) 
            if ( map[j] >= 0 )
                let dst[j] = dst[j] + src[ map[j] ]
            endif
            let j = j + 1
        endwhile

can take ca 1500 times as long to execute for large vectors.

See also the scatter and reshape commands.

5.3.17 Hardcopy: Save a plot to a file for printing

General form:

     hardcopy file plotargs

Just like plot, except creates a file called file containing the plot in the format specified by the variable hcopydevtype. The default file format is an image in format, and can be printed by either the [unix] plot(1) program or lpr(1) with the -g flag. The following variables modify the format of the output:

hcopydevIf this is set, when the hardcopy command is run the resulting file is automatically printed on the printer named hcopydev with the command lpr -Phcopydev -g file.
hcopydevtype This variable specifies the type of the printer output to use in the hardcopy command. The recognized types are:
  • plot5
  • postscript
  • svg
If variable hcopydevtype is not set, format is assumed. When used in conjunction with hcopydev, hcopydevtype should specify a format supported by the printer.
hcopyfont This variable specifies the font name for output plots. The value is used verbatim in the emitted PostScript and SVG but is ignored by the plot5 format.
hcopyfontsizeSets the font size in points to be used.
hcopyheightSets the height in points for the generated plot.
hcopypscolorEnables color PostScript generation when set.
hcopywidthSets the width in points for the generated plot

5.3.18 Help: Print summaries of Spice 3 commands

General form:

     help [all] [command ...]

Prints help. If the argument all is given, a short description of everything you could possibly type is printed. If commands are given, descriptions of those commands are printed. Otherwise help for only a few major commands is printed.

5.3.19 History: Review previous commands

General form:

     history [ -r ] [number]

Print out the history, or the last number commands typed at the keyboard.

Note: in Spice 3 version 3a7 and earlier, all commands (including ones read from files) were saved. The -r option reverses the printing order. [See also the appendix describing history substitutions in commands.]

5.3.20 Iplot*: Incremental plot

General form:

     iplot [ node ...]

Incrementally plot the values of the nodes while Spice 3 runs. The iplot command can be used with the where command to find trouble spots in a transient simulation; it is essentially a graphical version of trace. Several iplots may be active simulataneously. Iplotting is not applicable for all analyses. The status command displays a list of current iplots, and these can be removed with the delete command.

5.3.21 Jobs: List active asynchronous Spice runs

General form:

     jobs

Report on the asynchronous Spice-3 jobs currently running. Nutmeg checks to see if the jobs are finished every time you execute a command. If it is done then the data is loaded and becomes available.

5.3.22 Let: Assign a value to a vector

General form:

     let name = expr

Assigns the value specified by expr, an expression as described above, to the vector called name which is created in the current plot if it is not found. Individual elements of a vector may be modified by appending a subscript to name (e.g. name[0]). If there are no arguments, let is the same as display.

幸运飞艇超稳计划群[note: do not use the form

    MacSpice 4 -> myvec = 0.15 * yourvec

to abbreviate

 	MacSpice 4 -> let myvec = 0.15 * yourvec

because MacSpice will perform an unwanted and time-consuming search for commands and/or files matching 'myvec' before using the let幸运飞艇超稳计划群 command as the default behaviour.]

The command let creates a vector in the current plot, use setplot to create a new plot.

See also unlet, compose, and setplot.

5.3.23 Linearize*: Interpolate to a linear scale

General form:

     linearize [ vec ... ]

Create a new plot with all of the vectors in the current plot, or only those mentioned if arguments are given. The new vectors are interpolated onto a linear time scale, which is determined by the values of tstep, tstart, and tstop in the currently active transient analysis. The currently loaded input file must include a transient analysis (a tran command may be run interactively before the last reset, alternately), and the current plot must be from this transient analysis. This command is needed because Spice 3 doesn't output the results from a transient analysis in the same manner that Spice2 did.

5.3.24 Listing*: Print a listing of the current circuit

General form:

     listing [ logical | physical | deck ] [ expand ]

幸运飞艇超稳计划群 if the logical argument is given, the listing is with all continuation lines collapsed into one line, and if the physical argument is given the lines are printed out as they were found in the file. the default is logical. a deck listing is just like the physical listing, except without the line numbers it recreates the input file verbatim (except that it does not preserve case). if the word expand is present, the circuit is printed with all subcircuits expanded.

5.3.25 Load: Load rawfile data

General form:

     load [ filename ... ]

loads either binary or ascii format rawfile data from the files named. the default filename is rawspice.raw, or the argument to the '-r' flag if there was one when spice was invoked.

5.3.no Nodesets*: Create a file of .nodeset statements

General form:

     nodesets [ filename ]

save the state of the current analysis as a file of nodeset commands suitable for inclusion in a netlist. this is useful in cases where the operating point is difficult to find.

5.3.ns Noise*: Perform a noise analysis

General form:

     noise v(output [,ref]) src [ dec | lin | oct ] Pts Fstart Fstop [PPS]

Do an noise analysis. See the previous sections of this manual for more details.

5.3.26 Op*: Perform an operating point analysis

General form:

     op

Do an operating point analysis. See the previous sections of this manual for more details.

5.3.27 Plot: Plot values on the display

General form:

     plot exprs [ylimit ylo yhi] [xlimit xlo xhi] [xindices xilo xihi]
          [xcompress comp] [xdelta xdel] [ydelta ydel]
          [vs xname] [xlabel word] [ylabel word]
          [title word] [samep] [nointerp] [gridstyle] [plotstyle] 

Plot the given exprs on the screen (if you are on a graphics terminal). The xlimit and ylimit arguments determine the high and low x- and y-limits of the axes, respectively. The xindices arguments determine what range of points are to be plotted - everything between the xiloth point and the xihith point is plotted. The xcompress argument specifies that only one out of every comp points should be plotted. For linear axes, if an xdelta or a ydelta parameter is present, it specifies the spacing between grid lines on the x- and y-axis. These parameter names may be abbreviated to xl, yl, xind, xcomp, xdel, and ydel respectively.

The xname argument is an expression to use as the scale on the x-axis. The xlabel and ylabel幸运飞艇超稳计划群 arguments cause the specified labels to be used for the x- and y-axes, respectively.

If samep is given, the values of the other parameters (other than xname) from the previous plot, hardcopy, or asciiplot command is used unless re-defined on the command line.

The displayed curves are interpolated between points using a polynominal of degree polydegree if that variable is set, or 1. The nointerp keyword disables interpolation between points.

The title argument is used in the place of the plot name in the graph caption.

The plotstyle may be one of the following values:

linplotPlot points joined by lines.
pointplotPlot points using unjoined symbols.
multiplotPlot points using symbols joined by lines.
combplotPlot points by drawing a vertical line from each to the x-axis.

The gridstyle幸运飞艇超稳计划群 may be one of the following values:

lingridOverride a default log-scale plot, such as the output for an AC analysis, without tranforming the data.
linearSynonym for 'lingrid'.
xlogLogarithmic x-axis vs linear y-axis.
ylogLogarithmic y-axis vs linear x-axis.
loglogLogarithmic x- and y-axes.
smithSmith plot – data is transformed by the function (x−1)/(x+1).
smithgridPolar plot with a Smith grid but without transforming the data.
polarPlot the real and imaginary parts using polar coodinates.
nogridA linear plot with axis labels but no gridlines.

5.3.28 Print: Print values

General form:

     print [ col ] [ line ] expr [ expr2 ... ]

Prints the vector described by the expression expr. If the col argument is present, print the vectors named side by side. If line is given, the vectors are printed horizontally. col is the default, unless all the vectors named have a length of one, in which case line is the default. The options width, height, and nobreak are effective for this command (see asciiplot). If the expression is all, all of the vectors available are printed. Thus print col all > file prints everything in the file in Spice2 format. The scale vector (time, frequency) is always in the first column unless the variable noprintscale is true.

5.3.pz PZ: Pole-Zero Analysis

General form:

     pz node1 node2 node3 node4 { cur | vol } { pol | zer | pz } [ vector | scalar ]

Performs a pole-zero analysis of the current circuit, as described earlier.

5.3.29 Quit: Leave Spice 3 or Nutmeg

General form:

     quit

幸运飞艇超稳计划群quit nutmeg or spice.

5.3.30 Rehash: Reset internal hash tables

General form:

     rehash

Recalculate the internal hash tables used when looking up UNIX commands, and make all UNIX commands in the user's PATH available for command completion. This is useless unless you have set unixcom first (see below).

5.3.31 Reset*: Reset an analysis

General form:

     reset

Throw out any intermediate data in the circuit (e.g. after a breakpoint or after one or more analyses have been done already), and re-parse the input file. The circuit can then be re-run from its initial state, overriding the effect of any set or alter commands. In Spice-3e and earlier versions this was done automatically by the run command.

5.3.32 Reshape: Alter the dimensionality or dimensions of a vector

General form:

     reshape vector vector ...
     or
     reshape vector vector ...  [ dimension, dimension, ...  ]
     or
     reshape vector vector ... [ dimension ][ dimension ] ...

this command changes the dimensions of a vector or a set of vectors. the final dimension may be left off and it will be filled in automatically. if no dimensions are specified, then the dimensions of the first vector are copied to the other vectors.

the elements in a multidimensional vector are stored in row-major order. this command does not alter the order of values in memory, only the dimensions meta-data.

See also: transpose command.

5.3.33 Resume*: Continue a simulation after a stop

General form:

     resume

Resume a simulation after a stop or interruption (control-C).

5.3.34 Rspice: Remote Spice submission

General form:

     rspice [ input-file ... ]

Runs a Spice-3 remotely taking the input file as a Spice-3 input file, or the current circuit if no argument is given. Nutmeg or Spice 3 waits for the job to complete, and passes output from the remote job to the user's standard output. When the job is finished the data is loaded in as with aspice. If the variable rhost is set, nutmeg connects to this host instead of the default remote Spice 3 server machine. This command uses the "rsh" command and thereby requires authentication via a ".rhosts" file or other equivalent method. Note that "rsh" refers to the "remote shell" program, which may be "remsh" on your system; to override the default name of "rsh", set the variable remote_shell. If the variable rprogram幸运飞艇超稳计划群 is set, then rspice uses this as the pathname to the program to run on the remote system.

Note: rspice will not acknowledge elements that have been changed via the alter幸运飞艇超稳计划群 or altermod commands. [Note: Altermod is absent from many implemetations, use alter instead.]

5.3.35 Run*: Run analysis from the input file

General form:

     run [ rawfile ]

Run the analyses specified by dotcommands in the input file for the current circuit. If there are any of the control lines specified in Section 4.3 present they are executed. The output is put in rawfile if it is given, in addition to being available interactively. In Spice-3e and earlier versions, the input file would be re-read and any effects of the set or alter幸运飞艇超稳计划群 commands would be reversed. This is no longer the effect.

[Note. Interactive commands specified using the .control/.endc mechanism are not executed by this command.]

5.3.36 Rusage: Resource usage

General form:

     rusage [ resource ...]

幸运飞艇超稳计划群 print resource usage statistics. if any resources are given, just print the usage of that resource. most resources require that a circuit be loaded. currently valid resources are:

allEverything below.
elapsedElapsed wall-clock time since the last 'rusage elapsed' call.
totalelapsedTotal elapsed wall-clock time.
faultsNumber of page faults and context switches.
spaceData space used.
cputimeCPU time used since the last 'rusage cputime' call.
totalcputimeTotal CPU time used so far.
tempOperating temperature.
tnomTemperature at which device parameters were measured.
  
equationsCircuit Equations
timeTotal Analysis Time
totiterTotal iterations
acceptAccepted timepoints
rejectedRejected timepoints
  
loadtimeTime spent loading the circuit matrix and RHS.
reordertimeMatrix reordering time
lutimeL-U decomposition time
solvetimeMatrix solve time
  
trantimeTransient analysis time
tranpointsTransient timepoints
traniterTransient iterations
trancuritersTransient iterations for the last time point (listed incorrectly as "Transient iterations per point")
tranlutimeTransient L-U decomposition time
transolvetimeTransient matrix solve time
  
everythingAll of the above.

5.3.37 Save*: Save a set of outputs

General form:

      save [ all | output ...]

Save a set of output vectors, discarding the rest. If a node has been mentioned in a save command, it appears in the working plot after a run has completed, or in the rawfile if Spice is run in batch mode. If a node is traced or plotted (see below) it is also saved. For backward compatibility, if there are no save commands given, all outputs are saved.

When the keyword all appears in the save command, all default values (node voltages and voltage source currents) are saved in addition to any other values listed. See also the status and delete commands.

5.3.sc Scatter: Indexed write to a vector

General form:

      scatter dst map src

Scatter adds the elements of src to the locations in dst specified by the vector map, which must be real-valued. Values in map that exceed the bounds of dst are ignored. Arguments are interpreted as 1-d vectors. If dst does not exist it is created with elements that are initially zero.

this command is useful because indexed access to vectors is relatively slow. for example, the code-equivalent of the scatter command:

        let n = min( length(map), length(src) )
        let j = 0
        while ( j < n ) 
            if ( map[j] >= 0 )
                let dst[ map[j] ] = dst[ map[j] ] + src[j]
            endif
            let j = j + 1
        endwhile

can take ca 1500 times as long to execute for large vectors.

See also the gather and reshape commands.

5.3.38 Sens*: Run a sensitivity analysis

General form:

     sens output
     sens output ac [ dec | oct | lin ] N Fstart Fstop

Perform a sensitivity analysis. The variable output is either a node voltage (e.g. 'v(1)' or 'v(A,out)') or a current through a voltage source (e.g. 'i(vtest)'). The first form calculates DC sensitivities, the second form calculates AC sensitivities. The output values are in dimensions of change in output per unit change of input (as opposed to percent change in output or per percent change of input).

5.3.39 Set: Set the value of a variable

General form:

     set [ word ]
     set [ word = value ] ...

Set the value of word to be value幸运飞艇超稳计划群, if it is present. You can set any word to be any value, numeric or string. If no value is given then the value is the boolean 'true'.

The value of word may be inserted into a command by writing $word. If a variable is set to a list of values that are enclosed in parentheses (which must be separated from their values by white space), the value of the variable is the list.

The variables affecting Nutmeg are listed in the following section (5.5). The 'set' command can also be used to change simulator parameters for the current circuit (see setcirc below). Set values will be used (until the circuit is reset) when the current circuit is run and take precedence over a .options statement.

if no arguments are supplied, 'set' prints a list of current variables and their values. read-only variables are indicated by '*'. variables linked to the current circuit are indicated by '+'.

See also the discussion in appendix D.

5.3.40 Setcirc*: Change the current circuit

General form:

     setcirc [ cktname ]

Selects cktname as the 'current' circuit. When a circuit is loaded with the source command it is added to a list of available circuits and becomes the current circuit. The setcirc without an argument prints a menu of available circuits.

5.3.41 Setplot: Switch the current set of vectors

General form:

     setplot [ plotname ]

Set the current plot to the plot with the given name, or if no name is given, prompt the user with a menu. (Note that the plots are named as they are loaded, with names like tran1 or op2. These names are shown by the setplot and display commands and are used by diff, above.) If the plotname 'new' is selected, the current plot becomes one with no vectors defined and name 'unknown'.

幸运飞艇超稳计划群note that here the word "plot" refers to a group of vectors that are the result of one spice analysis run. when more than one file is loaded in, or more than one plot is present in one file, nutmeg keeps them separate and only shows you the vectors in the current plot.

5.3.ss Setscale: Set the scale vector for current plot

General form:

     setscale [ vector ]

幸运飞艇超稳计划群defines the default scale vector for the current plot. if no argument is given, the current default scale vector is printed.

5.3.42 Settype: Set the type of a vector

General form:

     settype type vector [ vector ... ]

幸运飞艇超稳计划群change the type of the named vectors to type.

MacSpice attempts to calculate the types of new vectors but the method used is not properly general. MacSpice only recognises simple combinations, e.g. multiplying a current vector by a voltage vector creates a power vector. The units associated with types are used when labelling graphs, and the dB() function inspects the type of its argument in order to infer whether to use the 10×log() or 20×log() definition.

types (and units if applicable) recognised by macspice are as follows:

notype time (s) frequency (Hz)
voltage (V) current (A) onoise-spectrum (X/Hz)
onoise-integrated (X) inoise-spectrum (X/Hz) inoise-integrated (X)
pole (Hz) zero (Hz) s-param
angle impedance (ohm) admittance (S)
power (W) decibel (dB) temperature (°C)

See also deftype幸运飞艇超稳计划群 above, and the .

5.3.43 Shell: Call the command interpreter

General form:

     shell [ command ]

Call the operating system's command interpreter; execute the specified command or call for interactive use.

5.3.44 Shift: Alter a list variable

General form:

     shift [ varname ] [ number ]

If varname is the name of a list variable, it is shifted to the left by number elements (i.e, the number leftmost elements are removed). The default varname is argv, and the default number is 1.

5.3.45 Show*: List device state

General form:

     show devices [ : parameters ] , ...

Old form:

     show -v @device [ [ name ] ]

The show command prints out tables summarizing the operating condition of selected devices (much like the Spice2 operation point summary). If device is missing, a default set of devices are listed, if device is a single letter, devices of that type are listed; if device is a subcircuit name (beginning and ending in ":") only devices in that subcircuit are shown (end the name in a double-":" to get devices within sub-subcircuits recursively). The second and third forms may be combined ("letter:subcircuit:") or "letter:subcircuit::") to select a specific type of device from a subcircuit. A device's full name may be specified to list only that device. Finally, devices may be selected by model by using the form "#modelname" or ":subcircuit#modelname" or "letter:subcircuit#modelname".

If no parameters are specified, the values for a standard set of parameters are listed. If the list of parameters contains a "+", the default set of parameters is listed along with any other specified parameters.

For both devices and parameters, the word "all" has the obvious meaning. Note: there must be spaces separating the ":" that divides the device list from the parameter list.

The "old form" (with "-v") prints the data in an older, more verbose pre-Spice 3f format.

5.3.46 Showmod*: List model parameter values

General form:

     showmod models [ : parameters ] , ...

The showmod command operates like the show command (above) but prints out model parameter values. Useful forms for models are a single letter specifying the device type letter, "letter:subckt:", "#modelname", ":subckt:#modelname", or "letter:subcircuit:#modelname".

5.3.47 Source: Read a Spice 3 input file

General form:

     source file

For Spice 3: Read the Spice 3 input file. Nutmeg and Spice 3 command blocks may be included in the file and control lines within these are executed immediately after the circuit is loaded. The first line in any input file is considered a title line and is not parsed but kept as the name of the circuit. (The exception to this rule is the file .spiceinit.) Thus, a Spice 3 command script begins with a blank line and then a .control幸运飞艇超稳计划群 line. Also, any line starting with the characters *# is considered a control line. This makes it possible to embed commands in Spice 3 input files that are ignored by Spice2 simulators.

For Nutmeg: Reads commands from the file filename幸运飞艇超稳计划群. Lines beginning with the character * are considered comments and ignored.

5.3.sp Spec: Create a frequency domain plot

General form:

     spec start_freq stop_freq step_freq vector [vector ...]

Calculates a new complex vector containing a Fourier analyisis of the input vector (typically the result of a transient analysis). By default, the calculation uses a Hanning window, but this can be changed by setting the variables specwindow and specwindoworder幸运飞艇超稳计划群 appropriately. Typical usage:

    MacSpice > set specwindow = "blackman"
    MacSpice > spec 10 1000000 1000 v(out)
    MacSpice > plot mag(v(out))

Possible values for specwindow are: hanning, cosine, rectangular, hamming, triangle, bartlet, blackman, gaussian. In the case of a gaussian window specwindoworder is a number specifying its order.

Internally, spec interpolates vectors onto a new timescale with equal steps chosen to be appropriate submultiples of the fundamental period 1.0/step_freq. If necessary, the end of the timescale is trimmed so that it is an exact multiple of the fundamental period. The order of the interpolating polynomial, which defaults to 3, can be modified by setting the value of specdegree.

For reasonable accuracy, the maximum interval between timepoints (the TMAX parameter specifies this in a tran analysis) should be no greater than 0.1/stop_freq, and smaller for high-Q幸运飞艇超稳计划群 circuits.

See also the fourier command, and the fft(vector)幸运飞艇超稳计划群 function.

[Note: A 'spec' command was not part of the original Berkeley Spice release. However, many implementations incorporate it in some form, usually based on source code published by Anthony Parker. The MacSpice implementation is a replacement for this with various technical improvements to its accuracy. Unlike the Parker version, MacSpice does not require a linearized plot.]

5.3.sr. Srandom: Set seed for random number generation

General form:

     srandom [seed]

The initial seed for random variates generated by MacSpice is generated by . If deterministic behaviour is required, e.g.幸运飞艇超稳计划群 for debugging, use this command to specify an integer seed value in decimal, octal, or hexadecimal format. Invoking srandom without an argument re-seeds the generator using srandomdev(3).

5.3.48 Status*: Display breakpoint information

General form:

     status
     status > file

Display all of the save, trace, iplot and breakpoint events currently in effect. If the output is redirected to a file, it is assumed that the intention is to re-import it later using the source command so the event numbers are omitted. See also the delete command.

5.3.49 Step*: Run a fixed number of timepoints

General form:

     step [ number ]

Iterate number幸运飞艇超稳计划群 times, or once, and then stop.

5.3.50 Stop*: Set a breakpoint

General form:

     stop [ after n ] [ when value cond value ] ...

Set a breakpoint. The argument 'after n' means stop after iteration number n, and the argument 'when value cond value' means stop when the first value is in the given relation with the second value, the possible relations being

gt >lt <ge >=
le <=ne <>eq =

IO redirection is disabled for the stop command, since the relational operations conflict with it (stop doesn't produce any output anyway). The values above may be node names in the running circuit, or real values. If more than one condition is given, e.g.

     stop after 4 when v(1) > 4 when  v(2) < 2

幸运飞艇超稳计划群, the conjunction of the conditions is implied.

See also status.

5.3.st Strcmp: Compare strings

General form:

     strcmp result str1 str2

The strcmp command compares two string variables str1 and str2 for equality and sets the variable result as follows:

0if they are equal
Negative integerif str1 < str2
Positive integerif str1 > str2

some spice 3 implementations consider "abc" to be equal to "abc".

5.3.51 Tf*: Run a Transfer Function analysis

General form:

     tf outvar ipsource

Examples:

     tf v(node1,node2) vsource
     tf i(vload) isource

The tf command performs a transfer function analysis, returning the transfer function (output/input), output resistance, and input resistance for the given output and input sources. The analysis assumes a small-signal DC (slowly varying) input.

5.3.52 Trace*: Trace nodes

General form:

     trace [ node ... ]

For every step of an analysis, the value of the node is printed. Several traces may be active at once. Tracing is not applicable for all analyses. To remove a trace, use the delete command.

5.3.53 Tran*: Perform a transient analysis

General form:

     tran Tstep Tstop [ Tstart [ Tmax ] ] [ uic ]

Perform a transient analysis. See the previous sections of this manual for more details.

5.3.54 Transpose: Swap the elements in a multi-dimensional data set

General form:

     transpose vector [ vector ... ]

This command transposes a multidimensional vector. No analysis in Spice 3 produces multidimensional vectors, although the DC transfer curve may be run with two varying sources. You must use the reshape幸运飞艇超稳计划群 command to reform the one-dimensional vectors into two dimensional vectors. In addition, the default scale may no longer be correct for plotting. For example (circuit to produce the transfer characteristic of a MOS transistor):

     Spice 3 > dc vgg 0 5 1 vdd 0 5 1
     Spice 3 > plot i(vdd)
     Spice 3 > reshape all [6,6]
     Spice 3 > transpose i(vdd) v(drain)
     Spice 3 > plot i(vdd) vs v(drain)[0]

5.3.55 Unalias: Retract an alias

General form:

     unalias [ word ... ]

Removes any aliases present for the words.

5.3.56 Undefine: Retract a definition

General form:

     undefine [ * | function [ function ... ] ]

definitions for the named user-defined functions are deleted. the argument '*' may be used to delete all definitions. if the same name has been used for several functions of differing arity then all of them will be deleted.

5.3.ul Unlet: Delete a vector

General form:

     unlet [ all | vector [ vector ... ] ]

Delete the specified vector(s). See also let.

5.3.57 Unset: Clear a variable

General form:

     unset word [ word ... ]

Clear the value of the specified variable(s) (word).

5.3.58 Version: Print the version of Spice

General form:

     version [ verid ]

Print out the version of nutmeg that is running. If there are arguments, it checks to make sure that the arguments match the current version of Spice. (This is mainly used as a Command: line in rawfiles.)

5.3.59 Where: Identify troublesome node or device

General form:

     where

When performing a transient or operating point analysis, the name of the last node or device to cause non-convergence is saved. The where command prints out this information so that you can examine the circuit and either correct the problem or make a bug report. You may do this either in the middle of a run or after the simulator has given up on the analysis. For transient simulation, the iplot command can be used to monitor the progress of the analysis. When the analysis slows down severly or hangs, interrupt the simulator (with control-C) and issue the where幸运飞艇超稳计划群 command. Note that only one node or device is printed; there may be problems with more than one node.

5.3.60 Write: Write data to a file

General form:

     write [ file [ expr ... ] ]

Writes out the expressions to file.

幸运飞艇超稳计划群 first, vectors are grouped together by plots, and written out as such (i.e, if the expression list contained three vectors from one plot and two from another, then two plots are written, one with three vectors and one with two). additionally, if the scale for a vector isn't present, it is automatically written out as well.

The default filename is rawspice.raw, or the argument to the '-r' flag on the command line, if there was one, and the default expression list is 'all'. The default format is ascii, but this can be changed by setting the filetype variable as follows:

asciiplain text format,
binarybinary64 format (IEEE-754) data with a text preamble,
tabbeduse a tab-separated column format with '\n' end of line characters,
mac_tabbeduse a tab-separated column format with '\r' end of line characters.

The tabbed and mac_tabbed formats are suitable for import into spreadsheet applications. The MacSpice load command is also compatible with these formats.

5.3.61 Xgraph: use the xgraph(1) program for plotting.

General form:

     xgraph file [ expr ... ] [ options ]

The Spice 3/nutmeg xgraph command plots data like the plot command but via幸运飞艇超稳计划群 xgraph, a popular X11 plotting program.

If file is either "temp" or "tmp" a temporary file is used to hold the data while being plotted. For available plot options, see the plot command. All options except for polar and Smith plots are supported.

5.4 CONTROL STRUCTURES

Control structures may be nested, of course. When a block is entered and the input is the terminal, the prompt becomes a number of >'s corresponding to the number of blocks the user has entered. The current control structures may be examined with the debugging command cdump. Control structures can be cleared by raising an interrupt, e.g. by typing ctrl-c.

Berkeley Spice 3 closes all control blocks with a universal 'end' statement, which makes non-trivial scripts tricky to write and maintain. MacSpice allows 'end' to be qualified with the type of block it is closing. Incorrect matching of these qualifiers will be flagged as syntax errors. The traditional readability aliases ('endif', 'endwhile', etc.) have been modified to include these qualifiers. Scripts using the qualified end statements are compatible with Berkeley Spice 3, which ignores the extra information.

5.4.1 While - End

General form:

     while condition
             statement
             ...
     end [ while ]

While condition幸运飞艇超稳计划群, an arbitrary algebraic expression, is non-zero, execute the statements.

5.4.2 Repeat - End

General form:

     repeat [ number ]
             statement
             ...
     end [ repeat ]

Execute the statements number times, or forever if no argument is given.

5.4.3 Dowhile - End

General form:

     dowhile condition
             statement
             ...
     end [ dowhile ]

The same as while, except that the condition is tested after the statements are executed.

5.4.4 Foreach - End

General form:

     foreach var value ...
             statement
             ...
     end [ foreach ]

The statements are executed once for each of the values, each time with the variable var set to the current one. (var can be accessed by the $var幸运飞艇超稳计划群 notation - see below).

5.4.5 If - Else - End

General form:

     if condition
             statement
             ...
     else
             statement
             ...
     end [ if ]

If the condition幸运飞艇超稳计划群 is non-zero then the first set of statements are executed, otherwise the second set. The else and the second set of statements may be omitted.

5.4.6 Label

General form:

     label word

If a statement of the form goto word幸运飞艇超稳计划群 is encountered, control is transferred to this point, otherwise this is a no-op.

5.4.7 Goto

General form:

     goto word

If a statement of the form label word is present in the block or an enclosing block, control is transferred there. Note that if the label is at the top level, it must be before the goto statement (i.e. a forward goto may occur only within a block). This limitation can be avoided by using the 'begin/end' structure:

    begin
        statement
        ...
    end [ begin ]

幸运飞艇超稳计划群this works because 'begin' is an alias for 'if (1)'.

5.4.8 Continue

     continue [ n ]

If there is a while, dowhile, repeat, or foreach block enclosing this statement, control passes to the test, or in the case of foreach, the next value is taken. Otherwise an error results. The optional argument n幸运飞艇超稳计划群, default value 1, specifies how many levels of enclosing blocks the statement affects.

5.4.9 Break

General form:

     break [ n ]

If there is a while, dowhile, repeat, or foreach enclosing this statement, control passes out of the block. Otherwise an error results. The optional argument n幸运飞艇超稳计划群, default value 1, specifies how many levels of enclosing blocks the statement affects.

5.4.10 Assert: Interrupt execution if a condition is not true

General form:

     assert condition

No action is taken if condition evaluates to 'true'. Otherwise an interrupt, equivalent to typing ctl-C at the console, is raised. This will cause scripts to issue a diagnostic message and, normally, abort.

5.4.11 User Interrupts

In MacSpice, user interrupts (e.g. by typing Command-'.') set the variable interrupt幸运飞艇超稳计划群. This allows scripts that repeatedly execute analyses to behave appropriately when interrupted. For example:

    begin
        ...
        unset interrupt
        while 1
            tran 1u 500u 0 4u
            if ($?interrupt)
                goto escape
            endif
        endwhile
        ...
        label escape
        ...
    end

The begin/end block in this example is explained in §5.4.7 above.

5.5 VARIABLES

The operation of both Nutmeg and Spice 3 may be affected by setting variables with the "set" command. In addition to the variables mentioned below, the set command in Spice 3 also affects the behaviour of the simulator via the options previously described under the section on ".OPTIONS".

The variables meaningful to nutmeg which may be altered by the set command are:
 

appendwriteAppend output to the rawfile, if one already exists, e.g. when a write command is issued.
colorNThese variables determine the colors used, if X is being run on a color display. N may be between 0 and 17. Color 0 is the background, color 1 is the grid and text color, and colors 2 through 17 are used in order for vectors plotted. The value of the color variables should be the RGB encoded colour, e.g. 'rgb:00/88/FF'.
consolebackgroundSets the background colour for the console window. The color represented by this variable is hex-encoded RGB, e.g. 'rgb:FF/FF/FF' for white.
consoleforegroundSets the foreground (i.e. font) colour for the console window. The color represented by this variable is hex-encoded RGB, e.g. 'rgb:00/00/FF' for blue.
cpdebugPrint command-interpreter debugging information.
debugIf set then a lot of debugging information is printed.
deviceThe name (/dev/tty??) of the graphics device. If this variable isn't set then the user's terminal is used. To do plotting on another monitor you probably have to set both the device and term variables. (If device is set to the name of a file, nutmeg dumps the graphics control codes into this file — this is useful for saving plots.)
dpolydegree If dpolydegree is N > 0, then the deriv() function fits a degree N polynomial to every set of N+1 points and uses their coefficients to calculate the derivative values. The default value is 2.
echoPrint out each command before it is executed.
fourgridsizeHow many points to use for interpolating into when doing Fourier analysis.
gridsizeIf this variable is set to an integer, this will be the number of equally spaced points to use for the X-axis when plotting. Otherwise, the current scale is used (which may not have equally spaced points). If the current scale isn't strictly monotonic, then this option has no effect.
gridstyleIf set, its value is used as the default gridstyle, refer to the description of the plot command for recognised values.
hcopy... The format of hardcopy output is controlled by variables with names beginning 'hcopy...'. These are described above in the hardcopy command section.
hcopydevIf this is set, when the hardcopy command is run the resulting file is automatically printed on the printer named hcopydev with the command lpr -Phcopydev -g file.
hcopydevtypeThis variable specifies the type of the printer output to use in the hardcopy command. If hcopydevtype is not set, format is assumed. The standard distribution currently recognizes postscript as an alternative output format. When used in conjunction with hcopydev, hcopydevtype should specify a format supported by the printer.
hcopyfontThis variable specifies the font name for hardcopy output plots. The value is device dependent.
hcopyfontsizeThis is a scaling factor for the font used in hardcopy plots.
heightThe length of the page for asciiplot and print col.
historyThe number of events to save in the history list.
interruptSet by user interrupts (i.e. typing Command-'.').
ipolydegree If ipolydegree is N > 0, then the integral() function fits a degree N polynomial to every set of N+1 points and uses their coefficients to calculate the integral values. The default value is 2.
linestyleN These variables determine the line-styles used for plots. The thickness and/or dash-pattern N may be between 0 and 19. The axes and grid use linestyle0 and linestyle1 respectively, linestyles 2 through to 17 are used in sequence for plotting vectors. For example,
  • set linetyle2 = 2
  • set linetyle3 = 4:1:1:1
  • set linetyle4 = 2/4:1:1:1
define a double-width (solid) line, a (single width) dash-space-dot-space pattern and a combined width and dash pattern. Linestyles scale with the pensize in use.
lprplot5This is a style format string used to specify the command to use for sending -style plots to a printer or plotter. The first parameter supplied is the printer name, the second parameter supplied is a file name containing the plot. Both parameters are strings. This is a style format string used to specify the command to use for sending plot(5)-style plots to a printer or plotter. It is trivial to cause Spice 3 to abort by supplying a unreasonable format string.
lprpsThis is a style format string used to specify the command to use for sending PostScript plots to a printer or plotter. The first parameter supplied is the printer name, the second parameter supplied is a file name containing the plot. Both parameters are strings. It is trivial to cause Spice 3 to abort by supplying an unreasonable format string.
noasciiplotvalueDon't print the first vector plotted to the left when doing an asciiplot.
nobreakDon't have asciiplot and print col break between pages.
noclobberDon't overwrite existing files when doing IO redirection.
noglobDon't expand the global characters '*', '?', '[', and ']'. This is the default.
nomoremodeIf nomoremode is not set, whenever a large amount of data is being printed to the screen (e.g, the print or asciiplot commands), the output is stopped every screenful and continues when a carriage return is typed. If nomoremode is set then data scrolls off the screen without check.
nonomatchIf noglob is unset and a global expression cannot be matched, use the global characters literally instead of complaining.
nopaddingDon't pad vectors with zeros to equalize lengths when writing rawfile output.
noprintscaleDon't print the scale in the leftmost column when a print col command is given.
nosortDon't have display sort the variable names.
numdgtThe number of significant digits to print when printing tables of data (fourier, print col). The default precision is 6 digits. If the value to be displayed is positive, an extra space or digit may be printed to ensure constant widths in tables. On MacOS, approximately 16 decimal digits are available using double precision, so numdgt should not normally be more than 15.
pensizeIf unset (or 0), the base pen-thickness used to draw is selected automatically and depends on the fontsize used for the graphs. This behaviour is overriden by 'set pensize = N' where 1≤N≤10 is measured in points.
plotstyleIf set, its value is used as the default plotstyle, refer to the description of the plot command for recognised values.
pointcharsdefines the symbols to be used for plotting points in a graph, e.g. 'set pointchars = "abc"'
polydegreeThe degree of the polynomial that the plot command should fit to the data. If polydegree is N, then nutmeg fits a degree N polynomial to every set of N+1 points and draws 10 intermediate points in between each endpoint. If the points aren't monotonic, then it tries rotating the curve and reducing the degree until a fit is achieved.
polystepsThe number of points to interpolate between every pair of points available when doing curve fitting. The default is 10.
processor Unless set to something by the user, returns one of the following values identifying the processor and memory architecture: PPC_32, PPC_64, i386, x86_64 and UNKNOWN. Additional values may be added in future.
programThe name of the current program (argv[0]).
promptThe prompt, with the character '!' replaced by the current event number.
rawfileThe default name for rawfiles created.
remote_shellOverrides the name used for generating rspice runs (default is "rsh").
rhostThe machine to use for remote Spice 3 runs, instead of the default one (see the description of the rspice command, below).
rprogramThe name of the remote program to use in the rspice command.
slowplotStop between each graph plotted and wait for the user to type return before continuing.
sourcepathA list of the directories to search when a source command is given. The default is the current directory and the standard Spice library (/usr/local/lib/spice, or whatever LIBPATH is #defined to in the Spice 3 source).
specdegree If specdegree is N > 0, then the spec command fits a degree N polynomial to every set of N+1 points and uses the interpolated values to calculate the spectrum. The default value is 3.
spicepathThe program to use for the aspice command. The default is /cad/bin/spice.
termThe mfb name of the current terminal.
ticlistA list of points to highlight with a mark on a linear plot.
ticmarks'set ticmarks = n' will highlight every nth point on a linear plot.
unitsIf this is unset, or set to radians, then functions will treat angles as being measured in radians. The default 'spinit' startup script sets it to degrees.
unixcomIf a command isn't defined, try to execute it as a UNIX command. Setting this option has the effect of giving a rehash command, above. This is useful for people who want to use nutmeg as a login shell.
unwraptolThe tolerance (default 0.25, value must be in the range [0,1]) used by the unwrap() function when deciding whether a jump is large enough to be a wrap.
vectorsUnless set to something by the user, returns a list of the vectors.
verboseBe verbose. This is midway between echo and debug / cpdebug. [Note: not implemented in Spice 3. CDHW]
widthThe width of the page for asciiplot and print col.
x11lineararcsSome X11 implementations have poor arc drawing. If you set this option, Spice 3 will plot using an approximation to the curve using straight lines.
xbrushheightThe height of the brush to use if X is being run.
xbrushwidthThe width of the brush to use if X is being run.
xfontThe name of the X font to use when plotting data and entering labels. The plot may not look good if this is a variable-width font.
$The current process (pid) number.

there are several set variables that spice 3 uses but nutmeg does not. they are:

editorThe editor to use for the edit command.
modelcardThe name of the model control line (normally .MODEL).
noaskquitDo not check to make sure that there are no circuits suspended and no plots unsaved. Normally Spice-3 warns the user when he tries to quit if this is the case.
nobjthackAssume that BJTs have 4 nodes.
noparseDon't attempt to parse input files when they are read in (useful for debugging). Of course, they cannot be run if they are not parsed.
nosubcktDon't expand subcircuits
renumberRenumber input lines when an input file has .INCLUDE's.
subendThe control line to end subcircuits (normally .ENDS).
subinvokeThe prefix to invoke subcircuits (normally X).
substartThe control line to begin subcircuits (normally .SUBCKT).

5.6 MISCELLANEOUS

If there are subcircuits in the input file, Spice 3 expands instances of them. A subcircuit is delimited by the control lines .SUBCKT and .ENDS, or whatever the value of the variables substart and subend is, respectively. An instance of a subcircuit is created by specifying a device with type 'X'; the device line is written

     Xname node1 node2 ... subcktname

where the nodes are the node names that replace the formal parameters on the .SUBCKT line. All nodes that are not formal parameters are prepended with the name given to the instance and a ':', as are the names of the devices in the subcircuit. If there are several nested subcircuits, node and device names look like subckt1:subckt2:...:name. If the variable subinvoke幸运飞艇超稳计划群 is set, then it is used as the prefix that specifies instances of subcircuits, instead of 'x'.

nutmeg occasionally checks to see if it is getting close to running out of space, and warns the user if this is the case. (this is more likely to be useful with the spice front end.)

C-shell type quoting with double-, single-, and back-quote substitution (e.g. "foo", 'foo', `foo`) may be used. Within single quotes, no further substitution (like history substitution) is done, and within double quotes, the words are kept together but further substitution is done. Any text between backquotes is replaced by the result of executing the text as a command to the shell.

Tenex-style ('set filec' in the 4.3 C-shell) command, filename, and keyword completion is possible: If EOF (control-D) is typed after the first character on the line, a list of the commands or possible arguments is printed (If it is alone on the line it exits nutmeg). If escape is typed, then nutmeg tries to complete what the user has already typed. To get a list of all commands, the user should type <space> ^D.

The values of variables may be used in commands by writing $varname where the value of the variable is to appear. The special variables $$ and $< refer to the process ID of the program and a line of input which is read from the terminal when the variable is evaluated, respectively. If a variable has a name of the form $&word, then word is considered a vector (see above), and its value is taken to be the value (rounded to numdgt figures) of the variable. If $foo is a valid variable, and is of type list, then the expression $foo[n] returns the nth element and $foo[low-high] represents a range of elements. Either the upper index or the lower may be left out, and the reverse of a list may be obtained with $foo[len-1]. Also, the notation $?foo evaluates to 1 if the variable foo is defined, 0 otherwise, and $#foo evaluates to the number of elements in foo if it is a list, 1 if it is a number or string, and 0 if it is a boolean variable. The notation $?&foo can be used to test whether a vector foo already exists.

History substitutions, similar to C-shell history substitutions, are also available – see Appendix D for all of the details.

The characters ~, {, and } have the same effects as they do in the C-Shell, i.e., home directory and alternative expansion. It is possible to use the wild-card characters *, ?, [, and ] also, but only if you unset noglob first. This makes them rather useless for typing algebraic expressions, so you should set noglob again after you are done with wild-card expansion. Note that the pattern [^abc] matchs all characters except a, b, and c.

IO redirection is available - the symbols >, >>, >&, >>&, and < have the same effects as in the C-shell.

You may type multiple commands on one line, separated by semicolons.

If you want to use a different mfbcap file than the default (usually ~cad/lib/mfbcap), you have to set the environment variable Spice_MFBCAP before you start nutmeg or Spice. The -m option and the mfbcap variable no longer work.

If X is being used, the cursor may be positioned at any point on the screen when the window is up and characters typed at the keyboard are added to the window at that point. The window may then be sent to a printer using the xpr(1) program.

Nutmeg can be run under VAX/VMS, as well as several other operating systems. Some features like command completion, expansion of *, ?, and [], backquote substitution, the shell command, and so forth do not work.

On some systems you have to respond to the -more- prompt during plot with a carriage return instead of any key as you can do on UNIX.

5.7 BUGS

the maximum length of an interactive command line is approximately 510 characters.

the 'print' command lists the elements of a multidimensional vector sequentially with a single index number.

the label entry facilities are primitive. you must be careful to type slowly when entering labels -- nutmeg checks for input once every second, and can get confused if characters arrive faster.

幸运飞艇超稳计划群 if you redefine colors after creating a plot window with x, and then cause the window to be redrawn, it does not redraw in the correct colors.

幸运飞艇超稳计划群 when defining aliases like

     alias pdb plot db( '!:1' - '!:2' )

you must be careful to quote the argument list substitutions in this manner. if you quote the whole argument it might not work properly.

In a user-defined function, the arguments cannot be part of a name that uses the plot.vec幸运飞艇超稳计划群 syntax. For example:

     define check(v(1)) cos(tran1.v(1))

does not work. another issue with user-defined functions is that a complex value formed with the ',' operator, such as (2,3), is misinterpreted as a pair of values when used as an argument.

If you type plot all all幸运飞艇超稳计划群, or otherwise use a wild-card reference for one plot twice in a command, the effect is unpredictable.

The asciiplot command doesn't deal with log scales or the delta keywords.

幸运飞艇超稳计划群 often the names of terminals recognized by mfb are different from those in /etc/termcap. thus you may have to reset your terminal type with the command

     set term = termname

where termname is the name in the mfbcap file.

the hardcopy command is useless on vms and other systems without the plot command, unless the user has a program that understands plot(5) format.

Spice 3 recognizes all the notations used in Spice2 .PLOT幸运飞艇超稳计划群 control lines, and translates vp(1) into ph(v(1)), and so forth. However, if there are spaces in these names it won't work. Hence v(1, 2) and (-.5, .5) aren't recognized.

BJTs can have either 3 or 4 nodes, which makes it difficult for the subcircuit expansion routines to decide what to rename. If the fourth parameter has been declared as a model name, then it is assumed that there are 3 nodes, otherwise it is considered a node. To disable this, you can set the variable "nobjthack" which forces BJTs to have 4 nodes (for the purposes of subcircuit expansion, at least).

The @name[param] notation might not work with trace, iplot, etc. yet.

幸运飞艇超稳计划群the first line of a command file (except for the .spiceinit file) should be a comment, otherwise spice may create an empty circuit.

幸运飞艇超稳计划群files specified on the command line are read before .spiceinit is read.

幸运飞艇pk10彩票 免费幸运飞艇计划手机 pk10微信群或者飞艇群 全天幸运飞艇精准计划 助赢幸运飞艇软件 天天幸运飞艇计划软件 北京pk10幸运飞艇直播 幸运飞艇 开奖b678甸vip 北京幸运飞艇开奖直播 幸运飞艇app下载 幸运飞艇【上恒达集团~HD161。COM~平台】 幸运飞艇【上恒达集团~HD161。COM~平台】 幸运飞艇【上恒达集团~HD161。COM~平台】 澳门百家乐【上恒达集团~HD161。COM~平台】 澳门百家乐【上恒达集团~HD161。COM~平台】 澳门百家乐【上恒达集团~HD161。COM~平台】 六合彩公司【上恒达集团~HD161。COM~平台】