Getting Started With HSPICE


This page will help with beginning HSPICE: file types and formats, notation, hints, and other general hSPICE information.


Index:


Return to the HSPICE Help Page.


General Info

SPICE was orginally christened CANCER and was developed by Larry Nagel in the late 1960's. The program was able to simulate only resisters, capacitors, and inductors, Bipolar diodes, and tansistors. Since then, SPICE has been expanded to handle MOS, JFET's, and subcircuits.

The history of HSPICE includes:

What does SPICE mean?

----Return to Index----

HSPICE Files

Suffixes:

HSPICE has many files that it can take as input or produce. These files must contain these suffixes:

File Descriptions:

Netlist file (.sp)
The netlist file is your input file. This file contains your circuit description and all options and analysis you wish HSPICE deal with. The structure of the file looks like this:

	title			-Implicit first line; becomes netlist file title
	.options		-set conditions for simulation
	ANALYSIS and TEMP	-statements to sweep vaiables
	.print/.plot/Analysis	-set print, plot, and analysis variables
	.initial conditions	-input state of system
	sources			-stimulus
	netlist			-circuit descriptions
	.model libraries	-.lib and .inc
	.end			-terminates the simutlation
Note: This is just a suggested structure. Though the title always comes first and .end always comes last, the rest can come in any order in between. Another popular structure that is more implicit is to put the analysis statements after the circuit descriptions.

An example Netlist structure:

This is a netlist		$must have a title line
.options post acct opts node	$HPSICE options

l6	6	16	.05	$indcutor 
c6	16	0	.05	$capacitor
r16	16	0	40	$resistor
c4	4	14	.1	$another capacitor
l5	data	15	1	$another inductor
c5	15	0	.2	$another capacitor

v4	4	0	dc 0 ac 0 0 pulse 0 1 0 .15 .15 .4 2	$voltage source
vdata	data	0	sin(1.0 1.0 1.0 0.0 1.0)		$voltage source
v6	6	0	exp(1 0.1 .02 .6 .2)			$voltage source

.model ...			$models and subckts

.tran	.1 5			$transient analysis
.print	v(6) i(r16)		$print statement
.plot	v(4) v(14) v(data)	$plot statement

.end				$Must have an end

Another example of a bjt amplifier bias by a voltage divider is given in bjtamp.sp.

Design configuration (.cfg)
Configuration files are used by HSPICE, GSI and HSPLOT to describe the available terminals and hardcopy devices. There is already a default .cfg file (meta.cfg) that already has all the printer and terminal types used at the ECE labs so it is unlikely that this file will need to be created.

Initialization (hspice.ini)
The initialization file deals primarily with setting up HSPICE itself and has no need to be modified by users.

Run status (.st0)
The run statuts file keeps track of all that HSPICE preforms on a netlist file. Since no results are stored here, just execution steps, this file is not very useful and can be deleted without any great loss to a user. The does sometimes offer small benefit for debugging purposes as it can show which steps were not preformed by HSPICE.

A run status file from the bjt example is listed in bjtamp.st0.

Output listing (.lis)
This is one of the most important files in HSPICE as this file lists all results obtained from the simulation. This file contains (in order of listing in the file):
  1. HSPICE licensing information
  2. Listing of the circuit
  3. Results form the analysis of the circuit (.op, .print, .plot, .measure, .ac, and .tran in order of their appearance in the netlist file)

The .lis file for the bjt ampliphier netlist above is shown in bjtamp.lis.

