FDL_2007

Embed Size (px)

Citation preview

  • 8/13/2019 FDL_2007

    1/5

    Non-Linear Circuit Simulation Using MATLAB

    Steven P. Levitan, Jose A. Martinez and Donald M. ChiarulliUniversity of Pittsburgh, Pittsburgh, PA

    Abstract

    Design exploration is most often accomplished in a

    design, analysis, evaluate loop which is limited by thespeed and quality of the simulation tools used for

    analysis and evaluation. For new technologies thesesimulations are often ad-hoc and incompatible withtraditional simulation environments. Therefore, it ischallenging to model systems composed of noveldevices together with conventional devices. Similarly,

    development of new methodologies for modelextraction, reduction, and abstraction are often

    hampered by the implementation overhead required toapply these methodologies in an environmentcompatible with existing models.

    To address both these needs, we have developed aflexible MATLAB simulation platform that supportsSPICE netlists in conjunction with abstract devicemodels for compatible simulations as well as enablingcomparisons between different extraction, modeling

    and simulation techniques with a common baselineenvironment.

    1

    Introduction

    Increased design productivity is predicated on the

    development of new CAD tools for exploring largerdesign spaces more quickly and more thoroughly thancan be achieved with current techniques. This designexploration is most often accomplished in a design,simulate, analysis loop which is limited by boththe speed and quality of the simulation tools used for

    analysis and evaluation. For many designs, well knownmodels and design abstractions allow for the accurateanalysis of both analog and digital circuits using circuitsimulation tools such as SPICE [1]. It is often possible

    to use higher level abstractions and faster simulatorsfor timing and power estimations of large digitalsystems.

    However, for new technologies the simulation ofthe behavior of new devices and components are oftenad-hoc and incompatible with traditional simulation

    environments. Device model development is oftendone using physics based models implemented directlyin a programming language or with mathematicalmodeling tools such as MATLAB [2]. Therefore, it ischallenging to model systems composed of noveldevices together with conventional devices (e.g.,CMOS) in a single evaluation environment. There is an

    increasing need to evaluate these new devices, whichare often based on new technologies, or hybrids of

    existing technologies, and to simulate circuits andsystems that include both new and traditional devices.

    Not only do we need to provide a methodology forthese multi-technology simulations, but also, there is a

    need to evaluate new simulation techniques and newmodel extraction and abstraction techniques, such asreduced-order modeling. It is easier to evaluate thequality of these new modeling methodologies andsimulation algorithms if they can be easily integrated

    into an environment where standard circuit netlists canbe parsed and simulation results can be compared toexisting tools. However, integrating these new ideasinto open source versions of SPICE or other simulatorsis a time consuming and needlessly frustratingexercise. On the other hand, MATLAB gives a veryflexible environment and is currently in widespread usefor model development. However, to our knowledge,there are currently no non-linear circuit solvers, oranalog solvers, built into MATLABand no way to parse

    circuit netlists (e.g., SPICE decks) into MATLAB.In this paper we present our MATLABplatform for

    the simulation of novel devices in the context of

    traditional CMOS circuit netlists. The environmentalso provides a means to perform comparisons betweendifferent extraction, modeling and simulation

    techniques within a common modeling and simulationtool.

    2 ApproachOur work, to date, has resulted in a Perl[3] based

    SPICE netlist parser and translator that generatesMATLAB script files and supports such useful SPICE

    constructs as sub-circuits, input sources, and transistormodel parameters. The script is used as input to our

    MATLABnon-linear circuit solver. The solver is basedon the same non-linear iterative stamp based techniquedeveloped for SPICE, and currently supports adaptivetime-stepping, initial condition convergence, as well as

    Backwards Euler and trapezoidal integration methods.Generic SPICE options are provided such as RELTOL,

    ABSTOL, VNTOL, LVLTIM, and GMIN. The solvercurrently has hard coded models for resistors,inductors, capacitors, diodes and default MOStransistors. Support is also provided for custom MOS

    models as well as generic multi-port non-linearelectronic devices.

    Given that solver is written in MATLAB, the

    environment provides the ability to dump and load theinternal data structures, and thus generatesnapshots of

  • 8/13/2019 FDL_2007

    2/5

    the system state, for interaction with external circuitanalysis and optimization tools.

    It is important to note that these tools are in no way

    replacements for SPICE or any other simulation tooldeveloped primarily for fast simulation of analog

    circuits. Rather, these programs were developed to

    support our own research in non-linear circuitsimulation and model order reduction. Along the way,we realized it would be useful to be able to use SPICE

    netlists for our tests. Therefore, we have written thesesupport tools to translate a simple SPICE netlists into

    MATLAB scripts files along with some supporting

    MATLAB function files and a wrapper function. Thewrapper function ties these all together and invokes thenon-linear circuit solver. Our goal is to make thesetools available for other researchers who are doingsimilar research using MATLABto allow them to workwith common netlist formats and a stable simulation

    environment.

    Modified Nodal Representation:

    Mx=- Rx+B u; y= ETx+Du

    M Storage element

    R Conductance

    x State variables

    B, EConnectivity matricesu Excitation vectory Evaluation vector.C

    L

    0

    0

    CT

    LT

    M

    MT

    Template from aboundednon-linearelement (i.e., nodes

  • 8/13/2019 FDL_2007

    3/5

    integration loop is required. A linearization of theseelements is provided by using one of severalintegration techniques and the error in their application

    is estimated with an associated error bound algorithm.The convergence state reached in the inner loop is

    validated to meet the error tolerance that has been

    chosen for the evaluation.These three core tasks are used repeatedly by the

    simulator to perform its job of evaluating the operationof the system over time.

    4.1 Operating point and transient simulationThe minimal configuration for an analog solver

    involves two major stages: Initial operating (IO) pointevaluation (also known as DC evaluation) and transient

    evaluation. Transient evaluation requires a valid statefor the system to start from, consequently is usually

    preceded by the IO step.

    Initial operating point evaluation -The first majorstage for an analog solver is to find a valid operationpoint for the system at the requested initial time.Several strategies have been developed andimplemented through the commercial development of

    practical circuit solvers [6]. It is important to remarkthat in many situations, this is a crucial step andsometimes the most difficult bottleneck point in thesimulation. For this project, we have chosen toimplement several strategies to provide a highlyreliable IO step that is also efficient in terms of

    computation time. The algorithm uses three techniques.

    The use of GMIN (minimum conductance) as a

    leakage parameter for the initial estimation of anoperating point. These temporary leakage

    conductances are added between each node andthe reference node (GND). This strategy forces all

    loops in the electrical circuit to be closed, avoidingthe possible situation of unconnected (i.e.,floating) nodes, which are usually found whenusing nonlinear circuit elements during IC (initialcondition) evaluation. Floating nodes can cause anill-conditioned transfer matrix for the system, and

    in doing so create convergence problems.

    A first pass cold evaluation attempt. This is asimple evaluation of the circuit that does notconsider temporal dependencies (derivatives).Therefore, the storage elements in the circuit (C,L) are considered in steady state. Capacitors act as

    voltage sources and inductors as current sourceswith initial values corresponding to the IC valuesspecified in the netlist, or zero if not specified.

    A second pass, source stepping algorithm. This is astable and reliable algorithm where the circuit is

    considered initially not energized. Then, aprogressive step by step increase in the value of

    individual power (independent) sources isperformed. The final value of each steppingprogression is the DC value of the source in the

    netlist. When all of the sources are completelystepped, a final operating point is achieved. Whilethis is not the only possible operating point, if it is

    reached, it is a valid one, which is the main goal.Even though we are reaching for a DC operating

    point, we must consider the time dependencies ofthe system. Therefore, this algorithm tries toachieve convergence in the nonlinear evaluation

    by first using a simple time stepping algorithm,and in case of failure, reinitiates the evaluationusing local truncation based error (LTE) strategyfor the dynamic control of timesteps [7]. Thiscombination has proven to be both reliable andefficient.

    Transient Analysis - In this stage, the goal is to

    successively move the system through the given time

    period, generating its proper response within theallowed error tolerance at each advancing timestep.Starting from the operating point found in the previousstage, an iterative process is initiated to obtain thedesired response.

    The main core functionality of this stage is theconvergence algorithm, which, for this implementation,

    is based in an iterative gradient method. The mainkernel of this algorithm is shown in figure 2. We

    briefly describe each step.1. A validation of state information, operating point

    and input and output requirements is performed.2. The generation of stamps (i.e., templates) for

    storage elements is accomplished in this step.These stamps correspond to the linearization ofeach element based on the integration method

    selected.3. This the top of the main convergence loop.

    Nonlinear elements stamps are createdcorresponding to the operating point (at time tn).This is followed by an integration of these linearstamps into the MNA representation of the circuit.

    4. A linear solution is generated corresponding to thepredicted new operating point, for time tn+1.

    5. A check for convergence is performed. If thesolution is not convergent, (6) decrease thetimestep previously used, based on the dynamiccontrol algorithm in use.

    7. A dynamic control of the time step is performed.During this step, even if the system is convergent,

    the evaluation point can be rejected based on anunacceptable estimated error. On the other hand, if

    the evaluation is accepted, generate the nexttimestep to use, possibly relaxing the current timeinterval.

  • 8/13/2019 FDL_2007

    4/5

    8. If the end of the interval is reached terminate thealgorithm. If not, use the proposed next timestepcalculated above.

    5 ExamplesFigures 3 (a) and (b) show Vds vs. Ids sweeps for

    two NMOS transistor models in the simulator. Figure3(a) shows an implementation of the SPICE NMOS

    long channel model from [8]. This is the defaultmodel in the simulator. Figure 3(b) shows the unifiedshort channel model from [9] which has also beenimplemented. Note the figures are not on the samescale. Figure 3(c) shows the output waveforms fromour tool at three taps on a nine stage digital ring

    oscillator built from CMOS inverters, with each stage

    having a capacitive load.Figure 4 shows an NMOS astable multivibrator

    simulated in HSPICE and in our MATLAB simulation

    environment. The HSPICE simulations used level 1parameterized MOS models. The spice file was directlyparsed into the MATLAB format, including the modelparameters and run in the simulator. As shown infigures 4(b) and 4(c), both HSPICE and our simulatorfound initial conditions and simulated the circuit

    breaking into oscillation. However, in this casedifferent (but both valid) initial conditions weredetermined by the two programs. Figures 4(b) and 4(c)

    also show that the period of the two simulations differby about 10%. This is probably due to the lack of aparasitic companion capacitance in our current

    implementation of the MOS model.Figure 5 shows a simple CMOS differential

    amplifier simulated in HSPICE (level 1) model and thesame circuit simulated in our tool. It is important tonote that the solver needed no help finding the initial

    operating point, and once it was established, thesimulation kernel was quite efficient. On average, thesolver took three iterations to converge at each time-step, compared to an average of two iterations pertime-step for HSPICE.

    Figure 2: Transient analysis algorithm

    STOP

    Next

    Timestep

    TimestepAdjustment

    (LVLTM 1, 2)

    Re-evaluate

    - Nonlinear Elements StampGeneration

    - MNA Integration

    Validation andInput Output

    Setup

    Linear Solution

    Evaluation

    Stamp Generation forStorage elements

    (Integration Phase)

    1

    2

    3

    6

    Dynamic iteration controlalgorithm (LVLTM ? )

    - Simple Timestep Control (1)- LTE (2)

    no

    Convergence

    Check ?no

    yes

    Reach the end of timeinterval ?

    yes

    4

    5

    7

    8

    6 Generic Nonlinear ModelsIn support of new device models, we provide a

    generic user defined nonlinear device stamp. Thedevice model can be a stand-alone file with a MATLABfunction that represents the custom behavior of adevice. The external view of the model should be amulti-port nodal description. The function interface to

    the simulator need only provide the output nodalcurrent vector, a Jacobian matrix and an optionalHessian tensor for a given input vector of the devicesnode potentials. Device instantiation is by adding anelement into the circuit description with the appropriatenets in order, and the name of the function as the

    device model. The function will be called as needed

    by the simulator for both initial operating point andtransient analysis.

    7 Summary and ConclusionsThe result of this work is a MATLABplatform for

    the investigation of both new models and newsimulation techniques compatible with existing SPICEmodels of devices and netlists of circuits and systems.This will enable device designers to develop MATLABmodels and perform circuit simulation of devices basedon new circuit fabrication techniques and new material

    systems including nano-electronics, molecular

    electronics, organic semiconductors, carbon nanotubedevices, etc. This same environment will enable theevaluation of new methodologies for model extraction,abstraction, reduction, and simulation.

    8 AcknowledgmentsThis work was supported, in part, by the NationalScience Foundation grant CCF-0541150.

  • 8/13/2019 FDL_2007

    5/5

    Figure 3: Idssweeps using (a) Long Chanel [8] and (b) Short Channel [9] models (Note: scales

    not the same) (c) 3 nodes of a 9 stage CMOS digital ring oscillator in MATLAB

    (a)

    9 References9 References Computational Techniques, Prentice-Hall, New Jersey,1975.[6] HSPICE, Synopsis Inc.

    [7] J. H. Verner, Explicit Runge-Kutta Methods withEstimates of the Local Truncation Error, SIAM Journal

    on Numerical Analysis, Vol. 15, No. 4, Aug., 1978, pp.

    772-790, Jstor.[8] Daniel Foty, MOSFET Modeling with SPICE:Principles and Practice, Prentice-Hall, New Jersey,

    1997.[9] Jan Rabaey, Anantha Chandrakasan and Borivoje

    Nikolic, Digital Integrated Circuits: A DesignPerspective (2

    nded.), Prentice-Hall, New Jersey, 2002.

    [1] L. W. Nagel, "SPICE2: A computer Program toSimulate Semiconductor Circuits," ERL Memo. No.UCB/ERL, Vol M75/520 (1975).

    [1] L. W. Nagel, "SPICE2: A computer Program toSimulate Semiconductor Circuits," ERL Memo. No.UCB/ERL, Vol M75/520 (1975).[2] MATLAB, Mathworks, Inc.[2] MATLAB, Mathworks, Inc.

    [3] Larry Wall and Randal L. Schwartz, ProgrammingPerl, OReilly & Associates, California, 1991.[3] Larry Wall and Randal L. Schwartz, ProgrammingPerl, OReilly & Associates, California, 1991.

    [4] Damian Conway, Parse::RecDescent (RecursiveDescent Parser) version 1.94, CPANhttp://www.cpan.org/

    [4] Damian Conway, Parse::RecDescent (RecursiveDescent Parser) version 1.94, CPANhttp://www.cpan.org/[5] Leon O. Chua and Pen-Min Lin, Computer AidedAnalysis of Electronic Circuits: Algorithms and

    (b) (c)(b) (c)

    (a) (b) (c)

    Figure 4: (a) Astable Multivibrator, (b) HSPICE, (c) MATLABsimulations (same scale)

    (a) (b) (c)

    Figure 5: (a) CMOS Differential Amplifier, (b) HSPICE, (c) MATLABsimulations (same scale)

    http://www.cpan.org/http://www.cpan.org/http://www.cpan.org/http://www.cpan.org/http://www.cpan.org/http://www.cpan.org/http://www.cpan.org/http://www.cpan.org/http://www.cpan.org/http://www.cpan.org/