XSPICE Extension
Lindentree Software
About XSPICE
- The XSPICE extension adds event-driven simulation capabilities.
Thus, designs that contain significant portions of digital circuitry can be efficiently simulated together with analog components.
- This implementation also includes a real (float) node type, allowing mathematical computations in event-driven simulations.
- In total, there are 60 new component types (named code models) added to the simulator.
- The XSPICE option has been developed by the Computer Science and Information Technology Laboratory
at Georgia Tech Research Institute of the Georgia Institute of Technology, Atlanta, Georgia and enhanced by the NGSPICE team.
Node types
- Analog nodes are the traditional nodes used by NGSPICE.
These are the only ones visible in the Results tab.
- Digital nodes connect digital code models and are subject to event-driven simulation.
They cannot be selected for plotting in the Results tab.
- Real nodes are used for event-driven floating-point computations, using specific "real" code models.
They cannot be selected for plotting in the Results tab.
- All instances' pins connected to a node must have the same type (analog, digital or real). The simulator will report an error if this is not OK.
- Node bridge models are provided for translating data between different node types (a2d, d2a, d2r, r2a).
Code models
- Analog models are components working with analog nodes and using the analog simulation algorithm, just like the basic NGSPICE components.
They are mostly macro models allowing to simulate analog functions (ex: gain, opamp) rather than components (transistor-level).
The analog models may be freely mixed in your analog schematics and support DC, AC and TRAN analysis.
- Digital models are components working with digital nodes and using the event-driven simulation algorithm.
The CPU time used to simulate them is significantly lower than normal analog method. The digital models support DC and TRAN analysis.
- Real models provide event-driven floating-point computation capabilities and support DC and TRAN analysis.
How To
- Instantiate code models - All models are fully supported in netlists.
Most models have pre-defined symbols in the libraries /xanalib, /xdiglib, /xreallib. They can be instanced as:
- Component type "A" + model card. This is useful when most instances will share the same model (ex: digital libraries).
- Packaged as sub-circuits (containing one "A" component and its model) to allow easier parameter editing when instanced.
Passing "string" parameters to sub-circuits is not possible, so packaging some code models as sub-circuits is less useful.
Some symbols in the library are set for direct instancing as type "A" components, some are setup as sub-circuits.
To change from one type to another, you have to change the "component type" in the Symbol menu - either the specific code model, or type "X".
Using it as component requires at least one defined model. Using it as sub-circuit requires a valid schematic (can be netlist-type like the ones provided).
- Simulate code models - Using analog code models can lead to nodes with no path to ground.
To solve this, you can either add dummy resistors in the schematic or set one of the options RSHUNT=1e12 or GSHUNT=1e-12.
For correct simulation of digital and real nodes, you should always set the "step" argument of .TRAN command to a value smaller than all digital clock periods.
- Choose symbol pin names - The base name for each pin is fixed in WeSpice (as is with normal NGSPICE components).
You can see these base names when you choose the component type in the Symbol tab, or just inspect the supplied pre-built symbols.
When netlisting, WeSpice maps the different options for code model port types (see NGSPICE manual) to pin naming conventions:
- A pin named exactly as the base name is passed as such.
- Prefix N to the base pin name is translated to inverted digital pin. Ex: base IN, pin NIN, net A -> ~A.
- Prefixes V, I, G, H to the base pin name are translated to %v, %i, %g, %h modifiers. Ex: base IN, pin VIN, net A -> %v(A).
- A pair of pins with prefix V, I, G, H and suffixes P and N is translated to %vd,... Ex: base IN, pins VINP,VINN, nets A,B -> %vd(A B).
- Suffixes 0, 1, 2,... are mapped to a vector port. Ex: base IN, pins IN0, VIN1, VINP2, VINN2, IIN3, nets A...E -> [A %v(B) %vd(C D) %i(E)].
See also the pre-defined symbols in the system libraries.
- Use boolean parameters - Some code models have boolean parameters. They accept the values "true", "t", "1" and "false", "f", "0".
To pass them as parameters of a sub-circuit, use "1" or "0".
- Load the code models in the simulator - There is no need for "codemodel" statement. All models are loaded automatically.
- Use your own code models - This is not possible due to the Android app architecture.
In future updates, we will continue to follow the full list of models implemented in NGSPICE. We are also open to suggestions.
- Get more info - In the NGSPICE manual, see chapter 12 and section II.