the designer’s guide to analog and mixed-signal modeling illustrated with vhdl-ams and mast

Upload: amanidarwish

Post on 03-Jun-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    1/356

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    2/356

    Copyright NoticeCopyright 2004 Synopsys, Inc. All rights reserved. Permission is granted to reproduce and distributecomplete copies of this book solely for non-commercial purposes. Any such copies must maintain thetrademark and copyright notices contained herein.

    Destination Control StatementAll technical data contained in this publication is subject to the export control laws of the UnitedStates of America. Disclosure to nationals of other countries contrary to United States law isprohibited. It is the readers responsibility to determine the applicable regulations and to comply withthem.

    DisclaimerSYNOPSYS, INC., AND ITS LICENSORS MAKE NO WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THEIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULARPURPOSE.

    Registered Trademarks ()Synopsys, Saber are registered trademarks of Synopsys, Inc.

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    3/356

    Dedications

    To Lori , Kendra , a nd R .J. for putt ing up w ith th e long hours a nd la te nights,

    I t ha nk you very much.. .

    To Ron Eicher and t he Lockheed-Ma rtin I nertia l G uidan ce La b team first a nd m ost for tea ching me h ow to be a design engineer,

    a nd a lso for int roducing me to th e world of simula tion.

    Thank you!

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    4/356

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    5/356

    Table of Contents

    Table of Contents ..............................................................................................................................5

    Preface .............................................................................................................................................13

    Chapter 1. The Promise of MSHDLs ............................................................................................1

    1.1. Why MSHDLs? ..................................................................................................................1

    1.2. About VHDL-AMS and MAST .........................................................................................1

    1.3. Who Can Benefit From MSHDLs? ....................................................................................2

    A. IC Designers ..................................................................................................................3

    B. ASIC Library Developers ..............................................................................................3

    C. ASIC Library Users .......................................................................................................3

    D. Board Designers .............................................................................................................3

    E. System Designers ...........................................................................................................4

    1.4. Why Create Your Own Models? .........................................................................................4

    A. Vendors Dont Have All Models ...................................................................................4

    B. Structural (Macro-) Modeling has Limitations ..............................................................4

    C. Designers Get the Best of Both Worlds .........................................................................5

    Chapter 2. Time-Domain Simulation ............................................................................................7

    2.1. Systems of Equations ..........................................................................................................7

    2.2. Digital Computer Simulation ..............................................................................................82.3. Linear Algebraic Equations ..............................................................................................10

    A. Linear Algebraic Example ...........................................................................................10

    2.4. Linear Differential-Algebraic Equations ..........................................................................13

    A. Numerical Integration ..................................................................................................14

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    6/356

    6 Contents

    B. Linear DAE Example ...................................................................................................15

    2.5. Nonlinear Algebraic Equations .........................................................................................19

    A. Newton-Raphson Method ............................................................................................19

    B. Linearizing the Characteristic Equations .....................................................................24

    C. Nonlinear Algebraic Example ......................................................................................26

    2.6. Nonlinear Differential-Algebraic Equations .....................................................................29

    A. Predictors and Correctors .............................................................................................29

    B. Nonlinear DAE Example .............................................................................................312.7. Chapter Summary .............................................................................................................35

    Chapter 3. VHDL-AMS Overview .............................................................................................37

    3.1. VHDL-AMS Model Terminology ....................................................................................37

    3.2. VHDL-AMS Modeling Options .......................................................................................38

    A. Parameterizing Existing Models ..................................................................................38

    B. Structural Modeling (Macromodeling) ........................................................................39

    C. Behavioral Modeling ....................................................................................................43

    D. VHDL-AMS Solvability Conditions ...........................................................................46

    3.3. AMS-Extensions for VHDL .............................................................................................46

    3.4. Constants and Generics .....................................................................................................49

    3.5. Test Benches .....................................................................................................................51

    3.6. VHDL-AMS Model Listing Conventions ........................................................................523.7. Chapter Summary .............................................................................................................52

    Chapter 4. MAST Overview .......................................................................................................53

    4.1. MAST Model Terminology ..............................................................................................53

    4.2. MAST Modeling Options .................................................................................................54

    A. Parameterizing Existing Models ..................................................................................54

    B. Macromodeling (Structural Modeling) ........................................................................56

    C. Behavioral Modeling ....................................................................................................61

    D. MAST Solvability Conditions .....................................................................................63

    4.3. MAST Structure and Conventions ....................................................................................63

    A. MAST Conventions and Syntax ..................................................................................63

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    7/356

    Contents 7

    B. General MAST Template Structure .............................................................................65

    4.4. Test Circuits ......................................................................................................................69

    4.5. Chapter Summary .............................................................................................................69

    Chapter 5. Introduction to Conserved System Modeling ............................................................71

    5.1. Simulation Models ............................................................................................................71

    A. Across and Through Variables .....................................................................................71

    B. Conservation Laws .......................................................................................................72

    5.2. Defining the Model ...........................................................................................................725.3. Electrical Building BlocksIdeal ....................................................................................73

    A. Constant Current Source ..............................................................................................73

    B. Constant Voltage Source ..............................................................................................74

    C. Linear Resistor .............................................................................................................76

    D. Linear Capacitor ..........................................................................................................77

    E. Linear Inductor .............................................................................................................78

    F. Voltage-Controlled Current Source (VCCS) ................................................................80

    G. Behavioral Op AmpIdeal .........................................................................................81

    5.4. Electrical Building BlocksNon-Ideal ............................................................................86

    A. Resistor with Temperature Dependency ......................................................................86

    B. Capacitor with ESR and Leakage ................................................................................88

    C. Behavioral Op Amp with Input/Output Characteristics ...............................................89

    5.5. Chapter Summary .............................................................................................................93

    Chapter 6. Developing User-Friendly Models ............................................................................95

    6.1. Bullet-Proofing Techniques ..............................................................................................95

    A. Example: Linear Resistor .............................................................................................96

    B. Example: Behavioral Op Amp ...................................................................................1006.2. Overcoming Numerical Limitations ...............................................................................109

    A. Solution 1 - Create "Design-Dependent" Components ..............................................110

    B. Solution 2 - Normalize Argument Values ..................................................................110

    6.3. Making Models Characterizable ..................................................................................... 112

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    8/356

    8 Contents

    A. Characterization Approaches ..................................................................................... 112

    6.4. Making Models Readable with Functions ...................................................................... 113

    6.5. Chapter Summary ...........................................................................................................116

    Chapter 7. Advanced Modeling Concepts ................................................................................117

    7.1. Piecewise Linear Modeling ............................................................................................117

    A. Voltage Limiter ..........................................................................................................117

    B. Ideal Diode .................................................................................................................120

    7.2. Time-Dependent Modeling .............................................................................................121A. Exponential Waveform Source ..................................................................................122

    B. Pulse Waveform Source .............................................................................................124

    C. Sinusoidal Waveform Source .....................................................................................129

    7.3. Foreign Subroutines ........................................................................................................134

    A. Foreign Subroutines with VHDL-AMS .....................................................................135

    B. Foreign Subroutines with MAST ..............................................................................136

    7.4. Chapter Summary ...........................................................................................................140

    Chapter 8. Signal Flow (Non-Conserved) Modeling ................................................................141

    8.1. The Top-Down Design Approach ...................................................................................141

    8.2. Characteristics of Signal Flow Models ...........................................................................144

    8.3. Signal Flow Modeling in the Time Domain ...................................................................144

    A. Gain Block .................................................................................................................145

    B. Two-Input Summer ....................................................................................................146

    C. Differentiator ..............................................................................................................147

    D. Double Differentiator .................................................................................................148

    E. Integrator ....................................................................................................................149

    F. Lead-Lag Compensator ..............................................................................................150G. Limiter Function .........................................................................................................152

    8.4. Signal Flow Modeling in the Frequency Domain ...........................................................154

    A. Two Pole Filter ...........................................................................................................155

    B. General Purpose 2nd Order Filter ..............................................................................157

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    9/356

    Contents 9

    8.5. Chapter Summary ...........................................................................................................159

    Chapter 9. Mixed-Signal Modeling ...........................................................................................1619.1. Solving Continuous and Discrete Systems .....................................................................162

    9.2. Analog to Digital Modeling Techniques .........................................................................164

    A. Detect Analog Thresholds .........................................................................................164

    B. Schedule Digital Events .............................................................................................166

    C. Analog to Digital Model Examples ...........................................................................166

    9.3. Digital to Analog Modeling Techniques .........................................................................180A. Detect Digital Events .................................................................................................180

    B. Synchronize Digital and Analog Signals ...................................................................181

    C. Provide Continuous Transitions for Analog Signals ..................................................182

    D. Digital to Analog Model Examples ...........................................................................184

    9.4. Connecting Analog and Digital Models .........................................................................192

    A. Interface Models ........................................................................................................192

    B. Example - A/D Interface Model .................................................................................193

    C. Example - D/A Interface Model .................................................................................198

    9.5. Chapter Summary ...........................................................................................................201

    Chapter 10. Sampled Data Modeling ..........................................................................................203

    10.1. Characteristics of Sampled Data Models ......................................................................20310.2. Z-Domain Building-Block Models ...............................................................................204

    A. Sample/Hold (analog to z-domain) ............................................................................204

    B. Linear Combination ...................................................................................................207

    C. Delay ..........................................................................................................................209

    10.3. Transforming From S-domain to Z-Domain .................................................................212

    A. Transforming a Lowpass Filter ..................................................................................212B. Creating Difference Equations ...................................................................................214

    C. Creating the Simulation Models ................................................................................215

    10.4. Chapter Summary .........................................................................................................219

    Chapter 11. Hydraulic and Mechanical Modeling ......................................................................221

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    10/356

    10 Contents

    11.1. ABS System ..................................................................................................................221

    11.2. Hydraulic System Operation and Models .....................................................................222

    A. Fluid Chamber ...........................................................................................................225

    B. Spring Acting Extend Actuator ..................................................................................229

    C. Accumulator ...............................................................................................................232

    D. 2-Way Hydraulic Valve ..............................................................................................235

    11.3. Mechanical System Operation and Models ..................................................................241

    A. Translational Mass .....................................................................................................244

    B. Translational Nonlinear Spring ..................................................................................245

    C. Translational Damper .................................................................................................247

    D. Translational Hard Stop .............................................................................................248

    11.4. Mixing Technology Domains ........................................................................................250

    A. Electrical/Mechanical DC Motor ...............................................................................251

    B. Mechanical/Hydraulic Pump ......................................................................................25311.5. Chapter Summary .........................................................................................................257

    Chapter 12. Simulator Convergence ...........................................................................................259

    12.1. Numerical Oscillation and Divergence .........................................................................259

    A. Numerical Oscillation ................................................................................................259

    B. Numerical Divergence ...............................................................................................260

    C. Newton Damping .......................................................................................................260

    12.2. Other Convergence Problems and Solutions ................................................................264

    A. Discontinuous Functions ...........................................................................................264

    B. Discontinuous First Derivatives .................................................................................267

    C. Zero Slope Models .....................................................................................................271

    12.3. Debugging Models ........................................................................................................274

    A. Define Test Circuits ...................................................................................................274

    B. Use Available Debugging Utilities ............................................................................275

    C. Use Embedded Model Messaging ..............................................................................275

    12.4. Chapter Summary .........................................................................................................277

    http://-/?-http://-/?-
  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    11/356

    Contents 11

    Appendix A. DAE Simulator Example Solutions ..................................................................279

    A.1. Linear Algebraic Equation Solutions .............................................................................279

    A. Linear Algebraic Example .........................................................................................281

    A.2. Linear Differential-Algebraic Equation Solutions .........................................................283

    A. Linear DAE Example .................................................................................................284

    A.3. Nonlinear Algebraic Equation Solutions .......................................................................288

    A. Nonlinear Algebraic Example ...................................................................................289

    A.4. Nonlinear DAE Solutions ..............................................................................................292

    A. Nonlinear DAE Example ...........................................................................................292

    Appendix B. MAST Supplement ...........................................................................................301

    B.1. Mathematical Functions and Expressions ......................................................................301

    A. Expressions With Operators ......................................................................................301

    B. Mathematical Functions .............................................................................................302C. If Statements and Expressions ...................................................................................302

    B.2. Mixed-Signal Modeling .................................................................................................304

    A. Variable Types ............................................................................................................304

    B. When Statements ........................................................................................................304

    B.3. Simulator Variables and Functions .................................................................................305

    A. Simulator Variables (Simvars) ...................................................................................305B. Event_on Function .....................................................................................................306

    C. Schedule_event Function ...........................................................................................307

    D. Deschedule Function ..................................................................................................308

    E. Schedule_next_time Function ....................................................................................308

    F. Threshold Function .....................................................................................................309

    B.4. Stress Analysis ...............................................................................................................310

    A. DC Motor Model Example ........................................................................................312

    B. Built-in Bullet-Proofing Functions ............................................................................313

    B.5. Statistical Analysis .........................................................................................................315

    A. Statistical Resistor Model Example ...........................................................................316

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    12/356

    12 Contents

    B.6. Sample Points .................................................................................................................317

    A. Sample-Point Considerations .....................................................................................317

    B. Sample Point (and Newton Step) Specification Syntax .............................................319

    Appendix C. Glossary of Terms ............................................................................................321

    C.1. General Terms ................................................................................................................321

    C.2. VHDL-AMS Terms ........................................................................................................323

    Appendix D. References ........................................................................................................329

    Appendix E. Index .................................................................................................................331

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    13/356

    Preface

    I will always remember my fifth year out of college. I had just been made a lead analog designengineer in an R&D department for a large aerospace company. My first project in this role was todetermine if the existing hydraulics-based thrust-vector control (TVC) actuatorsthe steeringnozzles for heavy launch vehiclescould be replaced with all-electric actuators.

    This was a daunting task to say the least. I was still learning the ropes as a design engineer, yet wasexpected to build a functional proof-of-concept prototype of this new all-electric TVC actuator. Iwas in over my head and I knew it. The risk of not being able to successfully complete the projectwas very high, and I hoped that simulation technology could help me through the crisis.

    I was using a popular SPICE-based tool for circuit simulations at the time. This tool worked greatfor the majority of my projects to date, which consisted mainly of electronic filters and other analogsignal conditioning electronics.

    But as I began designing and simulating pieces of the new all-electric TVC system, it became

    increasingly difficult to get any real benefit from the simulatorI was having to force-fit mydesign ideas into clunky and often inappropriate simulator implementations. I was modelingmathematical functions out of collections of op amps, rather than in the software language in whichthey were to be implemented on the real system; I was modeling decision-matrix functions out oflogical gates, rather than EPLD programming languages.

    The models to get the job done were just not available: I needed mixed-technology models for aninduction motor, a tachometer, and a torque sensor; I needed mathematical-based models forsinusoidal phase and coordinate frame transformers; and I needed mixed-signal models for EPLD

    and microprocessor algorithm testing. My simulator did not have these models or capabilities.It was at this juncture that I began to realize a fundamental truth: my simulator was ill-equipped tohandle real system designsparticularly mixed-signal and mixed-technology systems. It wasnt

    just the lack of models, but the lack of any convenient way to develop either mixed-technology ormixed-signal models. And there was certainly no way to simulate the TVC system along with the Csoftware algorithms that controlled it (which I wanted to test and debug while the system was beingbuilt).

    Then I made a wonderful discovery. I was introduced to the Saber simulator originally developedby Analogy, Inc., now owned by Synopsys . Saber was different than my SPICE simulatorit wasbased on a Mixed-Signal Hardware Description Language (MSHDL) called MAST. Saber modelswere developed with a modeling language!

    With MAST I enjoyed great modeling freedom. I was not only able to develop the various mathe-matical-based models I needed, but was also able to develop mixed-signal and mixed-technology

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    14/356

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    15/356

    Preface 15

    VHDL-AMS language features.

    MAST Overview - This chapter presents a brief overview of MAST. Examples ofparameterizing existing MAST models are given, as well as how to develop macromodels.Behavioral modeling is also introduced along with several MAST language features.

    Introduction to Conserved System Modeling - Several conservation-based models arediscussed in this chapter. Both ideal and non-ideal modeling examples are given.

    Developing User-Friendly Models - This chapter discusses bullet-proofing techniquesfor models; how to model around common numerical limitations of simulators; makingmodels characterizable; and making models readable by using functions.

    Advanced Modeling Concepts - Piecewise linear and time-domain modeling arediscussed in this chapter, along with how to couple subroutines written in a programminglanguage with VHDL-AMS or MAST models.

    Signal Flow Modeling - This chapter introduces non-conserved model development.Distinctions between non-conserved and conserved modeling are made, and the

    advantages of each are discussed.

    Mixed-Signal Modeling - This chapter is focused on mixed-signal models. Severalexamples of mixed A to D and D to A models are given, as well as general discussionsregarding mixed-signal simulation.

    Sampled Data Modeling - This chapter illustrates z-domain model development, and alsoshows how to transform s-domain system descriptions into the z-domain.

    Hydraulic and Mechanical Modeling - In this chapter an anti-lock brake system (ABS)design in discussed. Several mechanical and hydraulic models which comprise this systemare detailed.

    Models and Convergence - "Good modeling for convergence" guidelines are discussedin this chapter, as well as some useful model debugging techniques.

    Appendices - Detailed differential-algebraic equation (DAE) example solutions, MAST

    reference, glossary of terms, suggested reading references, and a subject index areincluded as appendices to the book.

    Together, these chapters should give the reader a solid foundation for modeling with VHDL-AMSand MAST.

    Some readers will be interested in either VHDL-AMS or MAST, but not both. The document hasbeen organized so that either language can be learned independently. The overall theme of the book

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    16/356

    16 Preface

    is to introduce a modeling topic and describe it mathematically. Then separate VHDL-AMS andMAST implementations of the model will be given.

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    17/356

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    18/356

    18 Preface

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    19/356

    chapter 1The Promise of MSHDLs

    Mixed-signal hardware description languages (MSHDLs) are powerful tools with which systemsand circuits of virtually any complexity can be modeled for simulation. Not only mixed-signalsystems, but mixed-technology systems can be modeled as well.

    The range of applications resulting from this capability is astounding. From ICs to ASICs toelectronic board-level designs to hierarchical systems designsall can be modeled with MSHDLs,and even simulated together as desired.

    1.1. Why MSHDLs?

    Mixed-signal simulation is an essential element in todays design environment. This is not just dueto the fact that most electronic systems today contain some combination of analog and digitalcircuitry, but also because the size, complexity, and operating speeds of these circuits and systemshave grown tremendously over the last decade.

    Rising to meet the growing needs of their users, simulator vendors have made great advances increating tools that are easy-to-use while still providing the accuracy essential for design analysis.Today, mixed-signal simulators are as available as those used exclusively for analog or digitaldesigns, and engineers are using them routinely on a wide variety of projects.

    Mixed-signal simulation has led to dramatic improvements both in design quality and intime-to-market. Designers who are now finding mixed analog/digital circuit design increasinglycommon come from a wide range of disciplines, including IC, ASIC, board, and system design.

    Mixed-signal modeling languages have also been developed. The three dominating options areMAST, and the new VHDL-AMS and Verilog-AMS languages.

    1.2. About VHDL-AMS and MASTThe design objectives of both the VHDL-AMS and MAST modeling languages support thehierarchical description and simulation of analog, digital, and mixed analog/digital systems withconservative and non-conservative semantics. The languages support modeling of lumped systemsat a variety of abstraction levels, from system to board to chip.

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    20/356

    2 Chapter 1The Promise of MSHDLs

    Modeling is not restricted to electrical systems but also supports thermal, hydraulic, optical, andother disciplines. Designs with mixed-technologies can be described and simulated withoutrestrictions, including components that span technologies like electrical/mechanical andmechanical/hydraulic devices. Support for mixed-technology applications is particularly importantfor designers that apply chips in a larger design, because experience shows that most of the errors insuch situations occur at the interfaces, either because the interfaces were not understood completelyor because they were not specified correctly.

    The analog parts of these languages have a strong foundation in the theory of differential-algebraicequations, a theory developed over the past twenty years by numerical mathematicians. Thisfoundation makes it unnecessary to specify how exactly a simulator must solve the equations, a

    feature that gives the designer much desired flexibility to choose suitable algorithms.This book provides numerous model examples written in both VHDL-AMS and MAST. Whilemany language features will be discussed, this book is not intended as either a VHDL-AMS orMAST language referenceit is intended as a modeling reference, with examples in VHDL-AMSand MAST. This book is also focused on analog and mixed-signal modeling (not digital modeling),and this approach is reflected by the model examples.

    1.3. Who Can Benefit From MSHDLs?VHDL-AMS and MAST bring both immediate and long-term benefits for a designer. First, adesigner can implement a true top-down design methodology for analog and mixed-signal designs.Experience with top-down design for digital systems has shown that this methodology improvesproductivity and facilitates concurrent engineering where one subsystem is designed in one place,and the other someplace else. Still, the subsystem can be tested as part of the whole system.

    Second, since the languages remove the restrictions imposed by built-in models in many existingtools, they open many new application areas for simulation, limited only by the languages and theimagination of the user. The immediate benefit is that a designer can make design trade-offs acrosstechnologies. For example, in an electronic fuel injection system, it may be more cost effective tomake a modification to the hydraulic part than to the electronic controller. The lack of suchcapabilities has limited the simulation of many problems arising in industrial control.

    Finally, in the long term, these languages will enable the development of new technology. If welook at the digital world as an example, we can expect commercial products supporting thesynthesis of analog and mixed-signal devices. So far, analog synthesis has been confined touniversities, and one of its challenges has been to capture a design. Additionally, high level designtools for analog and mixed-signal design can be expected. Finally, tools may be developed tosupport the behavioral abstraction of a circuit level model.

    So, who can benefit from MSHDLs?

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    21/356

    Who Can Benefit From MSHDLs? 3

    A. IC Designers

    Integrated circuit designers typically create new designs based on rapidly evolving IC processes.Existing design libraries are bypassed as process technology evolves or as new cells are requiredfor new applications.

    The simulation models needed to support the required new libraries must fill two roles. First, theymust be able to be developed at different levels of complexity; second, they must be developed atvarious levels of abstraction to support simulation from the primitive level all the way up to theentire chip.

    Due to the general movement toward mixed-signal designs, the ability to model an ever-increasing

    amount of analog functionality along with digital logic circuits is essential. This trend is even moreprevalent for IC designers as digital technology approaches speed or density extremes, whichallows analog effects to crop up in otherwise pure digital designs. Often, to verify the operation ofhigh performance ICs, critical digital timing paths need to be represented as analog circuits ortransmission lines.

    B. ASIC Library Developers

    ASIC library development is similar to IC design, except that blocks of circuitry are represented bya configurable functional cell. These cells must be represented, or modeled, as accurately aspossible so that their performance correctly maps to the underlying circuit topology.

    Another requirement is fast model simulation, so large chip simulations are practical. Hardwaredescription languages for both digital and analog functionality is crucial to successfully simulateASIC cells.

    C. ASIC Library Users

    ASIC library users use cells from ASIC libraries to build complete designs. Both simulationperformance and flexibility are required by these users, as well as confidence that accuracy hasbeen built in by the library developer.

    Users rarely build their own cells, concentrating instead on the higher-level circuits containing thepredefined cells. For ASIC users, it is useful to be able to simulate the circuit or system surroundingthe ASIC in order to verify the designs performance. In this sense, the needs of ASIC users arecloser to the needs of board designers than to IC designers.

    D. Board Designers

    Printed circuit board designers, like ASIC library users, build circuits from available standard parts.Given the potential complexity at the board level, optimum simulation performance is oftenpreferable to detailed description of internal device characteristics.

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    22/356

    4 Chapter 1The Promise of MSHDLs

    If no models are available for certain standard parts, board designers may need to develop themfrom available data sheets. For simulator performance and fast modeling, a high-level method isneeded for describing components and for simulating digital together with analog characteristics.

    E. System Designers

    System designers need a high-level perspective of their application. A variety of signal types mustbe used to represent a system accurately, which may include standard ICs, ASICs, power devices,microprocessors, transducers, and even electromechanical devices. This level of design requires aversatile simulation approach that can handle concurrent simulation of all the different types ofcomponents in the system.

    People have been simulating circuits for years. One of the biggest limitations to system simulationwas the unavailability of models. With the introduction of MSHDLs, designers finally have thepower to create their own models.

    1.4. Why Create Your Own Models?

    A. Vendors Dont Have All Models No matter how diligently model vendors work to keep up with new devices and components theindustry produces, they always lag behind the designers need for the models. Designers oftencannot wait and must decide to quickly develop a new electronic model, or model a mechanicaleffect.

    B. Structural (Macro-) Modeling has Limitations

    Before the advent of MSHDLs, SPICE and SPICE derivatives were the only real choice for circuitsimulation. This approach has worked well in some areas, but not so well in others. The basicmethod for creating a new model in SPICE is to combine pre-existing building blocks to achieve

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    23/356

    Why Create Your Own Models? 5

    the desired functionality. Take the simplified op amp structural model (macromodel) in Figure 1.4-1 :

    This op amp model was created by configuring predefined resistor, capacitor, transistor, and otherbuilding blocks to achieve the desired function. While the function can be realized in this manner, itis rather hard to parameterize and reconfigure if needed. For example, how can we easily determinethe break frequencies f1 and f2? How about the open-loop gain? Input/output resistances?

    Working with this type of macromodel can be a real limitation to a circuit or systems designer whoneeds a model quickly. This type of designer just wants a model that can be easily parameterizedfrom a databook, but there is no one-to-one correspondence between the databook parameters andthe model implementation shown in Figure 1.4-1.

    An even greater limitation of macromodeling is the need for the pre-defined building blocks in the

    first place. Resistor, capacitor, transistor models and the like are commonly available as buildingblocks, but what if a designer needs special effects for these models like temperature dependency?What if the designer needs, for example, a z-domain component and no core model exists at all?How about a hydraulic or mechanical component that cannot be easily described with standardbuilding block components? Designers may have several critical requirements that are not possibleto model using pre-defined building blocks.

    C. Designers Get the Best of Both Worlds

    Perhaps the most powerful feature of MSHDLs is their flexibility. Not only can traditionalstructural macromodeling approaches be used, but behavioral models can be developedand bothof these capabilities can be combined in a single model. The real power of both VHDL-AMS andMAST is that they give the designer the power to choose the appropriate modeling approach,whether it be a structural macromodel, a behavioral description, or a combination of the two: thedesigner gets to choose the best approach to solve the problem!

    Fi ure 1.4-1. Bo le o am macromodel 1973 IEEE .

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    24/356

    6 Chapter 1The Promise of MSHDLs

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    25/356

    chapter 2Time-Domain Simulation

    Before delving into discussions on modeling, a fundamental understanding of how digital computersimulators work should prove useful.

    How do simulators perform their magic? This chapter answers this question for analog(continuous) differential-algebraic equation (DAE) solvers. Because this is a vast subject, and thisbook is focused on modeling issues, the discussion is limited to the bread and butter of analogsystems simulation: the time domain. Mixed-signal systems will be discussed in Chapter 9:

    Mixed-Signal Modeling .

    2.1. Systems of EquationsWhat exactly does a simulator do? It solves systems of equations. There are many ways of doingthis, of course, and some of the more popular methods are discussed below.

    Say for example, we wish to solve the following quadratic equation:

    We could solve this equation (i.e. determine which two values of x make the equation true) usingstandard factoring techniques. Our result would be:

    and the solutions, obtained by setting each factor equal to zero and solving for x, would be: x = -1/2and x = -1 .

    This method of factoring works fine for a quadratic equation such as this. However, as the order ofthe system increases there is no simple factoring technique which can be employed. The same holdstrue for equations containing transcendental functions. For example, there is no factoring techniquethat will allow the following function to be solved:

    2x2

    3x 1+ + 0= (2.1-1)

    2x 1+( ) x 1+( ) 0= (2.1-2)

    e x 2x 2+( ) 0= (2.1-3)

    8 Ch t 2 Ti D i Si l ti

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    26/356

    8 Chapter 2Time-Domain Simulation

    Even though this equation has only one unknown, the problem is that there is no obvious way toseparate the x from e -x without generating another transcendental function in x. This is a basiclimitation of conventional mathematical techniques.

    So how do we get around this fundamental limitation? Digital computer simulation.

    2.2. Digital Computer SimulationDigital computer simulation has become an integral tool in the engineering community over thepast few decades. It is playing an ever-increasing role in the design of electrical and non-electricalsystems. The overall flow of the steps performed by a simulator to solve a network is illustrated inFigure 2.2-1 .

    The main characteristic that distinguishes digital computer simulation is that all quantities take ondiscrete valuesincluding time. To a digital computer simulator, time is broken down into

    Time-Domain Simulation Flow

    System described as networkequations.

    Initial guess at step size.

    If derivatives present, use numericalintegration to remove them.

    If nonlinear, linearize the system.

    Use standard techniques to solvelinear system (LU decomposition).

    If convergence not achieved, performanother iteration.

    If error too big, reduce timestep, andrepeat steps beginning with numericalintegration.

    If error OK, process digital events.

    If simulation end time not reached,take next step and repeat process.

    If end time reached, write results.

    Figure 2.2-1. Simulation flow for nonlinear differential-algebraic systems.

    Solve the linear system

    Numerical Integration

    Linearize the system of equations

    Converged? No

    Local Trerror Nowithin bounds?

    Make initial guess of next time step h

    Events processing

    Yes

    Yes

    time = tend? No

    Yes

    Write result

    time = time + h

    Reduce h

    Formulation of the network equations

    Digital Computer Simulation 9

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    27/356

    Digital Computer Simulation 9

    incremental chunks called timesteps, and simulators will solve systems of equations at each oneof these timesteps, as shown in Figure 2.2-2.

    Figure 2.2-2 is interpreted as follows: starting at time zero ( tn), algebraic equations describing thesystem are generated from a combination of the system models and their connections to each other.Next, each node in the system is solved such that Kirchoffs Current LawKCL (or an equivalentversion of KCL for non-electrical systems) is satisfied for all nodes. In Figure 2.2-2 , the solution attime zero was determined at tn (which can be translated to "time now"). The node solutioncorresponding to tn is represented by xn , and its solution is that point where it crosses the x-axis(where y=0).

    After a solution is obtained, time is advanced one step, indicated by tn+1 (which can be translated to

    "time now plus one timestep"). Then, the equations to be solved are re-generated, and a newsolution, xn+1 is obtained. This process is repeated until the simulation end time is reached.

    The solutions for various nodes are then typically plotted as a function of time, resulting in familiartime-domain waveforms. These waveforms may appear as continuous functions of time, but theyare actually discrete points plotted at intervals equal to the step size used. These discrete points arethen typically connected by small straight lines, smoothing them, and producing the appearance ofcontinuous waveforms.

    Although there are an infinite number of possible system configurations that can be simulated, thesystems of equations describing any continuous network will fall into one of the following fourcategories:

    Linear Algebraic Equations Linear Differential-Algebraic Equations Nonlinear Algebraic Equations Nonlinear Differential-Algebraic Equations

    yy = f (x n, t n)

    xx n

    yy = f (x n+1 , t n+1)

    xx n+1

    yy = f (x n+2 , t n+2)

    xx n+2

    tn

    tn+1

    tn+2

    The simulator constructs andsolves the function y = f(x n, tn)at the first timestep, t n.

    When t n is solved, the functiony = f(x n+1 , tn+1 ) is constructedand solved at the followingtimestep, t n+1 .

    When t n+1 is solved, thefunction y = f(x n+2 , tn+2 ) isconstructed and solved at thefollowing timestep, t n+2 .

    Figure 2.2-2. Equation generation at each timestep.

    10 Chapter 2Time-Domain Simulation

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    28/356

    10 Chapter 2 Time Domain Simulation

    Overviews of how each of these systems can be solved using digital computer simulationtechniques are presented in the remainder of this chapter. Detailed step-by-step solutions toexamples of these systems are presented in Appendix A.

    This chapter will detail the steps by which these systems may be solved in general. There areseveral techniques whereby simulators enhance the solvability and/or efficiency of simulationwhich will not be discussed here. For example, a simulators ability to take advantage of sparsematrices, and matrix pivoting techniques are useful to the simulator developer, but not essential tocircuit/system designers who want to develop a basic understanding of the simulation process.

    2.3. Linear Algebraic EquationsThe ability to solve linear algebraic equations lies at the core of digital computer simulators.Networks of this type are by far the easiest to solve because there are no time-dependent elementsin the equations, and many powerful matrix algebra techniques can be directly employed to solvethem.

    A. Linear Algebraic Example

    We will use the network shown in Figure 2.3-1 to illustrate one method by which a simple linearalgebraic system may be solved using computer simulation.

    In order to solve the linear network of Figure 2.3-1 , we will employ the following steps:

    1. Create a KCL equation for each node ( v1 and v2).2. Convert resistance values to conductance values (this step can be combined with step 1).3. Generate conductance, voltage, and source matrices, and express in network form.4. Solve for the voltage matrix.

    Performing these steps on the circuit shown in Figure 2.3-1 :

    Figure 2.3-1. Linear algebraic network example.

    R1

    R2

    Isrc

    gnd

    v1 v2

    R3

    Linear Algebraic Equations 11

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    29/356

    g q

    Create KCL Equation for Each Node

    Use KCL at each of the voltage nodes, v1 and v2 to generate the system equations:

    Convert Resistance Terms to Conductance

    Multiplying through by G2 and collecting terms:

    Generate Conductance, Voltage and Source Matrices

    In matrix form, these equations can be represented as Equation (2.3-4) :

    Solve for the Voltage Matrix

    Equation (2.3-4) is a specific instance of the more general matrix equation form given by Equation (2.3-5) :

    Replacing the coefficient matrix A with the conductance matrix G, the unknown x matrix with v,and the matrix b with the current matrix i, (2.3-5) can be expressed as shown in Equation (2.3-6) :

    v1R1------

    v1 v2

    R 2-----------------+ i src=

    v1 v2

    R 2-----------------

    v2R3------=

    (2.3-1)

    G1 v1 G 2+ v 1 v 2( ) isr c=

    G 2 v1 v 2( ) G3v2=(2.3-2)

    G1 G 2+( )v1 G2 v2 i sr c=

    G 2v1 G2 G 3+( )v2 0=(2.3-3)

    G1 G2+ G 2

    G 2 G 2 G 3+( )

    v1

    v2

    isrc0

    = (2.3-4)

    Ax b= (2.3-5)

    Gv i= (2.3-6)

    12 Chapter 2Time-Domain Simulation

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    30/356

    The voltage matrix v is then equal to the inverse of the conductance matrix G times the currentmatrix i:

    Equation (2.3-4) can then be solved using the form shown in (2.3-7) with standard matrix solutiontechniques, such as Gaussian elimination or LU decomposition.

    The system of Figure 2.3-1 was simulated using the following component and simulation values:G1=0.5, G2=1, G3=1, timestep ( h) = 1.0, initial v1=v2=0, and Isrc ramps from 0A to 1A in steps of0.1A each second. The results of repeating the solution process for several timesteps are given inFigure 2.3-2 .

    The solutions given in Figure 2.3-2 are what we would expect for a simple voltage divider circuit inresponse to a ramp input.

    As can be seen from the figure, the abscissa of each measured point corresponds to the timestep,and the ordinate gives the voltage value (any differences between the data in the table andmeasured data is due to the measurement approach).

    A complete solution to this circuit is given in Appendix A.

    The systems of equations used to describe a typical network will include differential as well asalgebraic terms. These equations are referred to as differential-algebraic equations (DAEs), and arethe subject of the next section.

    v G 1 i= (2.3-7)

    time v1(n+1) v2(n+1)1.0 0.100000 0.050000

    2.0 0.200000 0.100000

    3.0 0.300000 0.150000

    4.0 0.400000 0.200000

    5.0 0.500000 0.2500006.0 0.600000 0.300000

    7.0 0.700000 0.350000

    8.0 0.800000 0.400000

    9.0 0.900000 0.450000

    10.0 1.000000 0.500000

    Figure 2.3-2. Linear algebraic network response to ramp input.

    Linear Differential-Algebraic Equations 13

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    31/356

    2.4. Linear Differential-Algebraic EquationsSo far we have discussed the important class of linear algebraic systems and their solutions. Wenow complicate matters slightly by adding derivatives to the system of equations.

    Differential equations require different solution techniques than algebraic equations becausedifferential equations cannot be solved in the traditional sensethe unknowns cannot bealgebraically separated from the differential operators and collected on one side of the equals sign.

    For example, take a current source, resistor, and capacitor in parallel as shown in Figure 2.4-1 .

    The nodal equations describing this system are shown in Equation (2.4-1) :

    In this differential equation, v cannot be readily isolated from the rest of the equation. So how canthe system be solved? We will use a little common-sense to come up with a solution, and thendiscuss formal approaches to solve linear differential-algebraic systems.

    If we think about solving (2.4-1) on a digital computer, the derivative term, which represents theslope of a line, can be expressed as shown in Equation (2.4-2) :

    Where vnew and vold represent the voltages across the capacitor at the current and previoustimesteps, respectively, and step size is the size of the timestep. Another way to express (2.4-2) isgiven in Equation (2.4-3) :

    Figure 2.4-1. Parallel IRC circuit.

    R CIsrc

    gnd

    v

    Ctd

    d v vR----+ i sr c= (2.4-1)

    Ctd

    d v Cvne w vol d

    stepsize---------------------------- (2.4-2)

    Ctd

    d v Cvn 1+ vn

    h------------------------ (2.4-3)

    14 Chapter 2Time-Domain Simulation

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    32/356

    Equation (2.4-3) gives a more conventional form for describing discrete quantities used withcomputer simulation. In this case, the next (new) voltage value is designated vn+1 , and the previous(old) value is designated vn. The step size is denoted by the variable h .

    Now, our original linear differential-algebraic problem given in (2.4-1) can be restated as shown inEquation (2.4-4) :

    We have thus transformed a differential-algebraic equation into a time finite difference algebraic

    equation. The voltage can now be determined by algebraically solving (2.4-4) for vn+1 . The processdigital computers use to convert differential terms into algebraic terms is called numericalintegration .

    A. Numerical Integration

    In general, the basic approach used to solve a differential equation is to take out the differentialterms by integrating them. For a digital computer employing a DAE simulator, solving adifferential equation is generally accomplished with numerical integration methods. There areseveral integration methods commonly employed in simulators. The most popular are forwardEuler, backward Euler (Gear 1), the trapezoidal method, and Gear 2. These will be discussed inturn.

    Forward Euler

    The general equation for the forward Euler integration method is given in Equation (2.4-5):

    This formula estimates the value of a function at the next timestep, tn+1 , by adding the value of thefunction at the current timestep to the product of the timestep size (step size) and the derivative ofthe function at the current timestep.

    In this case, the value of the function at the next timestep, Y(tn+1 ), depends only on informationfrom the current timestep, Y(tn). For this reason, the forward Euler integration method serves as agood way to get an initial estimation of the value of a function at the next timestep.

    Backward Euler

    The backward Euler formula is shown in Equation (2.4-6) :

    Cvn 1+ vn

    h------------------------

    vn 1+R

    -------------+ i sr c n 1+= (2.4-4)

    Y t n 1+( ) Y t n( ) stepsize td d

    Y t n( )+= (2.4-5)

    Y t n 1+( ) Y t n( ) stepsize td d Y t n 1+( )+= (2.4-6)

    Linear Differential-Algebraic Equations 15

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    33/356

    This is very similar to the forward Euler formula, with one important catch: the derivative of thefunction at the next timestep must be known. But since that step has not yet occurred, this pointmust be somehow guessed at or estimated. This brings us to the concept of prediction andcorrection, which is discussed in Section 2.6. The backward Euler method is sometimes referred toas Gear 1.

    Trapezoid Rule

    An often better numerical integration option than the backward Euler method is the trapezoid rule.This approach works well because it uses the average of the forward Euler method (which tends toproduce negative errors), and the backward Euler method (which tends to produce positive errors),

    so the errors average out somewhat. The trapezoid rule is given in Equation (2.4-7) :

    The trapezoid rule does have the same limitation as the backward Euler approach in the sense thatthe derivative of the function at the next timestep must be known. Also, although it is very popular,in some cases the trapezoid rule may cause ringing on the circuit being simulated. Anotheralgorithm, Gear 2 may be a better choice to avoid this problem.

    Gear 2

    The Gear 2 method extends the previous approaches by taking a weighted average of the next,current, and previous solutions to better predict a solution at the next timestep. It is shown inEquation (2.4-8) :

    In most cases, the Gear 2 method is nearly as accurate as the trapezoid rule, and also has theadvantage of being more stable. Because of this stability, it does not have a tendency to oscillate.

    B. Linear DAE Example

    To solve linear DAEs, an original equation is defined with algebraic as well as differential terms.To solve these equations, a numerical integration formula, or combinations of numerical integrationformulas are employed. In essence, these integration formulas are used to transform the differential

    Y t n 1+( ) Y t n( )stepsize

    2---------------------

    td d Y t n 1+( ) td

    d Y t n( )++= (2.4-7)

    Y t n 1+( )43--- Y t n( )

    13--- Y t n 1( )

    23--- stepsize

    td d Y t n 1+( )+= (2.4-8)

    16 Chapter 2Time-Domain Simulation

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    34/356

    terms into algebraic terms. The numerical integration formulas can be rearranged to assist in thissubstitution, as shown for the backward Euler formula in Equation (2.4-9) :

    The right-hand side of (2.4-9) can be directly substituted into the differential terms of the originaldifferential equation. This results in an algebraic equation.

    We will use the network shown in Figure 2.4-2 to illustrate how a simple linear differential-alge-braic system may be solved using digital computer simulation.

    The steps for solving a linear DAE example using computer simulation are:

    1. Use KCL to generate algebraic-differential equations.2. Create conductance and capacitance matrices.3. Isolate differential terms on one side of the equation.4. Replace differential terms with numerical integration formula.5. Solve the new, algebraic equations using standard matrix algebra techniques.

    Generate System of Equations using KCL

    The equations describing this network are as follows:

    td d Y t n 1+( )

    Y t n 1+( ) Y t n( )stepsize

    -----------------------------------------= (2.4-9)

    Figure 2.4-2. Linear differential-algebraic network example.

    R1 C1Isrc

    gnd

    v1R2 v2

    R3

    C2

    G1v1 C 1 td d v1 G2++ v 1 v 2( ) C2 td d v1 v 2( )+ i sr c=

    G2 v1 v 2( ) C2 td d

    v1 v 2( )+ G 3v2=(2.4-10)

    Linear Differential-Algebraic Equations 17

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    35/356

    Create Conductance and Capacitance Matrices

    As you have doubtless noticed by now, there is a strong electrical prejudice with regards to digital

    computer simulation nomenclature. The terms conductance and capacitance matrices are aby-product of the original electrical-based applications of computer simulators. Although thesetraditional terms will be used in this book, they could be translated into "algebraic-based" matrices(for conductance) and "derivative-based" matrices (for capacitance), with respect to non-electricaldomains.

    Using the standard terminology, we will solve differential-algebraic systems by first separating thecapacitance and conductance matrices, and expressing them as shown in Equation (2.4-11) :

    The original system equations expressed in this form are given in Equation (2.4-12):

    It is because of the algebraic and differential aspects of the terms of these matrices that they areseparated. Those coefficients belonging to the given variables form the conductance matrix; thosecoefficients belonging to derivatives of those variables form the capacitance matrix.

    We will next isolate the derivatives and substitute in the desired numerical integration formula forthem. This will result is rearranging (2.4-11) to the form shown in Equation (2.4-13) :

    Isolate Differential Terms

    Isolating the derivatives in the system equations, we get Equation (2.4-14) :

    Cv ' Gv+ i= (2.4-11)

    C1 C 2+( ) C2

    C2 C2td

    d v1

    td d v2

    G1 G2+( ) G2

    G2 G 2 G3+( )+

    v1v2

    isr c0

    = (2.4-12)

    v' C 1 i Gv( )= (2.4-13)

    td d

    v1

    td

    d v

    2

    C1 C 2+( ) C 2

    C2 C 2

    1G1 G 2+( ) G 2+

    G 2 G2 G3+( )+

    v1v2

    isrc0

    +

    = (2.4-14)

    18 Chapter 2Time-Domain Simulation

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    36/356

    Replace Differential Terms with Integration Formula

    The next step is to pick an integration formula and replace all left-hand side derivatives of (2.4-14)

    with it. In this example, the backward Euler formula was chosen:

    Solve the Algebraic Equations using Matrix TechniquesOnce we have removed the differential terms, we have a set of linear, algebraic equations. The nodevoltages can then be solved using matrix algebra.

    The system of Figure 2.4-2 was simulated using the following component and simulation values:G1=0.5, G2=1, G3=2, C1=1, C2=1, timestep ( h) = 0.1. Initial v1=v2=0. Isrc =1A step. The results ofrepeating this process for several timesteps and the corresponding voltage vs. time waveforms aregiven in Figure 2.4-3 .

    The first column of the simulation results represents the simulation time, and the followingcolumns represent the voltages at v1 and v2, respectively. As can be seen from the figure, theabscissa of the measured points correspond to the timesteps, and the ordinate corresponds to thevoltage (any differences between the data in the table and measured data is due to the measurementapproach).

    A full solution to this example is presented in Appendix A.

    v1 n 1+, v1 n,

    h----------------------------------

    v2 n 1+, v2 n,

    h----------------------------------

    C1 C2+( ) C 2

    C2 C 2

    1G1 G2+( ) G 2+

    G 2 G 2 G 3+( )+

    v1v2

    isr c0

    +

    = (2.4-15)

    time v1, n+1 v2, n+10.10 0.082019 0.069401

    0.20 0.150882 0.117963

    0.30 0.209925 0.152306

    0.40 0.261467 0.176920

    0.50 0.307140 0.194851

    0.60 0.348101 0.2081710.70 0.385184 0.218287

    0.80 0.419003 0.226158

    0.90 0.450014 0.232439

    1.00 0.478570 0.237578

    Figure 2.4-3. Linear DAE response to ramp input.

    Nonlinear Algebraic Equations 19

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    37/356

    2.5. Nonlinear Algebraic EquationsWith both linear algebraic and linear differential systems, solutions may be obtained using standardmatrix solution techniques. Yet as powerful as they are, techniques such as Gaussian eliminationand LU Decomposition have a serious limitation: they only apply to linear systems of equations.However, the vast majority of real-world problems will contain nonlinear elements. To overcomethese limitations, we linearize the nonlinear systems of equations about the solution point, thensolve them using standard matrix methods.

    There are several numerical methods that can be used to solve nonlinear equations. The mostwidely used, and for this reason the one discussed here, is the Newton-Raphson method (alsoreferred to as Newtons method).

    A. Newton-Raphson Method

    The Newton-Raphson method is a technique for taking successive approximations of real roots. Itis derived from Taylors Formula, shown in Equation (2.5-1) :

    Taylors Formula can be used to find polynomial approximations of functions. If only thefirst-degree polynomial of the formula is used, (2.5-1) can be simplified to the form given byEquation (2.5-2) :

    In (2.5-2) , f(x) can be approximated as long as x is close to a .

    By expressing the function such that the unknown root intersects the x-axis, we can set f(x) in(2.5-2) equal to zero, and restate the formula as Equation (2.5-3) :

    Equation (2.5-3) represents the Newton-Raphson iteration method, and constitutes the fundamentalequation with which we will solve the majority of simulation circuits and systems. TheNewton-Raphson method solves for the next iteration of x, designated x(1) .

    f x( ) f a( ) f a( )1!

    ---------- x a( ) f a( )2!

    ----------- x a( )2 f n( ) a( )

    n!--------------- x a( )n+ + + += (2.5-1)

    f x( ) f a( )= f a( ) x a( )+ (2.5-2)

    x 1( )

    x 0( ) f x 0

    ( )( )

    f x 0( )( )------------------= (2.5-3)

    20 Chapter 2Time-Domain Simulation

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    38/356

    To determine a solution to a nonlinear equation using the Newton-Raphson method, we start from agood guess, x(0) and subtract from this starting point the function evaluated at x(0) , divided by thederivative of the function evaluated at x(0) . We then use the newly-calculated value x(1) in place ofx(0) and repeat the process to calculate x(2) .

    We keep iterating in this manner until a a solution is obtained (i.e. until the x-intercept isconverged upon). If the iterations are started off with a good guess, the Newton-Raphson methodwill converge quadratically upon the solution.

    This concept is shown graphically in Figure 2.5-1.

    In Figure 2.5-1 , x(0) is guessed. F(x) is then evaluated at x(0) , and the tangent at that point on f(x) isshown to cross the x-axis at x(1) . This crossing point now becomes the first iteration to the initialguess. This process is repeated using x(1) as the starting value, and once again a tangent line isdrawn at the new solution point. Finally, when the iterated solution is close enough, the processterminates. The actual solution is located at the point where the waveform crosses the x-axis (thex-intercept).

    An important feature of Figure 2.5-1 is that the independent axis is not time. When performingNewton-Raphson iterations, the simulator is solving for roots of equations. The actual timestep willoccur after the iteration process is complete. This will be discussed further in Section 2.6.

    Square Root Example

    A simple application of the Newton-Raphson method would be to approximate the square root ofseven. Stating this problem algebraically:

    Using the Newton-Raphson method with a starting guess of 3, we would compute the first iterationof the solution as follows:

    y

    x (0)

    y=f(x)

    xx (2) x (1)

    Figure 2.5- 1. Iterative root estimation using the Newton-Raphson method.

    f x( ) x 2 7= (2.5-4)

    x 1( )

    x 0( ) x 0

    ( )( )2

    7

    2x0( )

    ------------------------- -= 3 9 72 3------------ 2.667= = (2.5-5)

    Nonlinear Algebraic Equations 21

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    39/356

    The second iteration would then be computed using the results of (2.5-5) as the starting point:

    More iterations can be performed for greater accuracy.

    Transcendental Function Example

    To get an intuitive feel for using the Newton-Raphson method to solve systems of equations, wewill consider two functions. The first function is linear and is described by 2x + 2 . The secondfunction in nonlinear, and described by e -x. Calculated values for each function are given in Tables2.5-1 and 2.5-2 :

    When plotted on the same graph, these functions produce the waveforms shown in Figure 2.5-2 .

    The solution to this system of equations lies at that point where the two graphs intersect, at aboutx = -0.3 .

    x2( )

    x1( ) x

    1( )( )2

    7

    2x1( )------------------------- -= 2.667

    7.111 75.333---------------------- 2.6458= = (2.5-6)

    x f 1(x)-2. 00 -2.00

    -1.00 0.00

    0.00 2.00

    1.00 4.002.00 6.00

    Table 2.5-1. 2x + 2

    x f 2(x)-2.00 7.40

    -1.00 2.72

    0.00 1.00

    1.00 0.37

    2.00 0.14

    Table 2.5-2. e -x

    Figure 2.5-2. Graphical solution to functions of Tables 2.5-1 and 2.5-2.

    -0.3

    f 1,2 (x)

    x

    f 1(x) = 2x + 2f 2(x) = e-x

    22 Chapter 2Time-Domain Simulation

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    40/356

    By subtracting f1(x) from f2(x), a new equation f3(x) is produced. This new function evaluated atseveral points is shown in Figure 2.5-3 :

    The graph of f3(x) is useful in that it illustrates that the solution for the new equation is located atthe x-intercept (where f3(x)= 0 ).

    The Newton-Raphson method will now be employed to solve f3(x). We will start with an initialsolution guess of -0.5 , and perform the following steps:

    As you can see, the solution is converging somewhere around -0.3 , as expected from Figure 2.5-3 .

    The Newton-Raphson method applied to this problem is shown graphically in Figure 2.5-4 .

    x f 3(x)-2.00 9.40

    -1.00 2.72

    0.00 -1.00

    1.00 -3.63

    2.00 -5.86

    Table 2.5-3. e-x

    - 2x - 2

    Figure 2.5-3. F 3(x) obtained by subtracting f 1(x) from f 2(x).

    x 1( )

    x 0( ) 2x 0

    ( )2 e x

    0( )+

    2 e x0( )

    +

    ------------------------------------------= 0.5 1 2 1.65+2 1.65+

    --------------------------------- 0.322= =

    x 2( )

    x 1( ) 2x

    1( )2 e

    x1( )

    +

    2 e x1( )

    +

    ------------------------------------------= 0.322 0.644 2 1.38+2 1.38+

    -------------------------------------------=

    x 2( ) 0.315=

    (2.5-7)

    -0.5 -0.322 -0.315x

    y

    Figure 2.5-4. Graphical example of Newton Raphsonmethod with numerical values.

    Nonlinear Algebraic Equations 23

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    41/356

    As can be seen from Figure 2.5-4, an initial x value is picked (-0.5). From this value, thecorresponding point on the function is determined using y=f(x). The derivative is then taken, and thepoint where this tangent line intersects the x-axis, -0.322, is used as the x value for the next

    iteration. The process is repeated until a solution of the desired accuracy is obtained.

    A computer simulator has the arduous task of performing these iterations on every node of a design,and for each timestep in a transient analysis. This overall process is illustrated graphically in Figure 2.5-5 .

    In Figure 2.5-5 , Newton-Raphson iterations are shown as superscripts to x, while timesteps areindicated by subscripts to x. The notation y=f(xn, tn) denotes that the given function is dependent onthe independent variable, x, as well as time, t.

    Newton-Raphson Method with Multiple Variables

    It is convenient to express multivariate systems of equations in matrix form. With matrices, theseequations are typically solved using the Newton-Raphson method as expressed in the form given inEquation (2.5-8) :

    y

    x n(0)

    y=f(x n,t n)

    xx n(n)

    y

    x n+1 (0)

    y=f(x n+1 ,t n+1 )

    xx n+1 (n)

    t n

    t n+1

    t n+2

    y

    x n+2 (0)

    y=f(x n+2 ,t n+2 )

    xx n+2 (n) .. .

    .. .

    .. .

    Figure 2.5-5. Equation generation and solution at each timestep.

    After each algebraic function isgenerated, the simulator usesNewton-Raphson iterations toconverge on the solution (wherethe given function crosses thex-axis).

    x J 1 f x( )= (2.5-8)

    24 Chapter 2Time-Domain Simulation

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    42/356

    Where J is the Jacobian matrix, and consists of the partial derivatives of all terms in the function asshown in Figure 2.5-6 .

    Equation (2.5-8) is the multivariate representation of the Newton-Raphson method as expressedpreviously in (2.5-3) . In essence, the Jacobian matrix represents an array of linearized functionsegments. These linear segments are used to determine the x-intercept points discussed earlier.Since all practical systems will have many variables, Equation (2.5-8) will be used exclusivelythroughout the remainder of the text.

    In the previous examples of the Newton-Raphson method, we literally took the derivative of thegiven function in order to linearize it and determine the x-intercept. It turns out that there are other,and sometimes superior methods for doing this. Three commonly used methods for linearizing thecharacteristic equations are discussed next.

    B. Linearizing the Characteristic Equations

    In order to populate the Jacobian matrix, each term of the characteristic equation (i.e. each elementin the original matrix) must be linearized. Since the Newton-Raphson method is derived from onlythe first-degree polynomial of Taylors Formula, applying it actually linearizes the equations aboutx. The key then, lies in how the Newton-Raphson method is implemented. There are many ways todo this, the three most popular are described below.

    Taking the Slope (Method 1)

    A common technique for equation linearization is to determine the slope of the point on thecharacteristic equation which corresponds to the present value of the independent variable. This is

    x1 f 1( )k

    x2 f 1( )k

    xn f 1( )k

    x1 f 2( )

    k

    x2 f 2( )

    k

    xn

    f 2( )k

    x1

    f n( )k

    x2

    f n( )k

    xn

    f n( )k

    Figure 2.5-6. Structure of a Jacobian matrix.

    Nonlinear Algebraic Equations 25

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    43/356

    the approach we have shown in the previous discussion, where the slope is computed by taking thederivative of the function. This technique is illustrated in Figure 2.5-7 .

    In this case, vo represents the independent variable for which the slope of the function will begenerated. Simulators using this approach find, for the nonlinear equations, an approximatesolution that is controlled by one or more convergence parameters. While this approach is in someways appealing, the requirement for continuous derivatives makes modeling of such characteristicsvery difficult, if they are described by different functions in different regions of the independent

    variables.

    Piecewise Linear Approximation (Method 2)

    Another linearization technique is piecewise linear approximation, shown in Figure 2.5-8 .

    Rather than describing a nonlinear characteristic exactly, the piecewise linear approximation modelconsists of a set of straight lines approximating the nonlinear equation.

    vout

    vinv0

    Figure 2.5-7. Linearization by taking the slopeMethod 1.

    Models include characteristic equationsas well as their derivatives with respectto the independent variables.

    Model equations and their derivativesmust be continuous functions of theindependent variables.

    vout

    vin

    v0

    Figure 2.5-8. Piecewise linear approximationMethod 2.

    The characteristic equations are obtainedbefore the simulation begins, so all the

    simulator sees are the piecewise linearmodels, which must be continuous, butobviously have discontinuous derivatives.

    These models are solved exactly usingspecial algorithms. However, the accuracycan be changed only by changing themodel.

    26 Chapter 2Time-Domain Simulation

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    44/356

    Piecewise Linear Evaluation (Method 3)

    The final linearization technique is called piecewise linear evaluation . The models consist of the

    nonlinear equations plus a set of "sample points" for the independent variables. The simulator usesthe sample points to find piecewise linear approximations of the nonlinear equations, as shown inFigure 2.5-9 , where v1...v5 are the sample points.

    For piecewise linear evaluation, the density of the sample points can be specified by the user. The

    density can be thought of as a multiplier for the sample points. This enables the user to choose (atrun time) either increased accuracy or faster computation time. Given that the slope techniquecannot solve the equations exactly, this technique can produce results as accurate as those producedby the slope technique, if the density of the sample points is sufficiently high.

    C. Nonlinear Algebraic Example

    We will use the network shown in Figure 2.5-10 to illustrate how a simple nonlinear algebraicsystem may be solved using computer simulation.

    vout

    vin

    v0

    v1 v2v3 v4 v5

    Figure 2.5-9. Piecewise linear evaluationMethod 3.

    The simulator solves the piecewise linearapproximations of the models exactly,using specialized algorithms.

    Again the accuracy of the solutiondepends upon the piecewise linearapproximations, but the main advantageof this approach is that the density of thesample points is easily changed.

    Figure 2.5-10. Nonlinear algebraic network example.

    R1

    R2

    Isrc

    gnd

    v1 v2

    R3 i = v2

    Nonlinear Algebraic Equations 27

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    45/356

    The equations describing this network are as follows:

    This is similar to the linear algebraic network in Figure 2.3-1 with an additional (v 2)2 component.

    With the (v 2)2 term present, standard linear algebraic solution techniques cannot be used to solve

    the system. To solve this nonlinear system of equations, we will perform the following steps:

    1. Simplify the equations and calculate f 1(v1, v2) and f 2(v1, v2).2. Generate the Jacobian matrix, J.

    3. Determine the change in voltage from the previous iteration using .

    4. Find the new voltage with .

    5. Iterate starting from (1) using updated voltage values until convergence.

    Calculate f(v)

    This matrix is developed by collecting all terms of the original equations on the left-hand side and

    setting them equal to zero. The upper row represents f1, the lower row represents f2:

    Calculate Jacobian ( J )

    The Jacobian matrix is created by differentiating each equation ( f1 and f2), and populating a newmatrix with the results. The results occupy the same positions in the matrix as did the originalelements:

    G 1v1 G 2+ v 1 v 2( ) isr c=

    G 2 v1 v 2( ) G 3v2 v2( )2+= (2.5-9)

    vx J1

    f v( )=

    vx( )k 1+

    vx( )k vx+=

    f v( )G 1v1 G2+ v 1 v 2( ) isrc

    G2 v1 v 2( ) G 3v2 v2( )2

    = (2.5-10)

    Jv1 G 1 G2+( )v1 v2

    G 2( )v2

    v1 G 2v1 v2

    G 2 G3( )v2 v2( )2[ ]

    = (2.5-11)

    28 Chapter 2Time-Domain Simulation

  • 8/11/2019 The Designers Guide to Analog and Mixed-Signal Modeling Illustrated with VHDL-AMS and MAST

    46/356

    After differentiation, the Jacobian matrix is reduced as shown:

    Calculate Change in Voltage

    The overall change in voltage from the previous iteration can be solved as:

    Which in terms of the actual system can be expressed as:

    Calculate the New VoltageWith v calculated, the new voltage can be found with:

    Where (vx)k+1 is the voltage of the next iteration, (vx)

    k is the current voltage, and vx is the changein voltage calculated in (2.5-14) .

    Iterate Until Solution is Found and Advance Timestep

    The final voltage change is found by iterating (2.5-14) and (2.5-15) until an acceptable level ofaccuracy is reached. Once this is done, the timestep is advanced and the process is repeated.

    The system of Figure 2.5-10 was simulated using the following component and simulation values:G1=0.5, G2=1, G3=2, timestep ( h) = 0.1. Initial v1=v2=0.2. Isrc =1A.

    J

    G1 G 2+ G 2

    G 2 G2 G 3 2v 2=(2.5-12)

    v J 1 f v( )= (2.5-13)

    vG1 G 2+ G 2

    G2 G2 G3 2v 2

    1 G 1v1 G2+ v 1 v 2( ) isr c

    G2 v1 v 2( ) G3v2 v2( )2

    = (2.5-14)

    vx( )k 1+ vx( )

    k vx+= (2.5-15)

    Nonlinear Differential-Algebraic Equations 29

    Th l f l i i f hi i l i i i T bl 2 5 4

  • 8/11/201