Simulation Using WinSPICE

Similar documents
Experiment 2 Introduction to PSpice

The default account setup for the class should allow you to run HSPICE without any further configuration. To verify this, type:

MOSFET: Mxxx nd ng ns nb modelname W=value L=value Ad As Pd Ps

THE SPICE BOOK. Andrei Vladimirescu. John Wiley & Sons, Inc. New York Chichester Brisbane Toronto Singapore

NGSPICE- Usage and Examples

INTRODUCTION TO CIRCUIT SIMULATION USING SPICE

Laboratory Lecture 4

1.3 An Introduction to WinSPICE

LTSpice Basic Tutorial

Mentor Analog Simulators

Introduction to PSpice

Xcircuit and Spice. February 26, 2007

Real Analog - Circuits 1 Chapter 11: Lab Projects

ENEE307 Lab 7 MOS Transistors 2: Small Signal Amplifiers and Digital Circuits

EE 330 Laboratory 8 Discrete Semiconductor Amplifiers

ECE 310L : LAB 9. Fall 2012 (Hay)

Tsung-Chu Huang. Department of Electronic Engineering National Changhua University of Education /10/4-5 TCH NCUE

EECE 488: Short HSPICE Tutorial. Last updated by: Mohammad Beikahmadi January 2013

Integrators, differentiators, and simple filters

Experiment #1 Introduction to SPICE

EE 330 Laboratory 8 Discrete Semiconductor Amplifiers

Lab 3: Circuit Simulation with PSPICE

Introduction to SwitcherCAD

WinSpice. The steps to performing a circuit simulation with WinSpice are:

ET 304A Laboratory Tutorial-Circuitmaker For Transient and Frequency Analysis

HSPICE (from Avant!) offers a more robust, commercial version of SPICE. PSPICE is a popular version of SPICE, available from Orcad (now Cadence).

Lab 6: MOSFET AMPLIFIER

ECE 532 Hspice Tutorial

A Short SPICE Tutorial

Lab 6: Building a Function Generator

EE 2274 RC and Op Amp Circuit Completed Prior to Coming to Lab. Prelab Part I: RC Circuit

Digital Applications of the Operational Amplifier

EE 105 MICROELECTRONIC DEVICES & CIRCUITS FALL 2018 C. Nguyen. Laboratory 2: Characterization of the 741 Op Amp Preliminary Exercises

Lab 2: Common Emitter Design: Part 2

Figure 1. Main window (Common Interface Window), CIW opens and from the pull down menus you can start your design. Figure 2.

PSpice Simulation. The target of computer-aided analysis is to determine the circuit currents and voltages everywhere in the circuit.

Experiment 8 Frequency Response

HSPICE. Chan-Ming Chang

Digital Electronic Circuits

Circuit Simulation with SPICE OPUS

PSpice Tutorial. (usage of simulator ) (common sense) constant. L. Pacher

BME 3512 Bioelectronics Laboratory Two - Passive Filters

EECE 488: Short HSPICE. Tutorial. Last updated by: Mohammad Beikahmadi January Original presentation by: Jack Shiah

Operational Amplifiers: Part II

Experiment #1 Introduction to SPICE

Circuit Simulation Using SPICE ECE222

Introduction to OrCAD. Simulation Program With Integrated Circuits Emphasis.

SPICE FOR POWER ELECTRONICS AND ELECTRIC POWER

University of Michigan EECS 311: Electronic Circuits Fall 2009 LAB 2 NON IDEAL OPAMPS

EXPERIMENT 9 Problem Solving: First-order Transient Circuits

ECE Lab #4 OpAmp Circuits with Negative Feedback and Positive Feedback

SPICE for Power Electronics and Electric Power

The University of Evansville SwitcherCAD III Component Library

Chapter 12: Electronic Circuit Simulation and Layout Software

Homework Assignment 07

14:332:223 Principles of Electrical Engineering I Instructions for using PSPICE Tools Sharanya Chandrasekar February 1, 2006

EK307 Active Filters and Steady State Frequency Response

Homework Assignment 07

ECE 2201 PRELAB 6 BJT COMMON EMITTER (CE) AMPLIFIER

Fig. 1-1 show the main window of Orcad Capture. Every project you work on will start from Orcad Capture. Fig. 1-1 Orcad Capture Main window.

ECE4902 C Lab 5 MOSFET Common Source Amplifier with Active Load Bandwidth of MOSFET Common Source Amplifier: Resistive Load / Active Load

An Introductory Guide to Circuit Simulation using NI Multisim 12

EE1305/EE1105 Homework Problems Packet

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Circuits & Electronics Spring 2005

