next up previous contents index
Next: Explicit parameter setting Up: The sweep Command Previous: The sweep Command   Contents   Index

Without explicit device parameter setting

Assume in this section that the pstr1 and pstr2 parameter specification strings do not appear, then the the shell variables value1 and value2, which are accessible in the circuit as $value1 and $value2, are incremented, as in operating range analysis. This is the behavior of the historic loop command. As in operating range analysis, there are various related ways of introducing the variations.

  1. Perhaps the most direct method is to include the forms $value1 and $value2 (if two dimensional) for substitution in the current circuit. The variables will be replaced by the appropriate numerical values before each trial, as for shell variable substitution.

  2. If a variable named ``value1'' is set to a string token with the set command, then a variable of the same name as the string token will be incremented, instead of value1. The same applies to value2. Thus, for example, if the circuit contains expansion forms of the variables foo1 and foo2 (i.e., $foo1 and $foo2), one could perform a sweep analysis using these variables as

    set value1 = foo1 value2 = foo2
    sweep ...

  3. The method above allows the SPICE options to be iterated. These are the built-in keywords, which can be set with the set command or in a .options line in an input file, which control or provide parameters to the simulation.

    The most important example is temperature sweeping, using the temp option. A temperature sweep would look like

    set value1=temp
    sweep -50 50 25 analysis

    This will run the analysis at -50, -25, 0, 25, and 50 Celsius.

  4. If there are existing vectors named ``checkN1'' and (if two dimensions) ``checkN2'' that contain integer values, and the variable named ``value'' is set to the name of an existing vector (or a vector named ``value'' exists), then the vector components indexed by checkN1 and checkN2 will be iterated, if within the size of the vector. For example:

    let vec[10] = 0
    let checkN1 = 5 checkN2 = 6
    set value = vec
    sweep ...

    The first line creates a vector named ``vec'' of size sufficient to contain the indices. The iterated values will be placed in vec[5] and vec[6]. The circuit should reference these values, either through shell substitution (e.g., $&vec[5]) or directly as vectors.

    Alternatively, a variable named ``checkN1'' can be set. If the value of this variable is an integer, that integer will be used as the index. If the variable is a name token, then the index will be supplied by a vector of the given name. The same applies to checkN2. The following example illustrates these alternatives:

    let vec[10] = 0
    set checkN1 = 5
    let foo = 6
    set checkN2 = foo
    sweep ...

  5. Given that it is possible to set a vector as if a variable, by using the set command with the syntax

    set &vector = value

    it is possible to iterate vectors with the sweep command. The form above is equivalent to

    let vector = value

    Note, however, that the `&' character has special significance to the WRspice shell, so when this form is given on the command line the ampersand should be quoted, e.g., by preceding it with a backslash.

    Thus, suppose that the circuit depends on a vector named delta. One can set up iteration using this vector as

    set value1 = '&delta'
    sweep ...

  6. The construct above can be extended to ``special'' vectors, which enable device and model parameters to be set ahead of the next analysis. These special vectors have the form

    @devname[param]

    where devname is the name of a device or model in the circuit, and param is one of the parameter keywords for the device or model. These keywords can be listed with the show command.

    For example, if the circuit contains a MOS device m1 one might have

    set value1 = '&@m1[w]'
    sweep 1.0u 2.0u 0.25u analysis

    This will perform the analysis while varying the m1 w (device width) parameter from 1.0 to 2.0 microns in 0.25 micron increments.


next up previous contents index
Next: Explicit parameter setting Up: The sweep Command Previous: The sweep Command   Contents   Index
Stephen R. Whiteley 2017-11-08