SPICE is a powerful simulation language for electronic circuits, offering a wide range of features for analyzing and testing circuit designs. At the core of SPICE simulations in the Breadpad app is the netlist: a textual representation of your circuit.
Mastering the netlist syntax and commands helps you create efficient and effective simulations. This article provides an overview of the elements that make up a SPICE netlist, including syntax, parameters, and key commands.
Netlist Basics
A netlist in ngspice describes electronic circuits through a series of lines, each representing a component, connection, or command.
The basic syntax for a component in a netlist is as follows:
<Component Identifier> <Node Connections> <Component Value> <Optional Parameters>
Component Identifier: A letter (and optionally, a number) that specifies the type of component (e.g., R for resistor, C for capacitor).
Node Connections: The nodes (points in the circuit) to which the component is connected.
Component Value: The value of the component (e.g., resistance in ohms, capacitance in farads).
Optional Parameters: Additional parameters defining the component's behavior (e.g., model, initial conditions).
Key Components and Their Identifiers
Resistors (R): Defines a resistor.
Capacitors (C): Defines a capacitor.
Inductors (L): Defines an inductor.
Diodes (D): Defines a diode.
BJT Transistors (Q): Defines a bipolar junction transistor.
MOSFETs (M): Defines a metal-oxide-semiconductor field-effect transistor.
Essential Commands
.model: Defines the characteristics of a particular component model.
.ac: Specifies an AC analysis, including frequency range.
.dc: Sets up a DC sweep analysis.
.tran: Defines a transient analysis over a specified time period.
.op: Conducts an operating point analysis.
.include: Includes an external file containing additional netlist commands or parameters.
.subckt: Defines a subcircuit for modular circuit design.
.ends: Marks the end of a subcircuit definition.
Parameters and Analysis Options
AC Analysis: Use
.ac
followed by the type of sweep (LIN, DEC, or OCT), the number of points, start frequency, and stop frequency.DC Sweep: Use
.dc
followed by the source name, start value, stop value, and increment.Transient Analysis: Use
.tran
with the time step and stop time to simulate the circuit's time-domain response.
Tips for Effective Netlist Creation
Consistency: Ensure consistent naming conventions for nodes and components.
Comments: Use asterisks (*) to add comments for clarity.
Modularity: Leverage
.subckt
and.ends
to create reusable circuit blocks.