Lab 4: Analysis of the Stereo Amplifier

EE320L Electronics I. Laboratory. Laboratory Exercise #2. Basic Op-Amp Circuits. Angsuman Roy. Department of Electrical and Computer Engineering

EE 210 Lab Exercise #5: OP-AMPS I

UNIVERSITY OF NORTH CAROLINA AT CHARLOTTE Department of Electrical and Computer Engineering

E84 Lab 3: Transistor

ETIN25 Analogue IC Design. Laboratory Manual Lab 2

SPICE Simulation Program with Integrated Circuit Emphasis

CHARACTERIZATION OF OP-AMP

A Brief Handout for Introduction to

Engineering 3821 Fall Pspice TUTORIAL 1. Prepared by: J. Tobin (Class of 2005) B. Jeyasurya E. Gill

Week 4: Experiment 24. Using Nodal or Mesh Analysis to Solve AC Circuits with an addition of Equivalent Impedance

Design and Simulation of RF CMOS Oscillators in Advanced Design System (ADS)

Lab #2 First Order RC Circuits Week of 27 January 2015

EE4902 C Lab 5 MOSFET Common Source Amplifier with Active Load Bandwidth of MOSFET Common Source Amplifier: Resistive Load / Active Load

Department of Electrical & Computer Engineering Technology. EET 3086C Circuit Analysis Laboratory Experiments. Masood Ejaz

Well we know that the battery Vcc must be 9V, so that is taken care of.

Class #16: Experiment Matlab and Data Analysis

Lecture 7: SPICE Simulation

Introduction to Full-Custom Circuit Design with HSPICE and Laker

Lab 6 Prelab Grading Sheet

Homework Assignment 10

PHYSICS 330 LAB Operational Amplifier Frequency Response

EE 2274 DIODE OR GATE & CLIPPING CIRCUIT

Experiment 5 Single-Stage MOS Amplifiers

Gechstudentszone.wordpress.com

Lab 3: Very Brief Introduction to Micro-Cap SPICE

EE 230 Lab Lab 9. Prior to Lab


TTL LOGIC and RING OSCILLATOR TTL

Simulation Program with Integrated Circuits Emphasis = SPICE

ECE 201 LAB 6 INTRODUCTION TO SPICE/PSPICE

Experiment 10 Current Sources and Voltage Sources

ECE4902 Lab 5 Simulation. Simulation. Export data for use in other software tools (e.g. MATLAB or excel) to compare measured data with simulation

LABORATORY 3: Transient circuits, RC, RL step responses, 2 nd Order Circuits

Introduction to Matlab, HSPICE and SUE

Chapter 8. Chapter 9. Chapter 6. Chapter 10. Chapter 11. Chapter 7

Transcription:

Simulation Using WinSPICE David W. Graham Lane Department of Computer Science and Electrical Engineering West Virginia University David W. Graham 2007

Why Simulation? Theoretical calculations only go so far Find out the circuit behavior in a variety of operating conditions It is currently the best way of designing a circuit (industry standard) Provides intuitive feel for circuit operation (without requiring expensive equipment) 2

Simulator Options Wide variety of circuit simulators Specialized simulators (typically discrete-time) Multitude of digital simulators Switcap (for switched-capacitor circuits) Generic simulators (analog / continuous-time circuits typically use these) SPICE (Simulation Program with Integrated Circuit Emphasis) 3

SPICE Options Available at WVU HSPICE Good Expensive Different syntax PSPICE Schematic capture Node limitation (9 nodes maximum) WinSPICE Free! (Plus, it is good in many other ways) 4

WinSPICE Pros Free Small Size Can run it from MATLAB Works well No node limitations Can use the EKV model (good for subthreshold simulations) Works in Windows Cons No schematic capture (Rumor XCircuit can perform schematic capture) Only works in Windows (Occasional convergence problems but improving) 5

How to Obtain WinSPICE Free download www.winspice.com Go to Download Download Current Full Version Then, download the current stable release (this is simply an update) 6

Writing SPICE Decks / Netlists SPICE Deck/Netlist is a text description of a circuit Consists of the following parts Header Circuit connections Subcircuit descriptions (if needed) Model descriptions (if needed usually only for transistors) Analyses to be performed Outputs to be saved / displayed 7

Basic Circuit Elements Resistor Capacitor Inductor R<label> node1 node2 value C<label> node1 node2 value L<label> node1 node2 value Examples R 1 = 100Ω 1 2 in C in = 0.1µF out R1 1 2 100 CIN IN OUT 0.1u Resistor name Signifies resistor Signifies micro (1e-6) Nodes can be signified by words instead of numbers 8