Graph data files (.tr#, .sw#, .ac#)
Graph data files are created by .OPTION POST command and contain the data to graphed by HSPLOT, GSI, or HSPICE. Basically these files retain the data to be graphed from the .lis file in a different graphing format.

Measure output (.m*#)
The measure output file hold the result from .MEASURE commands. These files arn't very useful either as the data is hard to read and already exits in a nicely formated way in the .lis file.

An example .m*# file from the bjt ampliphier example of above is displayed in bjtamp.ma0.

----Return to Index----

Netlist Notation:

Naming conventions:

Every node and element within the HSPICE netlist must have its own unique name. These names can exist of the following:

HSPICE units:

HSPICE is a smart program and will automatically assign ohms to resistors, Farads to capacitors, and Henries to inductors. However, it is not written that you must trust HSPICE and so the units can be manually assigned by: The scaling for the all units in HSPICE is done by: Note: Capitals do not matter (e.g. F=f and M=m), therefore many people have problems with M and MEG. Please be careful with these two units!

Global Variables:

Essentially globals are used most often for subcircuits, though they are great for sources. This way all power sources do not have to be separately defined.

Misc. Syntax:

In general , HSPICE notation is very simple. All statements beginning with a <.> are commands (e.g. .OPTION, .PRINT, .AC, etc.) while those that don't are treated as elements (e.g. r51, cc, lload, etc). There are, however, a few special commands: Examples of these can be found in the BJT ampliphier example bjtamp.sp. Here the .OPTION command is extended for four lines and the end of line comment is used after the .MEASURE commands. Notice too that by using tabs for the elements and their nodes, it makes the netlist much easier to read. It is not required that tabs be used, but it is very helpful.

Algebraic Syntax:

HSPICE also has the added benefit of being able to do some algebriac manipulation of some variables. The variables can be user defined or just the volatages and currents at nodes (e.g. v(1), I(q2), etc.). Also the algebra must be enclosed within single quotes (see examples below). The algebraic functions used by HSPICE in addition to (+,-,*,/) are as follows:

Some examples of using algebaic functions in HSPICE are:

Topology Rules:

It is important to know when constructing the circuit description that HSPICE will not allow certain topologies. It will not allow:

----Return to Index----

HSPICE Hints:

There are two main hints to keep in mind when using HSPICE, they are:
  1. Know what to expect from the simulation BEFORE running it!!!
  2. Simulation is NO substitute for THINKING.
Even though these hints are not always followed, they are good guidlines to use. For instance, if you run a simulation on a circuit that you know has a gain of around 100db and get 1db, it is easily to assume that an error exists in the netlist of the circuit. On the other hand, if a result of 1db is returned and the actual is not known, it can easily be assumed to be correct when an error actually exits in the netlist!!

Other helpful hints are these:

  1. It is not required to use one of HSPICE's graphing programs. One of the most common ways is to extract the graphing data from the .lis file using scripts and then use Matlab to graph the data. For a more complete discription of the process check out the graphing page.
  2. It is not required to use the HSPICE graphical interface. Though the HSPICE text interface is not as pretty as the graphical interface, it is much faster and does not pull very hard on system resources. To find out how to run HSPICE using just the text interface check out Running HSPICE.
  3. It is helpful to use a makefile to run HSPICE. A makefile keeps the directories clean of useless files and can automatically graph the results. Check out the Makefile that I use (Note GetTran and GetAc are scripts that remove AC and Transient analysis data from the .lis file to graph in Matlab).

----Return to Index----

Running HSPICE:

Text Interface:

To run HSPICE in text interface nothing could be simpler, just follow these steps:
  1. Create the nestlist (.sp) file using any available text editor (vi, pico, emacs, nedit, etc.).
  2. To run the HSPICE simulation type in
    	hspice <filename>.sp > <filename>.lis
  3. View the results (.lis file)

Graphical Interface:

To use the graphical interface use these steps: (For ECE computers only)
  1. Make sure x-windows is running
  2. Move the mouse pointer onto the empty desktop
  3. Press the left most button to call up the Utilities menu
  4. Select Hspice under Applications
USING THE GRAPHICAL INTERFACE IS NOT RECOMENDED

Important Note: please when running long HSPICE jobs, please be courteous and renice the process to at least 5

----Return to Index----

Ryan L. Carlson / ECE / carlsor@ece.orst.edu
File last modified 7-21-95