11- agenda introduction 1 verilog-a modules 2 simulating variability – design for yield 3 day 1...
TRANSCRIPT
11-
Agenda
Introduction1
Verilog-A Modules2
Simulating Variability – Design forYield3
DAYDAY1
Synopsys 60-I-032-BSG-005 © 2007 Synopsys, Inc. All Rights Reserved
21-
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
2
41-
HSPICE Fundamentals
Files and suffixes
Netlist structure
Naming conventions
Units and scale factors
3
61-
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
4
81-
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)
5
101-
Netlist Structure
One main program and one or more optional submodules: .ALTER
High-level call statements can restructure netlist file modules: .INCLUDE .LIB
Calls to external data files: .DATA
Order independent: Last definition is used for parameters and options
6
121-
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 nmosRL vdd d 1K
Model Libraries .model n nmos level = 49+ vto = 1 tox = 7n* ‘+’ continuation character
END .end $ terminates the simulation7
141-
+
-
V
Every node must have a DC path to ground
+
-
V
No dangling nodes
+
-
V+
-
V
No voltage loops
+
-
I
No ideal current source in closed capacitor loop
Netlist Structure: Topology
No ideal voltage source in closed inductor loop
+
-
V
No stacked current sources
+
-
I
+
-
I
8
161-
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 (1 to 1e16) 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
9
181-
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
10
201-
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: ! # $ % [ ] _
11
221-
Units and Scale Factors
Units: R - ohm C - Farad L - Henry
Technology scaling: SCALE and SCALM ALL lengths and widths are in METERS
Scale factors
A = 1e-18
F = 1e-15
P = 1e-12
N = 1e-9
U = 1e-6
M = 1e-3
K = 1e3
MEG = X = 1e6
G = 1e9
T = 1e12
MIL(S) = 25.4e-6
FT = .3048 (METERS)
DB = 20log10
12
241-
.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
13
261-
.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>
14
281-
.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
…
…
2.5v
2.5v
TDLAY
V(1)
V(2)
15
301-
.MEASURE: AVG, RMS, MIN, MAX, PP (1/2)
Syntax:
.MEASURE <DC|TRAN|AC> result func out_var
+ <FROM=val> <TO=val> <optimization options> Func
AVG, RMS, MIN, MAX, PP
Result Name given the measured value in the HSPICE output
Out_var Name of the output variable to be measured
16
321-
.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”
17
341-
.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>
18
361-
.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
19
381-
.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’
20
401-
.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
21
421-
.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
22
441-
.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
23
461-
.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
24
481-
.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
25
501-
.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
26
521-
.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’ NORMALVDD 1 0 VDDVIN 2 0M1 3 2 1 1 P 6U 15UM2 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
alter to add transient(VDD=10v still in effect)(.lib ‘mos.lib’ FAST still in effect).OPDC SweepTransient
.OPDC Sweep
change VDD to 10v.OPDC Sweep
alter change to fast library (MUST delete first)(VDD=10v still in effect).OPDC Sweep
27
541-
Discovery AMS Simulation Interface Basics
To start the Discovery AMS Simulation Interface
% simif
Setup a new project Project name
New directory for all project test benches
Project location Location of project directory
Open an existing project
28
561-
Discovery AMS Simulation Interface
29
581-
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
30
601-
Discovery AMS Simulation Interface – Project Management
31
621-
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
32
641-
Discovery AMS Simulation Interface – Netlist & Simulation
Netlist & Simulation is select from the tree on the left of the GUI Model Setup
Name and corner of any model files used by the design
Design Variables Design parameters
Analog Options 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
33
661-
Discovery AMS Simulation Interface – Netlist & Simulation
34
681-
Discovery AMS Simulation Interface – HSPICE Setup
Analysis Supports all HSPICE analyses
Waveform Output waveforms setup
supports both .PROBE and .PRINT Select waveform viewer
Cosmos Scope (default) AvanWaves
Post Proc Setups for .MEAS, .STIM and .BIASCHK statements
Convergence .IC and .NODESET setup .SAVE and .LOAD
Options Frequently used HSPICE options in its own category
Commands Setup any options or commands not available from the setup screens
Behavioral Verilog-A 35
701-
Discovery AMS Simulation Interface – HSPICE Setup
36
721-
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
37
741-
Discovery AMS Simulation Interface – Run
38
761-
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
39
781-
Discovery AMS Simulation Interface - Simulation
40
801-
Invoking CosmosScope
Unix/Linux Users Type cscope at the command prompt:
% cscope
Windows Users: Select Start Programs Synopsys 2006.03
Cosmos-Scope CosmosScope
41
821-
CosmosScope Basics
Pulldown Menu BarCosmosScope Icon Bar
Graph Window
Tool BarHelp Field
42
841-
CosmosScope Pulldown Menu Bar
Edit/Preferences
Graph/PlotFile Control
Graph WindowControl
Alternate Tool Bar Icon Control
CosmosScopeWindow Control
CosmosScopeHelp
43
861-
CosmosScope Icon Bar
New XYGraph
New SmithChart
New PolarChart
Open
Reload
Save
Cut
Copy
Paste
ZoomIn
Zoomto Fit
ZoomOut
CascadeWindows
TileWindows
ToggleGrid
ToggleSignal Grid
ConfigureDynamic
Waveform Display
CreateBus
BurstBus
At XMeas.
At YMeas.
Point toPoint Meas.
Clear
44
881-
CosmosScope Tool Bar
Drawing Tool
AIM Command Line
Signal Manager
MeasurementTool
Waveform Calculator
MacroRecorder
RF Tool
MatlabCommand
Line
45
901-
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
46
921-
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
47
941-
CosmosScope File/Signal Control Forms
PlotfileManager
SignalManager
48
961-
Scope Plotting Techniques (1/2)
Plot one signal at a time: Method 1
Left click on the signal name in the signal manager Press the plot button
Method 2 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 49
981-
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
50
1001-
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
51
1021-
CosmosScope Measurements
52
1041-
CosmosScope Measurements General 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
Time Domain: Duty cycle, frequency, period, pulsewidth, risetime, falltime, slew
rate, delay, overshoot, undershoot, settle time, eye diagram
Reference or level measurements: Max, min, X at max, X at min, peak to peak, topline, baseline,
amplitude, average, RMS, AC-coupled RMS
Frequency Domain: Lowpass, highpass, bandpass (Q, ripple, etc.), stopband, phase
margin, gain margin, slope, magnitude, dB, phase, real, imaginary, Nyquist plot frequency
S Domain Damping ratio, natural frequency, quality factor
Statistics: Max, min, range, mean, median, std. deviation, mean (+/- 3 std
dev), histogram, yield, Dpu, Cpk, pareto
53
1061-
CosmosScope Calculator
Entry Field (Register)Icon Bar
Pulldown Menus
Programmable Buttons
Stack Display
Extended Operation Buttons
Keypad
54
1081-
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
55
1101-
Lab 1: HSPICE
During this lab, you will:
1. Create a HSPICE netlist
2. Use the Discovery AMS Simulation Interface to set up and start HSPICE to simulate the netlist
3. View the results in CosmosScope
Netlist
Setup
Simulation
CosmosScope
90 minutes
56