next up previous contents index
Next: Help Database Files Up: File Formats Previous: File Formats   Contents   Index


Rawfile Format

Rawfiles produced and read by WRspice have either an ASCII or a binary format. ASCII format is the preferred format for general use, as it is hardware independent and easy to modify, though the binary format is the most economical in terms of space and speed of access.

The ASCII format consists of lines or sets of lines introduced by a keyword. The Title and Date lines should be the first in the file and should occur only once. There may be any number of plots in the file, each one beginning with the Plotname, Flags, No. Variables, No. Points, Variables, and Values lines. The Command and Option lines are optional and may occur anywhere between the Plotname and Values lines. Note that after the Variables keyword there must be numvars ``declarations'' of outputs, and after the Values keyword, there must be numpoints lines, each consisting of numvars values. To clarify this discussion, one should create an ASCII rawfile with WRspice and examine it.

Line Name Description
Title An arbitrary string describing the circuit
Date A free-format date string
Plotname A string describing the analysis type
Flags Either ``complex'' or ``real''
No. Variables The number of variables (numvars)
No. Points The number of points (numpoints)
Command An arbitrary WRspice command
Option WRspice variables
Variables A number of variable lines (see below)
Values A number of data lines (see below)
Any text on a Command line is executed when the file is loaded as if it were typed as a command. By default, WRspice puts a version command into every rawfile it creates.

Text on an Option line is parsed as if it were the arguments to a WRspice set command. The variables set are then available normally, except that they are read-only and are associated with the plot.

A Variable line looks like

number name typename [ parm=value ] ....
The number field is ignored by WRspice. The name is the name by which this quantity will be referenced in WRspice. The typename may be either a pre-defined type from the table below, or one defined with the deftype command.

Name Description SPICE2 Numeric Code
notype Dimensionless value 0
time Time 1
frequency Frequency 2
voltage Voltage 3
current Current 4
output-noise SPICE2 .noise result 5
input-noise SPICE2 .noise result 6
HD2 SPICE2 .disto result 7
HD3 SPICE2 .disto result 8
DIM2 SPICE2 .disto result 9
SIM2 SPICE2 .disto result 10
DIM3 SPICE2 .disto result 11
pole SPICE3 pz result 12
zero SPICE3 pz result 13

The (optional) parm keywords and values follow. The known parameter names are listed in the table below.

Name Description
min Minimum significant value for this output
max Maximum significant value for this output
color The name of a color to use for this value
scale The name of another output to use as the scale
grid The type of grid to use - numeric codes are:
        0 Linear grid
        1 Log-log grid
        2 X-log/Y-linear grid
        3 X-linear/Y-log grid
        4 Polar grid
        5 Smith grid
plot The plotting style to use - numeric codes are:
        0 Connected points
        1 ``Comb'' style
        2 Unconnected points
dims The dimensions of this vector - not fully supported

If the flags value is complex, the points look like r,i where r and i are exponential floating point format. Otherwise they are real values in exponential format. Only one of real and complex should appear.

The lines are guaranteed to be less than 80 columns wide, unless the plot title or variable names are very long, or a large number of variable options are given.

The binary format is similar to the ASCII format in organization, except that it is not text-mode. Strings are NULL terminated instead of newline terminated, and the values are in the machine's double precision floating point format instead of in ASCII. This makes it much easier to read and write and reduces file size, but the binary format is not portable between machines with different floating point formats.

The circuit title, date, and analysis type name in that order are at the start of the plot, each terminated by a NULL byte. Then the flags field (a short, which is 1 for real data and 2 for complex data), the number of outputs, and the number of points (both integers) are present. Following this is a list of NULL-terminated strings which are command lines. This list is terminated by an extra NULL byte. Then come the options, which consist of the name, followed by the type and the value in binary. The output ``declarations'' consist of the name, type code, flags, color, grid type, plot type, and dimension information in that order. Next come the values, which are either doubles or pairs of doubles in the case of complex data.

The ``old'' binary format, which is used by SPICE2, is not accepted by WRspice, however the format is given below should it be necessary to write a translator.

SPICE2 Binary Rawfile Format
Field Size in Bytes
title 80
date 8
time 8
numoutputs 2
the integer 4 2
output names 8 for each output
types of output 2 for each output
node index 2 for each output
plot title 24
data numpoints * numoutputs * 8

The data are in the form of double precision numbers, or pairs of single precision numbers if the data are complex.

The values recognized for the ``types of output'' fields are listed in the data types (top) table above as the ``SPICE2 Numeric Code''.


next up previous contents index
Next: Help Database Files Up: File Formats Previous: File Formats   Contents   Index
Stephen R. Whiteley 2017-10-02