Introduction to SPICE History SPICE stands for Simulation

  • Slides: 25
Download presentation
Introduction to SPICE

Introduction to SPICE

History SPICE stands for Simulation Program with Integrated Circuit Emphasis p In 1960 ECAP

History SPICE stands for Simulation Program with Integrated Circuit Emphasis p In 1960 ECAP was developed by a team of IBM programmers. Then came other similar packages such as SPECTRE, TRAC, NET, and CIRCUS. p In 1975 SPICE was written by Lawrence Nagel at University of California – Berkeley. p

History It was described in his Ph. D thesis “SPICE 2: A Computer Program

History It was described in his Ph. D thesis “SPICE 2: A Computer Program to Simulate Semiconductor Circuits”. p It was originally written in FORTRAN and it became the industry standard for circuit analysis. p Commercial versions such as PSPICE by Micro. Sim Corporation use the same algorithm and syntax as SPICE but provide the technical support and additions that industrial customers need. p

How SPICE works p p Circuits are described to SPICE by use of an

How SPICE works p p Circuits are described to SPICE by use of an input file (*. CIR) prepared by an ASCII text editor called the source file, which lists each circuit element (resistor, capacitor, inductor, voltage sources, current sources, semiconductor devices) and indicates how each is connected using node numbers. In addition there are lines in the input file which designate the frequency of the sources, temperatures, the type of analysis, and how the analysis results are to be presented.

How SPICE works p SPICE reads the input file describing the circuit and figures

How SPICE works p SPICE reads the input file describing the circuit and figures out all the circuit elements connected to each node. It then uses Kirchhoff’s current law (KCL) to create a system of equations for the circuit, where the voltages at each node are the unknowns, and the admittance of each branch connecting each two node are the known quantities. The model for each semiconductor element and the parameters in the model have to be specified.

How SPICE works The result is a system of simultaneous equations whose size is

How SPICE works The result is a system of simultaneous equations whose size is determined by the number of nodes and circuit elements in the circuit. p The system of equations is then solved using a technique called Newton-Raphson method. p

Dissecting a SPICE source file p p As stated before the source file contains

Dissecting a SPICE source file p p As stated before the source file contains the statements necessary for solving a circuit. Each line in the source file is called a statement. If a line is too long ( >80 characters) it can be continued on a new line, the continuation lines must begin with a (+) sign in the first column. SPICE is not case sensitive, and standard units are implied when not specified.

Dissecting a SPICE source file p 1. 2. 3. 4. 5. There are five

Dissecting a SPICE source file p 1. 2. 3. 4. 5. There are five categories of statements in. CIR files: Title and comment statements Data statements Solution control statements Output control statements End statement

Title statement The first line in the source file is called the title statement.

Title statement The first line in the source file is called the title statement. p This line is used by SPICE as a label within the output file and is not considered in the analysis. p It is mandatory to allocate the first line to the title line even if it is left blank. p Use an asterisk (*) to comment out a line p

Data statements p p p The data statements completely specify the circuit. In any

Data statements p p p The data statements completely specify the circuit. In any circuit, one node should be numbered 0 to serve as the reference node. The set of data statements describing the topology of the circuit and the element values is called the netlist. All nodes must have a path to every other node. Nodes can have any alphanumeric name.

Control and Output Statements p 1. 2. 3. p In the absence of any

Control and Output Statements p 1. 2. 3. p In the absence of any additional commands and only based on the netlist, SPICE automatically computes the DC values of the following quantities: Node voltages with respect to node 0. Currents entering each voltage source ( from the + terminal). Total power dissipated in the circuit. Additional control and output statements can be includes to specify other variables.

End Statement The. END statement is required at the end of the source file.

End Statement The. END statement is required at the end of the source file. p Any statement following this statement will be considered as a separate source file. p

Data Statements and DC Analysis p p Data statements for resistors, inductors and capacitors

Data Statements and DC Analysis p p Data statements for resistors, inductors and capacitors contain a minimum of three segments. The first segment gives the name of the element as a string of characters beginning with R for a resistor, C for a capacitor, and L for an inductor. The second segment give the node numbers, separated by a space between which the element is connected. The third segment gives the element values in Ohms, Henrys and Farads with an optional scaling factor given according to the following table.