Independent Voltage and Current Sources Voltage Source Current Source V<name> n+ n- DC dcvalue AC acvalue I<name> n+ n- DC dcvalue AC acvalue Examples 1.6 x 10-9 1 1 1.4 AC Value = 0.5nA 1.2 V dd = 3.3V I 1 Current (A) 1 DC Value = 1nA 0.8 0 Ground is always node 0 0.6 VDD 1 0 DC 3.3 AC 0 Direction of current flow 0.4 0 0.005 0.01 0.015 0.02 0.025 0.03 Time (s) I1 1 0 DC 1n AC 0.5e-9 n = 1e-9 (equivalent forms) 9

Independent Voltage and Current Sources Independent sources can also output functions PULSE Pulse function PWL Piecewise linear function SIN Sinusoidal waveform EXP Exponential waveform SFFM Single-frequency FM For more information, see the SPICE manual (WinSPICE manual) Example Sinusoidal voltage with a DC offset of 1V, an amplitude of 0.5V, and a frequency of 1kHz (between nodes 1 and 0) V<name> n+ n- SIN(dcvalue amplitude frequency) V1 1 0 SIN(1 0.5 1k) 10

Dependent Voltage and Current Sources Voltage-controlled voltage source (VCVS) E<label> n+ n- nref+ nref- gain Current-controlled current source (CCCS) F<label> n+ n- voltagesourceref gain Voltage-controlled current source (VCCS) G<label> n+ n- nref+ nref- transconductance Current-controlled voltage source (CCVS) H<label> n+ n- voltagesourceref transconductance Voltage-controlled sources reference the voltage across two nodes Current-controlled sources reference the current flowing through a voltage source Can be a dummy voltage source A voltage source with no voltage supplied VDUMMY 3 4 DC 0 AC 0 Current sources flow from n+ to n- 11

Transistors nfets M<name> drain gate source bulk modelname W=value L=value pfets M<name> drain gate source well modelname W=value L=value Examples (Assume models NFET and PFET are defined elsewhere) 2 2 1 Assume the bulk connection is tied to ground 1 3 0 M1 2 1 0 0 NFET W=100u L=4.8u 0 M2 0 1 2 3 PFET W=100u L=4.8u 12

Model Files Two major models for simulating transistors BSIM Great for above threshold simulations Essentially empirical fits Many, many parameters (upwards of hundreds) Does not do subthreshold very well, at all EKV Model Mathematical model of the MOSFET operation Much fewer parameters Does subthreshold operation very well 13

EKV Model Enz, Krummenacher, and Vittoz Model (3 Swiss engineers who wanted a better MOSFET model, specifically for low-current applications) Model is a single expression that preserves continuity of the operation Based on the physics of the MOS device (not just empirical fits) We will be using the 0.5µm model available at the EKV website http://legwww.epfl.ch/ekv/ekv26_0u5.par More information can be found at http://legwww.epfl.ch/ekv/ Liu, et al. pg 86-89 14

Analysis Several types of analyses can be performed Operating point DC sweep AC sweep Transient analysis We will be making use of these analyses extensively Additional useful analyses distortion, noise, pole-zero, sensitivity, temperature, transfer function 15

Analysis Analysis declaration is given by a line of code near the end of the SPICE deck Operating point analysis (.OP) Provides DC operating point (capacitors shorted, inductors opened).op DC sweep (.DC) Can sweep a DC voltage or current to determine a DC transfer function.dc sourcename startval stopval incrementval e.g..dc VIN 0 5 0.1 (This would sweep source VIN from 0V to 5V with steps of 0.1V) 16

Analysis AC analysis (.AC) Can sweep an AC voltage or current over a specified frequency range to determine the transfer function / frequency response Does not take distortion and nonlinearities into account.ac {DEC,OCT,LIN} numpoints freqstart freqstop DEC numpoints per decade OCT numpoints per octave LIN linear spacing of points, numpoints = total number of points e.g..ac DEC 10 10 1E5 AC sweep from 10Hz to 100kHz, points spaced logarithmically, 10 simulation points per decade Must have a source with an AC component in the circuit 17

Analysis Transient analysis (.TRAN) Determines the response of a circuit to a transient signal / source (sine wave, PWL function, etc.) Allows you to achieve the most results with a simulation (distortion, nonlinearity, operation, etc.).tran timestep timestop {timestart {maxstepsize}} {UIC} Optional arguments timestart = start time (default is 0) maxstepsize = maximum time increment between simulation points UIC Use Initial Conditions allows the user to define initial conditions for start of simulation, e.g. initial voltage on a capacitor e.g..tran 1n 100n Perform a transient analysis for 100nsec (100e-9 seconds) with a step increment of 1nsec 18

