Manuals >spicent >Chapter 3: Advanced Methods for Importing a SPICE File
Print version of this Book (PDF file)
prevnext

Importing a SPICE File from the Command Line

This section describes the details of setting up and operating the SPICE Netlist Translator from the command line.


Note    It is recommended that only advanced users attempt to import SPICE files from the command line since it requires knowledge of setting environment variables and working in a UNIX shell or DOS window.

Setting up the spctoiff Command

To set up the spctoiff program for use from the command line:

For Windows platforms:
  1. Open an MSDOS shell.

  2. Set your $HPEESOF_DIR environment variable to your ADS installation directory. For example,

    set HPEESOF_DIR=<ADS_install_dir>

  3. Set your PATH environment variable to include the $HPEESOF_DIR\bin directory. For example,

    set path=C:\AdvDesSys1.5\bin;%path%

  4. Set the appropriate library path for your operating system. For example,

    set shlib_path=$shlib_path:$HPEESOF_DIR\lib\win

For UNIX platforms:
  1. Set your $HPEESOF_DIR environment variable to your ADS installation directory. For example, if using the Korn shell enter,

    export HPEESOF_DIR=<ADS_install_dir>

  2. Set your PATH environment variable to include the $HPEESOF_DIR/bin directory. For example, if using the Korn shell enter,

    export PATH=$HPEESOF_DIR/bin:$PATH

  3. Set the appropriate library path for your operating system.

For HPUX operating systems (i.e. hpux10 or hpux11), enter the following:

SHLIB_PATH=$SHLIB_PATH:$HPEESOF_DIR/lib/hpux10

OR

SHLIB_PATH=$SHLIB_PATH:$HPEESOF_DIR/lib/hpux11

For SUN operating systems (i.e. sun4 or sun55), enter the following:

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HPEESOF_DIR/lib/sun4

OR

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HPEESOF_DIR/lib/sun55

For AIX operating systems (i.e.aix4), enter the following:

LIBPATH=$LIBPATH:$HPEESOF_DIR/lib/aix4

Executing the spctoiff Command

The spctoiff command uses the following general syntax:

spctoiff input_filename output_filename -{s2|s3|p|h} -{g|u|w} [-l] [-n]

Simply entering spctoiff at the command line with no options displays a detailed spctoiff usage message. Entering the spctoiff -v command displays the translator version, while entering spctoiff -adv displays the syntax for the advanced options. Table 3-1 displays a listing of all parameters and definitions used by the spctoiff command.

Table 3-1. Parameter Definitions for spctoiff

Parameter

Definition

input_filename
The name of the SPICE file to read in.
output_filename
The name of the IFF or netlist file to write.

Input file type

Definition

-s2
Berkeley SPICE (2g6)
-s3
Berkeley SPICE (3c, 3e, 3f)
-p
PSpice
-h
HSpice

Output options

Definition

-g
Create ADS netlist
-u
Create schematic w/o wires (uses named connections)
-w
Create schematic w/wires (not recommended on large circuits)

Other options

Definition

-l
First line is not a comment (used for library files or model include files)
-n
Do not perform any name mapping for conflict avoidance. The only mapping performed now is invalid characters and upper to lower case.
-v
Return the version of the SPICE Translator
-adv
View advanced options

Advanced options

Definition (available from command line only)

