Since I don't know where you came from to get here,
I can't give you a link that will send you back.

Use the Back Button in your Browser to Go Back.

Spice things to remember.

I have invented my own representation of syntax which I feel if easier to understand than the usual one with parentheses, braces, and brackets. Each item in the line is represented by a capitol letter of the alphabet. Below is a list in which each letter is followed by a verbal explanation of the item.

Syntax of a Netlist Line.

A B1 B2 B3 etc. C ; D

  1. This is the ComponentCode consisting of one letter followed by a number. No embedded spaces.
    A few of the commonly used letters are listed below.
    I--Current source.
    K--Coupled Inductors.
    V--Voltage source.
    X--Sub Circuit. X may be followed by another letter such as U for a vacuum tube.
    23 of the letters of the alphabet are actually used. I have cut the list down to the ones you are most likely to need. Note: Don't try to memorize the above list. You will come to know the ones you use most often. These are likely to be capacitor, diode, inductor, resistor, and voltage source. The others you can look up as you need them. The complete list of all 23 component codes will be given at the end of this file.
  2. The list of nodes is as long as it needs to be for the particular component. For simple parts such as resistors, capacitors, and inductors the list is 2 nodes long and the order doesn't matter except for polarized capacitors where the order is positive, negative. For diodes the order does matter and it is anode cathode. For voltage and current sources the order is positive, negative. For bipolar transistors you would think that it should be three nodes but it is actually 4 to accommodate some transistors that do have 4 leads. The order is collector, base, emitter, and shield which is grounded except for npn4 in which the fourth lead is the cathode of a diode whose cathode is connected to the collector. All four versions of the MOSFET have 4 leads but in two of them the substraight is internally connected to the source. In the other two it is brought out to the fourth lead. The order is drain, gate, source, substraight, or no connection. JFETs and MESFETS have only three leads and the order is drain, gate, source.
  3. Value. For capacitors, resistors and inductors, the value is what you would expect, the number of farads, ohms, or henrys. For semiconductor devices the value is the type number such as 1N4148 or 2N3904. Numeric values may be followed by a multiplier character. These are f for femto, p for pico, n for nano, u for micro, m for milli, k for kilo, meg for mega, G for giga, and T for terra. In standard physics notation a lower case m is used for milli and an upper case M is used for mega. However, spice is not case sensitive. As you see it makes the distinction by m for milli and meg for mega. Additional letters to represent units are optional. F for farads, h for henrys, Hz for hertz, s for seconds etc. There doesn't seem to be a way to insert the omega symbol for ohms. +
  4. A comment must begin with a semicolon. They are optional but you should always include them. You may be tempted to leave out a comment because the only thing you can think of is obvious. Something that seems obvious today may not be so a year from now. Always put in comments. You will never regret putting in too many comments. On the other hand it is highly likely that you will live to regret not putting in enough comments.

Syntax of most often used spice directives. Including Necessary Generator Settings.

Frequency Response.

.ac A B C D

Spaces are used as the delimiters between parameters. That is why spaces cannot be embedded within a parameter. For example 1MegHz must never be written as 1 Meg Hz.
  1. The four types of sweep are Octave, Decade, Linear, and List.
    1. The Octave is a logarithmic sweep in which each cycle is an octave (2 to 1 frequency range). This one is most often used to plot the response of band pass filters. To get the complete picture of the behavior of such a filter the frequency response is often plotted from half of the center frequency to twice the center frequency of the filter. It might also be used by a designer of electronic musical instruments in which the octave of musical notes is an integral part of the performance of the device.
    2. The Decade sweep should be familiar to anyone who has ever plotted a graph on semi log graph paper. This is the common way of plotting the frequency response of an audio amplifier or any of its subsystems such as tone controls. The plot is logarithmic and each cycle covers a 10 to 1 frequency range. It is often seen in reviews of audio equipment and on rare occasions in manufacturer's data.
    3. The linear frequency plot is often how electronic neophytes try to plot frequency response. They quickly learn that it fails to give a clear picture of how the circuit behaves across its working frequency spectrum. There are occasions where it may be used for a plot of a narrow band filter which has a relatively high center frequency. For example the response of a 2 kHz wide filter which has a center frequency of 9 MHz.
    4. The list is useful in which an amplifier must have specific values of gain at specific frequencies. A spice directive is limited to 500 characters so the list can have as many frequencies as you can squeeze into this limit. However, there is a practical limit imposed by how many characters you can tolerate on the screen.
  2. Number of points. This is the number of points in an octave or decade for those kinds of sweeps. For a linear sweep it is the total number of points in the sweep. For a list this box is relabeled 1st frequency and is exactly that.
  3. This is the start, lowest, frequency of the frequency plot for Octave, Decade, and Linear. For a list it is labeled 2nd frequency and it is the second item in the list.
  4. this is the stop, highest, frequency for Octave, Decade, and linear sweeps. When list is selected it is the third frequency in the list.
Note: You can enter more than 3 frequencies in a list. You can type them in the syntax box at the bottom of the dialog. The limit is 500 characters but there is a practical limit imposed by the length of the spice directive line.

Generator Settings.

The generator must be set to 1 volt AC. This is 1 volt peak. It shows on the screen as "AC 1".To set this,
  1. Right click on the generator.
  2. Click the advanced button.
  3. Press the tab key until you hear "function sine". If you hear "function none" you are already in the right place so skip the next step and continue pressing the tab key.
  4. Press the up arrow twice and you will hear "none".
  5. Press tab some more until you hear "small signal AC analysis.".
  6. The cursor will be in the AC amplitude box.
  7. Type the number 1 and press enter.
  8. The voltage source will now be labeled AC 1.

Transient Response and Distortion.

