VLSI Design Tools Manual SPCPP(1.VLSI) NAME spcpp - Spice (circuit simulator) input pre-processor SYNOPSIS spcpp [-c] [-sn] [-dlr] [-t tname] [-o oname] iname DESCRIPTION Spcpp is a program that translates bracketed text tokens in an input file into other text strings. It is intended to allow users of spice to prepare their simulation input using mnemonic node names rather than the numeric node numbers required by Spice commands. The program has two major modes of operation. If the user does not specify a file that con- tains a translation table, then spcpp builds a translation table itself numbering the tokens from zero as it encounters them. Alternatively, the user can specify the name of a file containing a translation table to be used. In particu- lar, the .names file created by sim2spice is usable as a translation table file. The options and parameters are: -c Indicates that the first non-whitespace word of each line of the translation table file should be skipped over. This is useful if your translation table has an asterisk ('*') in column 1 of each line to allow it to be read by spice as comments. -sn Indicates that n lines at the beginning of the translation table file should be skipped over. If no number is specified then only the first line of the file is skipped. -dlr Redefines the token delimiters to be 'l' and 'r' respectively. The default delimiters are '<' and '>'. -t tname Specifies a file that contains a translation table (default is to build a translation table as described above). Each line of this file should have at least two non-whitespace words on it. If the -c option is specified then the first word on each line is ignored. The next word is interpreted as a string to be translated and following one is interpreted as the target string into which it is translated. Any subsequent words on the line are ignored. For Spice input preparation the target string should be a numeral. The -s option allows the file to be prefaced by one or more lines that spcpp will ignore. Northwest LIS Release 3Last change: 7/15/88 1 VLSI Design Tools Manual SPCPP(1.VLSI) -o oname Specifies a file into which the output is to be written. If this option is not used then the out- put is written to iroot.spcx where iroot is obtained by stripping away any tags from iname. iname Specifies the name of the file to process. A bracketed token is defined to be a left delimiter charac- ter, zero or more spaces, a word (the token) not containing either right or left delimiters, zero or more spaces, and a right delimiter character. Unmatched delimiter characters are not allowed in any context. Bracketed tokens are not allowed to span lines. Tokens and the strings that they translate into are limited to be at most 40 characters each. Any line that contains no bracketed tokens is simply copied from the input to the output. If a line does contain a bracketed token then the input line is written into the out- put a Spice comment line. An output line follows immedi- ately. If the line is valid, then the output line has the untranslated parts immediately below the corresponding parts of the commented input line with the target strings substi- tuted for the bracketed tokens. If an error is detected, then the output line has a caret ('^') immediately below the point at which the first error is detected. An error mes- sage line then follows. Since the scanning of the line is abandoned there may be subsequent undetected errors in the remaining part of the line. Example: If the following lines are contained in the translation table file: Vdd 1 Input 55 Output 107 foo 23 bar 45 then spcpp will, upon seeing the lines: .plot trans v() v(), i() + v(), v() will output the lines: * .plot trans v() v() v() .plot trans v(55) v(107) v(1) * + v(), v() + v(23), v(45) Northwest LIS Release 3Last change: 7/15/88 2 VLSI Design Tools Manual SPCPP(1.VLSI) Note that spcpp correctly handles Spice continuation cards. Note also that the substitution process is not recur- sive. That is, once a token has been translated, the translated string is not rescanned. The usefulness of spcpp for simulating a circuit extracted from a layout depends upon the user being able to ensure that his mnemonic node labels will be retained through the extraction process. The mextra and sim2spice manual entries will help with this. Pspice is a shell script that runs sim2spice and spcpp and concatenates several files is useful for preparing Spice inputs from .sim files. FILES iname iroot.spcx oname tname SEE ALSO mextra(1.vlsi), pspice(1.vlsi), sim2spice(1.vlsi), sim- tools(1.vlsi), spice(1.vlsi), SPICE User's Guide, VLSI Design Tools Reference Manual, Northwest LIS, University of Washington, (SPICE Version 2G6 User's Guide, A. Vladimirescu et al., 15 October 1980) AUTHOR Robert Fowler (Northwest LIS, University of Washington) DIAGNOSTICS The error messages are intended to be self explanatory. If spcpp encounters a syntax error on a line then it suspends processing on that line and writes it as a Spice comment to the output file. It then writes a line containing a caret ('^') under the character at which scanning failed and finally, a line containing an error message. It then goes on to process the remaining lines of the file. If errors have been encountered then at the end of the output file spcpp writes messages to the effect that errors have been encountered and exits with status 1. The error messages written to the output file begin with dollar signs. In addition, some number of messages are directed towards the standard error output. BUGS Northwest LIS Release 3Last change: 7/15/88 3 VLSI Design Tools Manual SPCPP(1.VLSI) The target strings are not checked to see whether they are valid numerals or not. This can be regarded as either a bug or a feature. The target string must fit into the space from the left to right token delimiter inclusive. This is normally not a problem since most node numbers will be small integers and the available space will be at least three characters. This was done so that the input lines and the translated outputs would line up vertically. Northwest LIS Release 3Last change: 7/15/88 4