Transcript Document
Agenda DAY 1 Synopsys 60-I-032-BSG-005 1 Introduction 2 Verilog-A Modules 3 Simulating Variability – Design for Yield © 2007 Synopsys, Inc. All Rights Reserved 1- 1 Unit Objectives After completing this unit, you should be able to: Explain the HSPICE file structure List what files HSPICE outputs Demonstrate how to start HSPICE Use .measure statements Use .alter blocks Use the Discovery AMS Simulation Interface Use CosmosScope 1- 2 HSPICE Fundamentals Files and suffixes Netlist structure Naming conventions Units and scale factors 1- 4 3 Files and Suffixes HSPICE Input Input netlist .sp Model/libraries .inc, .lib HSPICE Output Run Status .st0 Output listing .lis Analysis data, transient .tr# (e.g;. .tr0) Analysis data, dc .sw# (e.g. .sw0) Analysis data, ac .ac# (e.g. .ac0) FFT .ft# (e.g. .ft0) Measure output .m*# (e.g. .mt0) CosmosScope Input All analysis data files 1- 6 4 Starting HSPICE Typical command line invocations: hspice design.sp > design.lis (UNIX only) hspice –i design.sp -o design.lis (Windows and UNIX) .lis file contains results of: .print .op (operating point) .options (results) 1- 8 5 Netlist Structure One main program and one or more optional submodules: High-level call statements can restructure netlist file modules: .INCLUDE .LIB Calls to external data files: .ALTER .DATA Order independent: Last definition is used for parameters and options 1- 10 6 Netlist Structure: Overview Title First line is always the title Comment character * - comment for a line $ - comment after a command Options .option post Print/Probe/Analysis .print v(d) i(rl) .probe v(g) .tran .1n 5n Initial Conditions .ic v(b) = 0 $ input state Sources Vg g 0 pulse 0 1 0 0.15 0.15 0.42 * example of a voltage source Circuit Description MN d g gnd n nmos RL vdd d 1K Model Libraries .model n nmos level = 49 + vto = 1 tox = 7n * ‘+’ continuation character END .end $ terminates the simulation 1- 12 7 Netlist Structure: Topology + + V + V V - - No voltage loops - No dangling nodes + + I V + - I - Every node must have a DC path to ground No stacked current sources + + I V - No ideal voltage source in closed inductor loop - No ideal current source in closed capacitor loop 1- 14 8 Node Naming Conventions (1/2) Node names: Can be up to 1024 characters Either names or numbers (e.g. n1, 33, in1, 100) Numbers: 1 to 9999999999999999 Nodes with number followed by letter are all the same (e.g. 1a=1b) Leading zeros in node names are ignored Can begin with these characters: # _ ! % 0 is ALWAYS ground Global vs. local (1 to 1e16) 1- 16 9 Node Naming Conventions (2/2) Guidelines for node naming: Do not begin with a “/” May contain: + - * / : ; $ # . [ ] ! < > _ % May NOT contain: ( ) , = ‘ <space> Ground may be either 0, GND, !GND or GROUND The period (.) is reserved to indicate hierarchy TIME, TEMPER, HERTZ, TRANSFORMER, VCVS, CCCS, VCCAP, VCR, CCVS, DELAY and OPAMP are reserve keywords Every node must have at least two connections: Except Tline or MOS substrate 1- 18 10 Element Naming Conventions Element names: Names must begin with an alphabetic character, but thereafter can contain numbers and the following characters: ! # $ % * + - / < > [ ] _ Names can be up to 1024 characters long Names are not case sensitive Element instances begin with the element key letter Subcircuit instance names begin with X Parameter names: Follow the name syntax rules except that names must begin with an alphabetic character The other characters must be either a number, or one of these characters: ! # $ % [ ] _ 1- 20 11 Units and Scale Factors Units: R - ohm A = 1e-18 K = 1e3 F = 1e-15 MEG = X = 1e6 P = 1e-12 G = 1e9 C - Farad N = 1e-9 L - Henry U = 1e-6 Technology scaling: T = 1e12 M = 1e-3 SCALE and SCALM ALL lengths and widths are in METERS Scale factors MIL(S) = 25.4e-6 FT = .3048 (METERS) DB = 20log10 1- 22 12 .MEASURE .MEASURE: Prints user-defined electrical specifications of a circuit .MEASURE is a post processor Used extensively for optimization and curve fitting Seven fundamental measurement modes Rise, Fall, Delay Average, RMS, Min, Max, and Peak-to-Peak Find-When Equation Evaluation Derivative Evaluation Integral Evaluation Relative Error 1- 24 13 .MEASURE: Rise/Fall (1/2) Syntax: .MEASURE <DC|TRAN|AC> result TRIG TARG + <optimization options> Result - name given the measured value in the HSPICE output TRIG trig_var VAL=trig_val <TD=timedelay> + <CROSS=#of> <RISE=#of> <FALL=#of> TRIG AT=value TARG targ_var VAL=targ_val <TD=timedelay> + <CROSS=#of|LAST><RISE=#of|LAST> + <FALLS=#of|LAST> 1- 26 14 .MEASURE: Rise/Fall (2/2) Example: .MEAS TRAN TDELAY TRIG V(1) + VAL=2.5 TD=10ns RISE=2 + TARG V(2)VAL=2.5 FALL=2 Delay 10ns TDLAY V(1) V(2) 2.5v … … 2.5v 1- 28 15 .MEASURE: AVG, RMS, MIN, MAX, PP (1/2) Syntax: .MEASURE <DC|TRAN|AC> result func out_var + <FROM=val> <TO=val> <optimization options> Func Result AVG, RMS, MIN, MAX, PP Name given the measured value in the HSPICE output Out_var Name of the output variable to be measured 1- 30 16 .MEASURE: AVG, RMS, MIN, MAX, PP (2/2) Examples: .MEAS TRAN avgval AVG V(10)From=10ns To=55ns Print out average nodal voltage of node 10 during tran time 10 to 55ns Print as “avgval” .MEAS TRAN maxval MAX V(1,2) + From=15ns To=100ns Find the maximum voltage difference between nodes 1 and 2 from time 15ns to 100ns Print as “maxval” 1- 32 17 .MEASURE: FIND-WHEN Allows any independent variables (time, frequency, parameter), by using WHEN syntax, or any dependent variables (voltage, current, etc), by using Find-When syntax, to be measured when some specific event occurs Syntax: .MEASURE <DC|TRAN|AC> result WHEN out_var=val + <TD=val> <RISE=#of>|LAST> <FALL=#of|LAST> + <CROSS=#of|LAST> <optimization options> 1- 34 18 .MEASURE: FIND-WHEN Examples Example of WHEN: .MEAS TRAN fifth WHEN V(osc_out)=2.5v RISE=5 Measure the time of the 5th rise of node “osc_out” at 2.5v Store in variable fifth Example of FIND-WHEN: .MEAS TRAN result FIND v(out) WHEN v(in)=40m Measure v(out) when v(in)=40m Store in variable result 1- 36 19 .MEASURE: Equation Evaluation Equation Evaluation: Use this statement to evaluate an equation that can be a function of the results of previous .MEASURE statements The equation must not be a function of node voltages or branch currents Syntax .MEASURE <DC|TRAN|AC> result PARAM=‘equation’ + <optimization options> Result - name given the measured value in the HSPICE output file Example: .MEAS TRAN T_from WHEN V(out)=’0.5*vcc’ CROSS=1 .MEAS TRAN T_to WHEN V(out)=’0.5*vcc’ CROSS=2 .MEAS TRAN Tmid PARAM=‘(T_from+T_to)/2’ 1- 38 20 .MEASURE: Derivative Function Derivative Function: Provides the derivative of an output variable at a given time or frequency or for any sweep variable Provides the derivative of a specified output variable when some specific event occurs Syntax: .MEASURE <DC|TRAN|AC> result DERIVATIVE + out_var WHEN var2=val <TD=val> + <RISE=#of>|LAST> <FALL=#of|LAST> + <CROSS=#of|LAST> <optimization options> Example: .MEAS TRAN slewrate DERIV v(1) + WHEN V(osc_out)=2.5v RISE=5 1- 40 21 .MEASURE: Integral Function Integral Function: Provides the integral of an output variable over a specified period Syntax: .MEASURE <DC|TRAN|AC> result INTEGRAL out_var + <FROM=val1> <TO=val2> <optimization options> Example: .MEAS TRAN charge INTEG I(cload) + FROM=10ns TO=100ns 1- 42 22 .ALTER: Description Rerun a simulation several times with different: Circuit topology Models Library components Elements Parameter values Options Source stimulus Analysis variables Print/probe commands Must be parameterized 1- 44 23 .ALTER: Limitations CAN include: Element Statements .DATA, .LIB, .DEL LIB, .INCLUDE, .MODEL statements .IC, .NODESET statements .OP, .OPTIONS, .PARAM, .TEMP, .TF, .TRAN, .DC, .AC CANNOT include: .PRINT, .PROBE, or any other i/o statements Unless they are parameterized AVOID: Adding analysis statements under each .ALTER block Will cause huge penalty in simulation time and confusion in the output results 1- 46 24 .ALTER Rules (1/2) If the name of a new element, .MODEL statement, or a subckt is identical to the name of an original statement of the same type, the new statement replaces the old Element and .MODEL statements within a subckt definition can be changed and new element and .MODEL statements can be added to a subckt definition Topology modifications to subckt definitions should be put into libraries and added with .LIB and deleted with .DEL LIB If elements or model parameter values were parameterized when using .ALTER, these parameter values must be changed through the .PARAM statement 1- 48 25 .ALTER Rules (2/2) If a parameter name of a new .PARAM statement in the .ALTER module is identical to a previous parameter name, the new assigned value replaces the old Do not re-describe the elements or model parameters with numerical values Options turned on by an .OPTIONS statement in an original input file or an .ALTER submodule can be turned off Only the actual altered input is printed for each .ALTER run A special .ALTER title identifies the run But a .INCLUDE statements within a file called with a .LIB statement can be accepted by .ALTER processing 1- 50 26 .ALTER: Example * ALTER Test * CMOS Inverter .OPTIONS ACCT LIST .OP .DC VIN 0 5 0.1 .PRINT DC v(3) v(2) .PRINT tran v(3) .PARAM VDD=5 .LIB ‘MOS.LIB’ NORMAL VDD 1 0 VDD VIN 2 0 M1 3 2 1 1 P 6U 15U M2 3 2 0 0 N 6U 15U .ALTER Change Supply .PARAM VDD=10 .ALTER Fast Process .DEL LIB ‘MOS.LIB’ NORMAL .LIB ‘MOS.LIB’ FAST .ALTER Add Transient .TRAN .1 2 .END .OP DC Sweep change VDD to 10v .OP DC Sweep alter change to fast library (MUST delete first) (VDD=10v still in effect) .OP DC Sweep alter to add transient (VDD=10v still in effect) (.lib ‘mos.lib’ FAST still in effect) .OP DC Sweep Transient 1- 52 27 Discovery AMS Simulation Interface Basics To start the Discovery AMS Simulation Interface % simif Setup a new project Project name Project location New directory for all project test benches Location of project directory Open an existing project 1- 54 28 Discovery AMS Simulation Interface 1- 56 29 Discovery AMS Simulation Interface – Project Management Manage the project test benches Close the project Delete the project Create a new test Import an older simulation (.wrk) file 1- 58 30 Discovery AMS Simulation Interface – Project Management 1- 60 31 Discovery AMS Simulation Interface – Setup HSPICE simulation is divided into 3 major tasks Setup Netlist and Simulation HSPICE Setup Run Output Selected by buttons near the top, left of the workbench Each button selects a new set of screens The GUI always starts in the Setup mode Each task contains either tabs or buttons that allow the user to enter specific information and data required by HSPICE 1- 62 32 Discovery AMS Simulation Interface – Netlist & Simulation Netlist & Simulation is select from the tree on the left of the GUI Model Setup Design Variables Design parameters Analog Options Name and corner of any model files used by the design Set SCALE and TNOM options External Files Specify the netlist file(s) used by the design Specify the Verilog-A behavioral model files by the design Specify the name of any vector file(s) used by the design 1- 64 33 Discovery AMS Simulation Interface – Netlist & Simulation 1- 66 34 Discovery AMS Simulation Interface – HSPICE Setup Analysis Supports all HSPICE analyses Waveform Output waveforms setup Select waveform viewer Frequently used HSPICE options in its own category Commands .IC and .NODESET setup .SAVE and .LOAD Options Setups for .MEAS, .STIM and .BIASCHK statements Convergence Cosmos Scope (default) AvanWaves Post Proc supports both .PROBE and .PRINT Setup any options or commands not available from the setup screens Behavioral Verilog-A 1- 68 35 Discovery AMS Simulation Interface – HSPICE Setup 1- 70 36 Discovery AMS Simulation Interface – Run Run any simulation that is setup View listing (.lis) file Errors and warnings are highlighted View run script and header file Start waveform viewer CosmosScope 1- 72 37 Discovery AMS Simulation Interface – Run 1- 74 38 Discovery AMS Simulation Interface - Output View Status file (*.st#) View Subcircuit cross-listing (*.pa#) View Initial condition (*.ic#) View .MEASURE results AC measures (*.ma#) DC measures (*.ms#) Transient measures (*.mt#) .MEASURE file processing 1- 76 39 Discovery AMS Simulation Interface - Simulation 1- 78 40 Invoking CosmosScope Unix/Linux Users Type cscope at the command prompt: % cscope Windows Users: Select Start Programs Synopsys 2006.03 Cosmos-Scope CosmosScope 1- 80 41 CosmosScope Basics Pulldown Menu Bar CosmosScope Icon Bar Graph Window Tool Bar Help Field 1- 82 42 CosmosScope Pulldown Menu Bar Graph/Plot File Control Graph Window Control Edit/Preferences CosmosScope Window Control Alternate Tool Bar Icon Control CosmosScope Help 1- 84 43 CosmosScope Icon Bar Reload Print New XY New Polar Graph Chart New Smith Open Save Chart Cascade Windows Clear Tile Windows Toggle Signal Grid Toggle Grid Copy Cut Create Bus Burst Configure Bus Dynamic Waveform Display Zoom In Paste At X Meas. Zoom Out Zoom to Fit Point to Point Meas. At Y Meas. 1- 86 44 CosmosScope Tool Bar AIM Command Signal Manager Waveform Line Calculator Drawing Tool Measurement Macro Tool Recorder RF Tool Matlab Command Line 1- 88 45 CosmosScope Mouse Usage Left click to select (buttons, objects, etc.) Right click on anything to get a context-sensitive menu Middle-click to paste what is selected in the pointed-to location Drag with the middle button held down for panning For a two-button mouse, middle-click can be emulated by clicking the right and left mouse buttons simultaneously Shift-clicking the left mouse button adds to your selection if working with graphical objects, and adds everything from your current selection to the click point in list boxes Control-clicking the left mouse button adds to your selection Dragging the left mouse button zooms (expands) the contents inside the box 1- 90 46 Opening a Plotfile In the Scope Window select File Open Plotfiles or press the button Navigate to the directory where the desired plotfile is located In the Files of type field, select the type of plotfile you would like to open Select the plotfile and click 1- 92 47 CosmosScope File/Signal Control Forms Plotfile Manager Signal Manager 1- 94 48 Scope Plotting Techniques (1/2) Plot one signal at a time: Method 1 Method 2 Left click on the signal name in the signal manager Press the plot button Double-click on the signal name Plot multiple consecutive signals: Method 1 Click on the first signal Hold and drag to the last signal Press the plot button Method 2 Click on the first signal and release Hold down the shift key and click on the last desired signal Press the plot button 1- 96 49 Scope Plotting Techniques (2/2) Plot multiple non-consecutive signals: Click on the first signal Hold down the control key while clicking on other signals Then press the plot button Plot signals on top of each other: Plot the first signal using any of the above approaches Select the signal to plot on top of the first signal Middle click in the region of the first signal 1- 98 50 CosmosScope Measurements Measurements are the the key to design analysis Over 50 built-in measurements at your fingertips Can be applied graphically in CosmosScope or in "Batch" mode for automatic data collection You can add custom measurements 1- 100 51 CosmosScope Measurements 1- 102 52 CosmosScope Measurements General Measurements: Time Domain: Lowpass, highpass, bandpass (Q, ripple, etc.), stopband, phase margin, gain margin, slope, magnitude, dB, phase, real, imaginary, Nyquist plot frequency S Domain Max, min, X at max, X at min, peak to peak, topline, baseline, amplitude, average, RMS, AC-coupled RMS Frequency Domain: Duty cycle, frequency, period, pulsewidth, risetime, falltime, slew rate, delay, overshoot, undershoot, settle time, eye diagram Reference or level measurements: At X, at Y, delta X, delta Y, length, slope, local min/max, crossing, horiz. level, vert. level, vert. cursor, point marker, point to point Damping ratio, natural frequency, quality factor Statistics: Max, min, range, mean, median, std. deviation, mean (+/- 3 std dev), histogram, yield, Dpu, Cpk, pareto 1- 104 53 CosmosScope Calculator Pulldown Menus Icon Bar Entry Field (Register) Stack Display Programmable Buttons Extended Operation Buttons Keypad 1- 106 54 Using the Calculator To get a waveform into the Register: Select the waveform name on the graph window (or in the Plot File Window) Middle-click in the Register You can also select Edit Paste in the calculator to accomplish this task Either Reverse Polish Notation (RPN) or Algebraic input modes can be selected To plot results from the calculator: Click on the left-most icon in the Icon Bar 1- 108 55 Lab 1: HSPICE Netlist During this lab, you will: 90 minutes 1. Create a HSPICE netlist 2. Use the Discovery AMS Simulation Interface to set up and start HSPICE to simulate the netlist Setup Simulation 3. View the results in CosmosScope CosmosScope 1- 110 56