.tran A B C

  1. The Start Time is not prompted for in the dialog box but it can be set to a nonzero value in the syntax box. It is the time in seconds at which the simulation starts.
  2. Stop Time is the time in seconds when the simulation ends.
  3. Start Saving Data is the time when data begins to be saved for display. This is used when it is desired to allow startup transients to decay in order to see steady state values.

.four A B
Example .four 1kHz V(out)

The Fourier directive is how spice calculates total harmonic distortion. It must be used in conjunction with the ".tran" directive and a sine wave generator. The Frequency parameter in the .four directive must be the same as that of the generator. Both are active on the screen at the same time. The results are found in the Spice Error Log which may be opened through the View menu.. It is a good idea to name the output node of the circuit "out".
  1. Frequency.
  2. Output Node Name.

Generator settings.


  1. DC Offset is a DC voltage that is added to the sine wave.
  2. Peak Volts is the peak, not RMS, voltage of the wave.
  3. Frequency is the number of cycles per second.
  4. Start Time Delay delays the start of the wave by the specified time in seconds.
  5. Time Constant. If this parameter is set to a nonzero value the wave will decay exponentially.
  6. Phase shift of the sine wave.
  7. Number of Cycles Generated. If entered as zero or omitted, generator runs for duration of simulation.


  1. Low Level (Volts).
  2. High Level (Volts).
  3. Delay. Time before wave starts. (Seconds).
  4. Rise Time (Seconds).
  5. Fall Time (Seconds).
  6. Length of time pulse is high. Half the period for a square wave (Seconds).
  7. Period. 1/frequency (Seconds).
  8. Number of Cycles Generated. If entered as zero or omitted, generator runs for duration of simulation.


  1. Low Level (Volts).
  2. High Level (Volts).
  3. Rise Delay. Time at which wave starts rising. (Seconds).
  4. Time Constant of Rise (Seconds).
  5. Fall Delay. Time at which wave begins to fall. (Seconds).
  6. Time Constant of fall (Seconds).
Value E MUST be larger than value C. If D = E - C and D=0, an interesting wave results. This wave cannot be made to repeat. It only happens once per simulation.
The rises and falls are of the form f(x) = 1 - e- Τ x.

SFFM(A B C D E). Frequency Modulation.

  1. DC Offset. (Volts).
  2. Peak Amplitude. (Volts).
  3. Carrier Frequency, (Hertz).
  4. Modulation Index. This quantity is Deviation / Signal Frequency.
  5. Signal Frequency, (Hertz).
If you want to be able to see the frequency modulation, don't set the carrier frequency so high relative to the simulation time that you can't resolve individual cycles in the graph window.

Two More Functions.

The remaining two functions are both called PWL. I don't know what the PW stands for but I'm pretty sure that the L stands for list. The first one prompts for a list of coordinates that describe a function. The second one prompts for the name of a file that contains the list of coordinates. Either way it sounds like a hard way to make a living.

Stepping and Sweeping.

The distinction between stepping and sweeping is a fine one. Because the computer is digital so is the program. So strictly speaking everything is stepping. When the steps become "small enough" a stepped value turns into a swept value. I am not going to make any attempt to define "small enough". When the difference is obvious I will use "stepping" and "sweeping" appropriately. For the middle gray area, all bets are off.

Stepping Passive Component Values.

The passive component you want to step must be properly labeled. In place of the value it must have a name which is enclosed in braces. For example {R1}. This can be the same as the component designator but it doesn't have to be. You could use anything including your girlfriend's initials if you wanted to.

This directive has 3 different syntaxes depending on which nature of sweep is selected. A separate line will be given for each one along with an example.

.step param A B C D
Example .step param R2 1 10001 2k

  1. Component name Without the braces.
  2. Start Value.
  3. End Value.
  4. Increment, added to previous value.
Note that the word "Linear" does not appear in the syntax.

Octave and Decade.
.step A param B C D
.step oct param R2 1k 32k 1

  1. Type or nature of sweep.
  2. Component name Without the braces.
  3. Start Value.
  4. End Value.
  5. Number of points per, Octave or Decade.

When a similar syntax was used for graphing frequency response you used a large number of points to get a smooth curve. But this is stepping the value of a component. The simulation is run once for each step. You don't want to sit around while the simulation runs 200 times and the graph window gets colored in solidly with overlapping lines. In the example, 1k to 32k covers 5 octaves. That is about the maximum number of curves you would want on a graph. So the final value is 1 per octave. When using a decade step you might want 2 or 3 points per decade but certainly no more.

.step param A B C1 C2 etc.
.step param R2 list 2.5k 6.67k 15k 40k

  1. Component name Without the braces.
  2. Type or nature of sweep.
  3. Items in list separated by spaces.

Sweeping Voltage and Current Sources.

You can use ".step" to step or sweep a voltage or current source but it must be done in conjunction with another directive such as ".ac" or ".tran". The ".DC" directive can stand alone on the schematic or in the netlist to cause a source to step or sweep.

.dc A B C D
.dc V1 0 500 1

  1. Source to be swept.
  2. Start Value.
  3. Stop Value.
  4. Increment.

Octave and Decade.
.dc A B C D E
.dc dec V1 5 500 400

  1. Type or nature of sweep.
  2. Source to be swept.
  3. Start value.
  4. End value.
  5. Number of points per Octave or Decade.

.dc A B C1 C2 etc.
.dc V1 list 100 250 350

  1. Source to be stepped.
  2. Type or nature of sweep.
  3. Items in list separated by spaces.

Here is a complete list of the component codes.
When they appear as the first character in a netlist line
they tell spice what component is being entered in that line.

This page last updated March 10, 2020.


Since I don't know where you came from to get here,
I can't give you a link that will send you back.

Use the Back Button in your Browser to Go Back.