The write command is used to save simulation data to a file.
write [file [expr ...]]There are two data formats universally available, the ``rawfile'' format native to WRspice and other simulators based on Berkeley SPICE3, and the Common Simulation Data Format (CSDF). The CSDF is one of the formats generated by HSPICE, and is compatible with post-processors such as Synopsys WaveView.
In the Red Hat 6 and 7 releases, a third output format is available: the Cadence PSF format. This support is provided through third-party libraries which support only the indicated operating systems. Unlike the other formats, PSF output can not be read back into WRspice. This format is used by the waveform viewer component of the Cadence Analog Design Environment (ADE) product.
PSF output consists of files created in a specified directory. Presently, output is available only for AC, DC, transient, and operating-point analysis. Only simple analysis is supported, no chained DC or looping.
To specify PSF output, one gives a ``filename'', for example to the write command or the rawfile variable, in the form
If this is simply ``psf'', output goes to a directory named psf in the current directory. Otherwise, the psf keyword can be followed by a `@' character and a path to a directory, with no white space around the @. Output will go to the indicated directory. In either case, the directory will be created if it doesn't exist, but in the second case and parent directories must currently exist, they won't be created.
If the file name is given an extension from among those listed below, CSDF output will be generated. Otherwise, rawfile format will be used.
.csdfThe N is an integer, and tr, ac, and sw correspond to transient, ac, and dc sweep results, respectively. This is the same convention as used by HSPICE when generating files for post-processing.
If no expr is given, then all vectors in the current plot will be written, the same as giving the word ``all'' as an expr. If, in addition, no file name is given, a default name will be used. The default name is the value of the rawfile variable if set, or the argument to the -r command line option if one was given, or ``rawspice.raw''.
The command writes out the exprs to the file. First, vectors are grouped together by plots, and written out as such. For example, if the expression list contained three vectors from one plot and two from another, then two plots will be 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 rawfile format is ASCII, but this may be changed with the filetype variable or the SPICE_ASCIIRAWFILE environment variable.
If the appendwrite variable is set, the data will be appended to an existing file.
Files that have been appended to, or have multiple plots, are concatenations of data for a single plot. This is expected and perfectly legitimate for rawfiles, and for CSDF files used only by WRspice, but concatenated CSDF files may not be portable to other applications.