Chapter IX: TOOLS

plug

4: Simulation

plug


The Simulation command of the Tools menu controls the internal simulator, which can simulate schematics, IC layout, and VHDL specifications. Chapter 10 discusses this simulator more fully.

The Simulation Interface command of the Tools menu is able to produce input specifications for a number of different simulators. All these commands work on the current facet and require that all named points be exported. It is also necessary to export power and ground ports.

The possible simulators include circuit-level (SPICE), switch-level (ESIM, RSIM, RNL, COSMOS, and MOSSIM), gate-level (ABEL-PAL), and functional (VERILOG, TEGAS, and SILOS). To produce an input deck for any of these simulators, use the Write XXX Deck command (where XXX is the simulator's name). In addition to these simulators, an EDIF netlist can be produced with the EDIF subcommand of the Export command of the File menu.

Verilog

Besides generating Verilog decks, it is possible to annotate circuits with additional Verilog declarations and code that will be included in the deck. The subcommands Add VERILOG Code and Add VERILOG Declaration of the Simulation Interface command of the Tools menu allow you to click in the circuit and type code or declarations. This pieces of text can be manipulated like any other text object (see the section on Text).

Additional control of Verilog deck generation is accomplished with the VERILOG Options... subcommand. A checkbox lets you choose whether or not to use the Verilog "assign" construct. In addition, you can attach disk files with Verilog code to any facet in the library. Once attached, the generated Verilog will use the contents of that file instead of examining the facet contents. This allows you to create your own definitions in situations where the derived Verilog would be too complex or otherwise incorrect. For an example of Verilog layout and code, look at the facet "tool-SimulateVERILOG" in the library "samples.txt" (you can read the library with the Readable Dump subcommand of the Import command of the File menu).

Figure 9.7

SPICE

SPICE circuit simulation is a special case in Electric. Since the simulator is not interactive, all specifications must be done graphically, in advance. Note that the example shown here is available in the "samples.txt" library as facet "tool-SimulateSPICE" (you can read the library with the Readable Dump subcommand of the Import command of the File menu).

All input values to SPICE are controlled with Source nodes, found in the New SPICE Part command of the Edit menu. There are both voltage and current sources. For example, to create a 5-volt supply, use the Voltage Source subcommand, provide the SPICE fragment "DC 5", and connect it to the power and ground ports of the circuit. To create a piecewise linear input signal, use the same component, connected between ground and the input port, and provide the SPICE fragment, for example "PWL(0NS 0 3NS 0 4NS 5)" (this sets the input to 0 volts from 0 to 3 nanoseconds, and ramps it up to 5 volts from 3 to 4 nanoseconds).

All output values requested of SPICE are controlled with Meter nodes. The Voltage Meter subcommand will place a node that can be wired between an output port and ground to measure the difference. The Current Meter subcommand creates a source that records the current output. For SPICE 2 and SPICE 3, these meter nodes must be used for any signal whose value you wish to examine. For HSPICE, all signal values are available, and those with meter nodes will be shown initially.

It is possible to specify Transient, DC, or AC analysis by using the Transient Analysis, DC Analysis, and AC Analysis subcommands. The transient analysis node in the example was given the "TRAN" card fragment ".2NS 7NS 0NS .2NS". The DC Analysis node is connected to the loop point and given a SPICE fragment, for example "0V 5V .1V".

Figure 9.6

Transistors sometimes require special care when modeling them in SPICE. This is because they not only have connections to a source, gate, and drain, but also have substrate connections (or "body" or "well", depending on the usage). Typically this is connected to power or ground (P-transistors have their substrate connected to power, and N-transistors have their substrate connected to ground). This can be overridden by using the Bulk Declaration subcommand to create a special node. The two ports on the Bulk node must be exported or connected so that they define two networks. The network connected on top (the + side) will be used as the substrate in P-transistors (it is the N-well substrate). The network on the bottom (the - side) will be used as the substrate in N-transistors (it is the P-well substrate). There can be only one Bulk node in any facet.

Bipolar transistors have their substrate connected to ground by default. If a Substrate node is encountered, its network will be used for the substrate connection of these transistors instead. The Well subcommand can be used to specify the well network.

Finally, there are two special SPICE nodes that are only for advanced users. The Node Set and the Extension subcommands create nodes which generate special SPICE code. For example, the Extension node produces the SPICE "X" card with whatever text you give it.

Figure 9.3
Some nongraphical information can also be given to the SPICE simulator with the SPICE Options... subcommand of the Simulation Interface command of the Tools menu. This dialog allows you to control many of the SPICE deck parameters such as the SPICE format (SPICE 2, SPICE 3, or HSPICE), the SPICE level (1, 2, or 3), whether to use parasitics in the deck, and whether to use actual node names in the deck (SPICE 3 or HSPICE).

UNIX systems can choose to run SPICE after the deck has been generated. There are five options:

Note that SPICE 2 and SPICE 3 place their waveform values in the output, but HSPICE writes waveform values to a disk file (.tr0 file). Therefore, it does not make sense to choose "Run SPICE, Read Output" or "Run SPICE Quietly, Read Output" when using HSPICE.

The middle section of the Spice Options dialog controls technology-specific information, which includes model cards (placed at the start of the SPICE deck), trailer cards (placed at the end of the SPICE deck), and parasitic values. Electric has a default set of model cards associated with each technology, and those model cards are inserted into the netlist (so be sure that you are in the proper technology before generating a SPICE deck). This dialog allows you to specify a disk file with model cards or trailer cards to be used instead of the built-in set. You can also edit the built-in model cards for the current technology by using the "Edit Built-in Model Cards" button, which invokes an editing window. See section 4-10 for more on text editing. The parasitics that can be set include a per-layer resistance, capacitance, and edge-capacitance. You can also set the minimum resistance and capacitance for the entire technology.

The bottom section of the dialog allows you to specify a disk file of SPICE cards that will be used to describe any facet. This disk file replaces the any SPICE description that may be derived from the circuitry.

SPICE Plotting

Once SPICE has been run, you can see a plot of the simulation by reading the SPICE output file back into Electric. Make sure that the SPICE format is properly set (SPICE 2, SPICE 3, or HSPICE) and use the Plot SPICE Listing command to read the file. The waveforms will appear in a window:

Figure 9.4

The waveform window is tied to an associated schematics or layout window. Clicking on a signal name in the waveform windows highlights the equivalent circuitry in the other window, and clicking on an arc in the schematics or layout window causes the waveform signal to be selected. Both the waveform window and the associated schematics/layout window are highlighted with a red border to indicate that they are part of the simulation activity.

You can do a number of special commands in the waveform window. Two vertical lines are drawn, called the "main" and the "extension" cursors (the extension cursor has an "X" drawn at its top). You can click over these cursors and drag them to different time locations. Type "i" to display the value of the selected signal at the location of the main cursor.

You can control which signals are displayed in the waveform window. To remove a signal, select its name and type "r". When adding a signal, you have a choice of showing it overlaid with an existing signal, or in its own graph. Typing "o" causes the signal to be overlaid, and typing "a" causes the signal to be added in its own graph. If you type "o" or "a" into the waveform window, you will be prompted for a list of signal names to display. If you type "o" or "a" in the assiciated schematics/layout window, then the selected signal from that window will be added to the waveform display.

The time axis of the simulation window can be controlled with the appropriate Windows menu commands. Use Zoom Out and Zoom In to scale the time axis by a factor of two. Use Fill Window to display the entire range of data, fit to the screen. Use Focus on Highlighted to display the range between the main and extension cursors. Use Right and Left to shift the time axis forward and backward.

Besides the time axis, it is possible to zoom and pan the vertical axis of the waveform window. Typing '7' doubles the scale (zooms-in) and typing '0' halves the scale (zooms-out). Type '9' to restore the scale so that the data fills the screen. Use '8' and '2' to shift the data values up and down.

One final feature is the ability to take a snapshot of the waveform window. Typing "s" saves the waveform in the database (a facet is created with artwork components).

Here is a summary of the single-key commands available in SPICE windows:

Key
Waveform Window
Schematics/Layout Window
i
Show value of selected signal at main cursor 
a
Add signalAdd selected network to waveform window
o
Overlay signal on top of currently selected signal lineOverlay selected network on top of currently selected signal line
r
Remove selected signal 
7
Zoom in vertically (double data scale) 
0
Zoom out vertically (halve data scale) 
9
Scale data to fill the display 
8
Shift data up by 1/4 screen 
2
Shift data down by 1/4 screen 
s
Save snapshot of waveform window 
d
 Move down the hierarchy (into the selected facet)
u
 Move up the hierarchy (out of the current facet)
?
Print this listing of single-key commandsPrint this listing of single-key commands


Prev Previous     Contents Table of Contents     Next Next