Displaying Outputs Saving variables Saving the values of the voltages / currents for use in later plotting them.save variable1 variable2 Examples.SAVE V(1) (Saves the voltage at node 1).SAVE VIN VOUT @M1[ID] (Saves the voltages at nodes VIN and VOUT, also saves the drain current through transistor M1).SAVE ALL (Saves all variables) 19

Displaying Outputs Plotting variables Plot type depends on the analysis performed.plot analysistype variable1 variable2 Examples.PLOT DC V(1) V(2) (Plots the voltages at nodes 1 and 2 on the same graph. The x axis is voltage (DC sweep)).plot AC VDB(3) (Plots the decibel value of the voltage at node 3. The x axis is frequency (AC analysis)).plot TRAN I(VIN) (Plots the current through the voltage source VIN. The x axis is time (transient analysis)) 20

A Circuit Example 2 COMMON SOURCE AMPLIFIER R 1 = 100kΩ 1 M 1 V DD = 3.3V out C L = 1nF *BEGIN CIRCUIT DESCRIPTION VIN 1 0 DC 1 AC 0 VDD 2 0 DC 3.3 AC 0 R1 OUT 2 100K CL OUT 0 1N M1 OUT 1 0 0 NFET L=10U W=100U <Insert Model Statements Here> V in = 0.4V.OP.DC VIN 0 3.3 0.01.PLOT DC V(OUT).END 21

A Circuit Example Header First line is always a title / comment * Comments out the entire line COMMON SOURCE AMPLIFIER *BEGIN CIRCUIT DESCRIPTION VIN 1 0 DC 1 AC 0 VDD 2 0 DC 3.3 AC 0 R1 OUT 2 100K CL OUT 0 1N M1 OUT 1 0 0 NFET L=10U W=100U <Insert Model Statements Here> Analyses and outputs to be displayed Must end with a.end command.op.dc VIN 0 3.3 0.01.PLOT DC V(OUT).END 22

Running a Simulation Save your SPICE Deck as a.cir file Simply double-click on the file WinSPICE will automatically run As long as WinSPICE is open, every time you save the.cir file, WinSPICE will automatically re-simulate 23

Controlling Simulations with MATLAB One nice feature of WinSPICE is that it can be controlled from MATLAB. This allows post-processing of the simulation results to be done in the easy-to-use MATLAB environment. Download the MATLAB.m file from the class website named runwinspice.m Place a copy of the WinSPICE executable file (.exe file) in the same directory as your.cir file Make sure you save the variables you want to view with the.save command (the fewer variables you save, the faster the simulation runs) Comment out / remove all lines that display outputs (plots) in the.cir file Run the simulation from MATLAB using [data, names] = runwinspice( mycircuit.cir ); data Matrix of all variables that were saved with the.save line Each variable is saved as a column In AC analyses, two columns are required for each variable Odd-numbered columns are the real part of the simulation data Even-numbered columns are the imaginary part of the simulation data names List of the names of the variables corresponding to each column in data In AC analyses, there are half as many names as there are columns in data 24

Advanced Features in SPICE Subcircuits (for reusable circuit elements) Global lines Include statements Many, many more (see the SPICE manual) 25

Subcircuits Creates a reusable circuit so you do not have to unnecessarily write identical lines of code over and over again Has external nodes (for connections) Has internal nodes (for the operation of the subcircuit) Usage.SUBCKT subcktname extnode1 extnode2 <Internal circuit connections>.ends subcktname Connection to the circuit (Subcircuit calls) X<label> node1 node2 subcktname 26

Subcircuit Example Define a subcircuit with the following lines of code.subckt INV 1 2 M1 2 1 3 3 PFET W=1.5 L=1.5U M2 2 1 0 0 NFET W=1.5 L=1.5U VSUPPY 3 0 DC 3.3 AC 0.ENDS INV Call the subcircuit INV in the circuit declaration part of the SPICE deck using the following line X1 8 9 INV Declares this subcircuit will be INV Nodes to connect to in the overall circuit Subcircuit label 1 Declares this will be a subcircuit 27

Global Lines Global nodes are valid in all levels of the circuit, including the subcircuits Especially useful for power supplies (V DD ) Usage.GLOBAL node1 node2 28

Include Statements Useful for adding large, reusable lines of code Model files Subcircuits Large, specific input signals (PWL) Usage.INCLUDE filename Effectively replaces the.include line with the lines of code in the file 29