Data Statements and DC Analysis

Data Statements and DC Analysis

Data Statements and DC Analysis Possible initial conditions can be given in the optional

Data Statements and DC Analysis Possible initial conditions can be given in the optional fourth segment. p A missing node is always taken to be the reference node. p To describe a short circuit use a very small value. p To describe an open circuit use a very large value. p

Data Statements and DC Analysis p p p Independent sources are specified by four

Data Statements and DC Analysis p p p Independent sources are specified by four segments. The first segment gives the name which for a voltage source starts with V and for the current source starts with I. The second segment contains the nodes, for voltage sources the first node indicates the positive terminal. The current in the current source flows from the first node to the second. The third segment specifies the type of the source DC or AC. The fourth segment contains the value.

Data Statements and DC Analysis For linearly dependent sources the name should start with

Data Statements and DC Analysis For linearly dependent sources the name should start with a letter as follows. p Voltage–controlled voltage source E p Current–controlled voltage source H p Voltage–controlled current source G p Current–controlled current source F p The order of nodes is similar to the dependent sources. p

Data Statements and DC Analysis p p p The third and fourth segments of

Data Statements and DC Analysis p p p The third and fourth segments of the data statement contain the control and the gain. For voltage-controlled sources the first node in the control segment indicates the + terminal. The gain is the proportionality factor. In the case of the current-controlled sources we first introduce a zero-valued voltage source on the path of the controlling current and use its name as the control variable.

Control and Output Statements in DC Analysis p The output statement control the types

Control and Output Statements in DC Analysis p The output statement control the types and number of calculated responses included in the output file p. OP statement has no parameters, it causes SPICE to calculate the dc operating point (OP) of all independent sources, it is the default command when no command statements are included in the input file.

Control and Output Statements in DC Analysis p. DC statement sweeps the value of

Control and Output Statements in DC Analysis p. DC statement sweeps the value of an independent dc source. The syntax is: . DC <source name> <initial value> <final value> <step size> p The . DC statement overrides the value in the input statement of the source.

Control and Output Statements in DC Analysis p p p The. TF ( transfer

Control and Output Statements in DC Analysis p p p The. TF ( transfer function command) causes SPICE to calculate three numbers: the circuit gain from input source to output variable, the input resistance as seen by the input source in ohms, the output resistance at the terminals defining the output variable in ohms. The gain or transfer function is a number defined as: gain=output variable / input source The unit for the gain depends on the units for the output variable and the input source.

Control and Output Statements in DC Analysis The. PRINT statement in conjunction with the.

Control and Output Statements in DC Analysis The. PRINT statement in conjunction with the. DC statement can be used to specify the calculated responses in the output file. p The syntax for the. Print statement is: p . PRINT <analysis type> <output variable list> p This statement restricts the calculated responses in the output file to those given in the output variable list.

Control and Output Statements in DC Analysis p p 1. 2. 3. When the

Control and Output Statements in DC Analysis p p 1. 2. 3. When the analysis type is DC there must be a. DC statement in the input file for the. PRINT statement to be executed. The notation for the variable list is: V(N) is the node voltage at node N V(N 1, N 2) is the node voltage between nodes N 1 and N 2 with the plus sign at node N 1 I(Vxxxx) is the current through the element Vxxxx the reference direction for th current is determined by the first node listed in the input statement defining Vxxxx.

Control and Output Statements in DC Analysis The. PLOT statement line prints variables, the

Control and Output Statements in DC Analysis The. PLOT statement line prints variables, the syntax is: . PLOT <type> <output variables> p. PROBE generates a data file *. DAT which can be plotted in post analysis by evoking the Probe program. The syntax is: . PROBE [<output variables>] p If the. PROBE command is issued without any parameters all variables will be saved p

Control and Output Statements in DC Analysis p To open the PROBE program, after

Control and Output Statements in DC Analysis p To open the PROBE program, after you run the. CIR file from PSpice A/D choose “Run Probe” from the “file” menu. When Probe opens choose “add” from the “trace” menu a list of variables appears, select the variable you want to see the plot for from