Holger Vogt, Marcel Hendrix, Paolo Nenzi
January 1st, 2019
Locations
The project and download pages of ngspice may be found at
Ngspice home page http://ngspice.sourceforge.net/
Project page at sourceforge http://sourceforge.net/projects/ngspice/
Download page at sourceforge http://sourceforge.net/projects/ngspice/files/
Git source download http://sourceforge.net/scm/?type=cvs&group_id=38962
Status
This manual is a work in progress. Some to-dos are listed in Chapt. 24.3. More is surely needed. You are invited to report bugs, missing items, wrongly described items, bad English style etc.
How to use this manual
The manual is a `work in progress'. It may accompany a specific ngspice release, e.g. ngspice-24 as manual version 24. If its name contains `Version xxplus', it describes the actual code status, found at the date of issue in the Git Source Code Management (SCM) tool. The manual is intended to provide a complete description of the ngspice functionality, its features, commands, or procedures. It is not a book about learning SPICE usage, but the novice user may find some hints how to start using ngspice. Chapter 21.1 gives a short introduction how to set up and simulate a small circuit. Chapter 32 is about compiling and installing ngspice from a tarball or the actual Git source code, which you may find on the ngspice web pages. If you are running a specific Linux distribution, you may check if it provides ngspice as part of the package. Some are listed here.
License
This document is covered by the Creative Commons Attribution Share-Alike (CC-BY-SA) v4.0..
Part of chapters 12 and 25-27 are in the public domain.
Chapter 30 is covered by New BSD (chapt. 33.3.2).
Part I Ngspice User Manual
Table of Contents
Preface to the actual edition (as May 2018)
1.3 Analysis at Different Temperatures
2.1 General Structure and Conventions
2.8 .PARAM Parametric netlists
2.12 .IF Condition-Controlled Netlist
2.13 Parameters, functions, expressions, and command scripts
Chapter 3 Circuit Elements and Models
3.1 General options and information
Chapter 4 Voltage and Current Sources
4.1 Independent Sources for Voltage or Current
Chapter 5 Non-linear Dependent Sources (Behavioral Sources)
5.1 Bxxxx: Nonlinear dependent source (ASRC)
5.2 Exxxx: non-linear voltage source
5.3 Gxxxx: non-linear current source
5.4 Debugging a behavioral source
6.1 Lossless Transmission Lines
6.3 Uniform Distributed RC Lines
6.4 KSPICE Lossy Transmission Lines
8.1 Bipolar Junction Transistors (BJTs)
9.1 Junction Field-Effect Transistors (JFETs)
11.2 MOSFET models (NMOS/PMOS)
11.3 Power MOSFET model (VDMOS)
Chapter 12 Mixed-Mode and Behavioral Modeling with XSPICE
12.1 Code Model Element & .MODEL Cards
12.5 Predefined Node Types for event driven simulation
Chapter 13 Verilog A Device models
13.3 How to integrate a Verilog-A model into ngspice
Chapter 14 Mixed-Level Simulation (ngspice with TCAD)
Chapter 15 Analyses and Output Control (batch mode)
15.1 Simulator Variables (.options)
15.4 Measurements after AC, DC and Transient Analysis
15.5 Safe Operating Area (SOA) warning messages
15.7 Measuring current through device terminals
16.3 Command line options for starting ngspice and ngnutmeg
16.5 Standard configuration file spinit
16.6 User defined configuration file .spiceinit
16.10 Ngspice on multi-core processors using OpenMP
16.12 Ngspice control via input, output fifos
16.15 Reporting bugs and errors
Chapter 17 Interactive Interpreter
17.2 Expressions, Functions, and Constants
17.7 Internally predefined variables
17.9 Scattering parameters (s-parameters)
Chapter 18 Ngspice User Interfaces
18.1 MS Windows Graphical User Interface
18.6 Postscript printing options
18.8 Integration with CAD software and `third party' GUIs
Chapter 19 ngspice as shared library or dynamic link library
19.2 Linking shared ngspice to a calling application
19.4 General remarks on using the API
20.7 MS Windows 32 Bit binaries
21.1 AC coupled transistor amplifier
21.5 Four-Bit Binary Adder (Bipolar)
21.6 Four-Bit Binary Adder (MOS)
21.7 Transmission-Line Inverter
Chapter 22 Statistical circuit analysis
22.2 Using random param(eters)
22.3 Behavioral sources (B, E, G, R, L, C) with random control
22.4 ngspice scripting language
22.6 Data evaluation with Gnuplot
Chapter 23 Circuit optimization with ngspice
23.1 Optimization of a circuit
23.2 ngspice optimizer using ngspice scripts
23.3 ngspice optimizer using tclspice
23.4 ngspice optimizer using a Python script
23.5 ngspice optimizer using ASCO
24.2 Acronyms and Abbreviations
Part II XSPICE Software User's Manual
25.1 ngspice with the XSPICE option
25.2 The XSPICE Code Model Subsystem
Chapter 26 Execution Procedures
26.1 Simulation and Modeling Overview
26.2 Circuit Description Syntax
26.3 How to create code models
27.1 Amplifier with XSPICE model `gain'
Chapter 28 Code Models and User-Defined Nodes
28.1 Code Model Data Type Definitions
28.3 Creating User-Defined Nodes
28.4 Adding a new code model library
28.5 Compiling and loading the new code model (library)
28.6 Interface Specification File
28.8 User-Defined Node Definition File
29.1 Preprocessor Error Messages
29.3 Code Model Error Messages
Chapter 30 CIDER User’s Manual
Chapter 31 Model and Device Parameters
31.1 Accessing internal device parameters
31.3 Voltage and current sources
32.1 Ngspice Installation under Linux (and other 'UNIXes')
32.2 Ngspice Compilation under Windows OS
Chapter 33 Copyrights and licenses
33.4 Some notes on the historical evolvement of the ngspice licenses
Prefaces
Preface to the first edition
This manual has been assembled from different sources:
- The spice3f5 manual,
- the XSPICE user's manual,
- the CIDER user's manual
and some original material needed to describe the new features and the newly implemented models. This cut and paste approach, while not being orthodox, allowed ngspice to have a full manual in a fraction of the time that writing a completely new text would have required. The use of and LyX instead of info, which was the original encoding for the manual, further helped to reduce the writing effort and improved the quality of the result, at the expense of an on-line version of the manual but, due to the complexity of the software I hardly think that users will ever want to read an on-line text version.
In writing this text I followed the spice3f5 manual, both in the chapter sequence and presentation of material, mostly because that was already the user manual of SPICE.
Ngspice is an open source software, users can download the source code, compile, and run it. This manual has an entire chapter describing program compilation and available options to help users in building ngspice (see Chapt. 32). The source package already comes with all `safe' options enabled by default, and activating the others can produce unpredictable results and thus is recommended to expert users only. This is the first ngspice manual and I have removed all the historical material that described the differences between ngspice and spice3, since it was of no use for the user and not so useful for the developer who can look for it in the Changelogs of in the revision control system.
I want to acknowledge the work done by Emmanuel Rouat and Arno W. Peters for converting the original spice3f documentation to TeXinfo. Their effort gave ngspice users the only available documentation that described the changes for many years. A good source of ideas for this manual came from the on-line spice3f manual written by Charles D.H. Williams (Spice3f5 User Guide), constantly updated and useful for its many insights.
As always, errors, omissions and unreadable phrases are only my fault.
Paolo Nenzi
Roma, March 24th 2001
Indeed. At the end of the day, this is engineering, and one learns to live
within the limitations of the tools.
Kevin Aylward, Warden of the King's Ale
Preface to the actual edition (as May 2018)
Due to the wealth of new material and options in ngspice the actual order of chapters has been revised. Several new chapters have been added. The LyX text processor has allowed adding internal cross references. The PDF format has become the standard format for distribution of the manual. Within each new ngspice distribution (starting with ngspice-21) a manual edition is provided reflecting the ngspice status at the time of distribution. At the same time, located at ngspice manuals, the manual is constantly updated. Every new ngspice feature should enter this manual as soon as it has been made available in the Git source code master branch.
Holger Vogt
Mülheim, 2018
Acknowledgments
ngspice contributors
Spice3 and CIDER were originally written at The University of California at Berkeley (USA).
XSPICE has been provided by Georgia Institute of Technology, Atlanta (USA).
Since then, there have been many people working on the software, most of them releasing patches to the original code through the Internet.
The following people have contributed in some way:
Vera Albrecht,
Cecil Aswell,
Giles C. Billingsley,
Phil Barker,
Steven Borley,
Stuart Brorson,
Mansun Chan,
Wayne A. Christopher,
Al Davis,
Glao S. Dezai,
Jon Engelbert,
Daniele Foci,
Noah Friedman,
David A. Gates,
Alan Gillespie,
John Heidemann,
Marcel Hendrix,
Jeffrey M. Hsu,
JianHui Huang,
S. Hwang,
Chris Inbody,
Gordon M. Jacobs,
Min-Chie Jeng,
Beorn Johnson,
Stefan Jones,
Kenneth H. Keller,
Francesco Lannutti,
Robert Larice,
Mathew Lew,
Robert Lindsell,
Weidong Liu,
Kartikeya Mayaram,
Richard D. McRoberts,
Manfred Metzger,
Wolfgang Muees,
Paolo Nenzi,
Gary W. Ng,
Hong June Park,
Stefano Perticaroli,
Arno Peters,
Serban-Mihai Popescu,
Georg Post,
Thomas L. Quarles,
Emmanuel Rouat,
Jean-Marc Routure,
Jaijeet S. Roychowdhury,
Lionel Sainte Cluque,
Takayasu Sakurai,
Amakawa Shuhei,
Kanwar Jit Singh,
Bill Swartz,
Hitoshi Tanaka,
Steve Tell,
Andrew Tuckey,
Andreas Unger,
Holger Vogt,
Dietmar Warning,
Michael Widlok,
Charles D.H. Williams,
Antony Wilson,
and many others...
If someone helped in the development and has not been inserted in this list then this omission was unintentional. If you feel you should be on this list then please write to <ngspice-devel@lists.sourceforge.net>. Do not be shy, we would like to make a list as complete as possible.