The integration of HSPICE in SPICECAD works as follows.
The simulator can be chosen in the 'options*'-box in the main menu. The 'HSPICE' button must be selected to tell SPICECAD that HSPICE-compatible netlists shall be written.
HSPICE netlists are written automatically before each simulation. To force netlisting if a model file has changed since the last netlisting, the netlisting can be started explicitly by hitting the 'netlist' button. The netlist file ends with '.sp'. If the edited schematic topcell is called 'topcell', the netlist file will be called 'topcell.sp'.
To start the simulator, a script 'run_hspice' will be called.
A sample can be found in the installation path inside the
'bin'-directory. This script needs to be customized .
A sample script looks like this:
#!/bin/csh -f # users' own setup in cad_hspice /cad/bin/cad_hspice mv -f $1.sim $1.sim.bak hspice $1.sp > $1.sim
The script calls another script (cad_hspice) which sets environment variables. These settings can be done in the 'run_hspice'-script , instead. Afterwards, the output file is saved (this line can be deleted), and as a last step, HSPICE is called.
HSPICE can be run in two modes: in one of these modes, HSPICE will run
in background. This means, immediately after executing the line
hspice $1.sp > $1.sim ,
the script 'run_hspice' will be finished.
This means that a message is sent to SPICECAD telling that HSPICE
has finished. Of cource, this might be wrong, because HSPICE might
still be running in background.
So, if customizing the 'run_hspice'-script , make sure that you
do not put HSPICE in the background run mode.
The script 'run_hspice' will be executed by a batch job.
Here, some more customization is possible. You can choose (in the option-dialog) on which machine HSPICE shall be executed, and with which nice priority HSPICE shall run. .
After receiving the message that HSPICE has finished, simulation results will be read from 'topcell.ac0', 'topcell.sw0', 'topcell.tr0' and 'topcell.sim'. Error and warning messages are found in 'topcell.sim'.
To start the simulation, 'runsim' has to selected in the simulation menu
(or use hotkey 'CTRL r').
If selected, a file called 'run' will be opened in the current directory.
The file will be executed on a remote host (called simulatorhost)
on path 'simulatorpath' using the
command
rsh simulatorhost 'cd simulatorpath; run_hspice topcell'
The variables 'simulatorhost' and 'simulatorpath' have to be specified in the
'options1*'-menu accessible from the main menu.
'simulatorhost' is the host where HSPICE will be run, and 'simulatorpath'
has to be set to your current path. The latter is no longer necessary,
during the SPICECAD start phase, this variable is set to the current
working directory $PWD.
The 'run_hspice'-script is called from another script,
which contains all the customization info which you have specified before.
Here is the script:
rm -f hspicemsg.simulatorhost.* echo "begin of job" date nice -0 run_hspice $topcell echo "end of job" date grep error $topcell.sim > hspicemsg sendmessage $simulatorhost 5218 rsh $your_own_host kill -1 5218
The SPICECAD process (PID 5218) will receive a signal ( SIGNAL 1, HANGUP) . This signal tells SPICECAD that HSPICE is ready.
SPICECAD will now open the file 'hspicemsg' and look for the contents. If the HSPICE simulation was successful, which means 'hspicemsg' contains only one line, 'hspice ready', a window pops up in SPICECAD which contains this line. Afterwards, the simulation results will be read in by SPICECAD automatically. If the simulation was unsuccessful, which means that 'hspicemsg' contains several error messages, the error messages will be displayed in the error-and-warning-window , but no simulation results will be read in.
Besides .ac, .tran and .dc simulation results, dc operating point results (in file topcell.sim) are being read in, too. The whole file 'topcell.sim' is read in and stored in internal data structures. These data structures can be accessed and processed via different functions. dc op point voltages and currents can be displayed using 'show voltage' and 'show current'. Device information about bipolar and MOS transistors can be displayed using 'showdevice'. Devices in triode region or in saturation can be displayed using 'show bad devices'.
Parametric sweep, monte carlo simulation and optimization are working.
DC operation point results can be displayed (showdevice, showvolt ) in the schematic window. ( showcurrent is not yet ready).
To be able to display results from deeper hierarchy levels which are included in the netlist as subcircuits, the 'create gsiwindow' function was implemented. This function displays all node names in a schematic window. To determine where these names are to be placed, create a text object '@gsi' and place it where you want to see these names.
To be able to select a net and display the simulation result, you have to execute 'select alias' before. This means that instead of displaying the result according to the netnumber of the selected net, the alias name of this net is taken instead and will be displayed. To switch back to normal mode , execute 'select netnumber'.
By the way, currents can be displayed this way, too. All displayed nets have aliases, some are currents, most are voltages.