-k
Create subcircuits for models at top level (used for library files or model include files)
-sc
Suppress comments
-wrap <int>
Line length to perform line wrapping at (must be greater than 10, default=80.
-m mapfile
Mapping file for user-defined components
-models
Read HSpice Model Library and output one file per .LIB/.END pair. Suppresses nested .LIB statements. output_filename should be a file extension only. Designed for translation of foundry model files and intended for ADS netlist output only.
ex: spctoiff mix025.l net -h -g -models
-u2
Create schematic w/o wires (uses named connections). Named Connections are read from log file so custom symbols can be used. If connections are not made, load ael file spcutil.ael and run ael macro spctoiff_connect_pins("wireLabels.log"). The spcutil.ael file can be found under $HPEESOF_DIR/links/spice/spcutil.ael.

Enter the appropriate spctoiff command from the command line to translate your SPICE file. Once the spctoiff command is complete you can view the output.

Additional Options Information

Using the -n Option

The -n option should be used carefully if you have mixed cases in your SPICE file. While SPICE is case insensitive, ADS is case sensitive. If the -n option is used, names are not mapped to the lower case. If case mixing was used in the SPICE file, the variable, instance and model names will not be converted to lower case, resulting in multiple definitions in ADS. For more information on case sensitivity and name mapping, refer to Understanding Capitalization.

Using the -models Option

An HSpice library or model file can consist of hundreds of models, defined within a .LIB section. Each .LIB section defines one model, which may consist of a complete subcircuit. If this library file is referenced by a SPICE circuit file, only the libraries that are used will be translated. However, the user may want to translate the complete model library to a set of ADS netlist files. The -models option is available for this purpose.

To translate the complete model library in a file called mix025.l, invoke the translator from a shell command line as shown in the following example.

spctoiff mix025.l net -h -g -models

The HSpice file is read, and for every .LIB section found in the library file, one ADS netlist file is output. The name of the library which is specified in the .LIB statement becomes the name of the ADS netlist file. An extension is given on the command line when the translator is invoked, and this is appended to the file name. In this case, the file extension is net. A library designated by .LIB resistor will be translated to an ADS netlist file called resistor.net.

Using the -u2 Option

When the -u option is used, connections in a schematic are made by naming nodes. This is done by placing a node name on each pin. The translator makes these connections by reading a configuration file that contains pin locations for all the element symbols that the translator uses. Subcircuit symbols are plain boxes with the appropriate number of leads and pins on them.

If you have defined a custom symbol for any element, and the pins are not in the location expected by the translator, some of the pins may not be named. Unconnected pins show up as red diamonds in the schematic. This will most likely happen when a custom library part exists in ADS and is referred to in a SPICE file. The translator does not create the subcircuit but is expected to connect to it.

When the correct pin information isn't available to the translator in the spctoiff.cfg file, use the -u2 option from the command line as shown in the following example.

spctoiff file.sp file.iff -h -u2

The translator will output the IFF file file.iff and another file named wireLabels.log. Import the IFF file from the user interface (refer to, Importing an IFF File). This will create a schematic with no connections. To complete the connections, make sure the component placement is satisfactory. There should be sufficient room between each component to display the parameters and the node names. Save all designs in which you made changes.

Make sure the file wireLabels.log is in your project directory and enter the following commands on the AEL command line,

load(strcat (HPEESOF_DIR, "links/spice/spcutil.ael"));

spctoiff_connect_pins("wireLabels.log")

When the macro is done running, the pins will all be labeled with node names and all connections will be made as specified in the SPICE file.

Checking the SPICE Netlist Translator Version Number

To determine the version of the SPICE Netlist Translator that you are running,

  1. Open a UNIX or DOS shell.

  2. Ensure your environment variables are set correctly. For more information on setting environment variables, refer to Setting up the spctoiff Command.

  3. Enter the following command:

    spctoiff -v

The SPICE Netlist Translator displays the version number.

ADS Spice Translator, version <version_number>

Where <version_number> is the actual version number of the translator.


Note    If the translator returned Spice Translator, (*) 130.xxx, (where xxx is a number such as 400) refer to Appendix A, Using the SPICE Netlist Translator in ADS 1.3 for additional information.

Viewing the Translation Log

The SPICE to IFF translation log (see Table 3-2) contains important information about the netlist translation, including any error or warning messages recorded during the import operation. The translation log can be viewed using any ASCII text editor. To view the translation log file, open your text editor and load spctoiff.log.

If your log file displays any error or warning messages generated by the translator, refer to Troubleshooting. Using a combination of the information in the log file and the information provided in the troubleshooting section, edit your translated netlist and save the new netlist with your corrections.

Since the translation log is an ASCII based text file, you can easily save the file with a new name using the File > Save As command for future reference.

Table 3-2. Example Translation Log File (spctoiff.log)
SPICE to IFF translation log


Input format: PSpice
Input filename: ex1.sp


Output format: ADS Netlist file
Output filename: ex1.net


Special options:
Processing first line as comment.


Begin translation at Thu Aug 31 10:16:00 2000


Creating netlist.
Reading item definition file "spctoiff.cfg"


Translation completed at Thu Aug 31 10:16:03 2000.


Note    The SPICE to IFF translation log file (spctoiff.log) is over-written each time a new translation is performed. To avoid over-writing the log file, save it with a new file name.

prevnext