Professional Documents
Culture Documents
Verilog-A:
An Introduction
for Compact Modelers
Geoffrey Coram
Outline
The
Problem
Modeling Languages
Diode Example
Guidelines
Admonishments
Compiler Optimizations
Conclusion
References (and Further Examples)
ACM
USIM
BSIM
HiCUM
Mextram
PSP
HiSIM
HVEKV
MM20
Eldo
ADS
Spectre
Smash
HSIM
APLAC Nanosim
HSPICE
Golden
Gate
AMS
The Solution
VBIC
HiCUM
Mextram
PSP
HiSIM
HVEKV
MM20
Modeling Interface
USIM
BSIM
Eldo
ACM
ADS
Spectre
Smash
HSIM
APLAC Nanosim
HSPICE
Golden
Gate
AMS
Modeling Languages
Programming
languages:
FORTRAN
(SPICE2)
C (SPICE3)
+ Fast, direct access to simulator
Must compute derivatives
No standard interface
MATLAB
+
Verilog-AMS
Pushed
vdsat, id_chan
also gm, cgs using new ddx() operator
$simparam
(gmin)
$param_given
paramsets
cards
VHDL-AMS Diode
-- Modified from http://www.syssim.ecs.soton.ac.uk/vhdl-ams/examples/smpr.htm
library IEEE;
use IEEE.math_real.all;
use IEEE.electrical_systems.all;
use IEEE.FUNDAMENTAL_CONSTANTS.all;
entity diode is
generic (Isat: current := 1.0e-14); -- Saturation current [Amps]
port (terminal p, n : electrical);
end entity diode;
architecture ideal of diode is
quantity v across i through p to n;
constant TempC : real := 27.0; -- Ambient Temperature [Degrees]
constant vt : real := PHYS_K*(273.15 + TempC )/PHYS_Q; -- Thermal Voltage
begin
i == Isat*(limit_exp(v/vt) - 1.0);
end architecture ideal;
VHDL-AMS Diode
-- Modified from http://www.syssim.ecs.soton.ac.uk/vhdl-ams/examples/smpr.htm
library IEEE;
use IEEE.math_real.all;
use IEEE.electrical_systems.all;
use IEEE.FUNDAMENTAL_CONSTANTS.all;
is is a keyword!
entity diode is
generic (Isat: current := 1.0e-14); -- Saturation current [Amps]
port (terminal p, n : electrical);
end entity diode;
TempC is a constant!
10
Verilog-A Diode
`include "disciplines.vams"
module diode(a,c);
inout a,c; electrical a,c;
parameter real is = 10p from (0:inf);
real id;
(*desc = "conductance "*) real gd;
analog begin
id = is * (limexp(V(a,c) / $vt) 1.0);
gd = ddx(id, V(a));
I(a,c) <+ id + V(a,c)*$simparam("gmin", 1e-12);
end
endmodule
11
Verilog-A Diode
`include "disciplines.vams"
module diode(a,c);
inout a,c; electrical a,c;
parameter real is = 10p from (0:inf);
real id;
(*desc = "conductance "*) real gd;
analog begin
id = is * (limexp(V(a,c) / $vt) 1.0);
gd = ddx(id, V(a));
I(a,c) <+ id + V(a,c)*$simparam("gmin", 1e-12);
end
thermal voltage uses
endmodule
simulation temperature
12
Verilog-A Diode
`include "disciplines.vams" disciplines define
through and across
module diode(a,c);
variables
inout a,c; electrical a,c;
parameter real is = 10p from (0:inf);
real id;
(*desc = "conductance "*) real gd;
analog begin
id = is * (limexp(V(a,c) / $vt) 1.0);
gd = ddx(id, V(a));
I(a,c) <+ id + V(a,c)*$simparam("gmin", 1e-12);
end
endmodule
13
Verilog-A Diode
modules combine
`include "disciplines.vams"
entity and
module diode(a,c);
architecture;
inout a,c; electrical a,c;
parameter real is = 10p from (0:inf);
replace Spice
real id;
primitives
(*desc = "conductance "*) real gd;
analog begin
id = is * (limexp(V(a,c) / $vt) 1.0);
gd = ddx(id, V(a));
I(a,c) <+ id + V(a,c)*$simparam("gmin", 1e-12);
end
endmodule
14
Verilog-A Diode
`include "disciplines.vams" parameters have
module diode(a,c);
ranges (and defaults)
inout a,c; electrical a,c;
parameter real is = 10p from (0:inf);
real id;
(*desc = "conductance "*) real gd;
analog begin
id = is * (limexp(V(a,c) / $vt) 1.0);
gd = ddx(id, V(a));
I(a,c) <+ id + V(a,c)*$simparam("gmin", 1e-12);
end
endmodule
15
Verilog-A Diode
`include "disciplines.vams"
module diode(a,c);
inout a,c; electrical a,c;
parameter real is = 10p from (0:inf);
real id;
(*desc = "conductance "*) real gd;
analog begin
id = is * (limexp(V(a,c) / $vt) 1.0);
gd = ddx(id, V(a));
I(a,c) <+ id + V(a,c)*$simparam("gmin", 1e-12);
end
built-in function with
endmodule
improved convergence
16
much like C
Intuitive
Set
17
Best Practices
Models
No
watch
non-quasi-static formulations
allows model to run in RF simulator
Noises
as current sources
No discontinuities
18
Discontinuities
Spice
Discontinuities
Resulting
C code:
Automatic derivative
differs from
if (vbs == 0.0) {
intended value
qbs = 0.0;
dqbs_dvbs = 0.0;
//capbs=czbs+czbssw+czbsswg;
} else if (vbs < 0.0) {
qbs =
20
Discontinuities
HiSIM2
4
3.5
3
x1e-3
Verilog-A
(beta code)
Clipping in C code
may affect values
and derivatives
differently
2.5
2
1.5
1
.5
0
-80
-40
40
80
vd, x1e-3
120
160
200
Compiler Optimizations
Common
subexpressions
id = is * (exp(vd/vtm) 1.0);
gd = is/vtm * exp(vd/vtm);
Eliminating
internal nodes
if (rs == 0.0)
V(b_res) <+ 0.0;
else
I(b_res) <+ V(b_res) / rs;
Dependency
replace
22
trees
analysis()
Consider
this code:
if (analysis("tran")) begin
qd =
No
capacitance in:
small-signal
ac analysis,
harmonic balance, envelope following
Pseudo-transient homotopy
23
analysis()
Consider
this code:
if (analysis("noise")) begin
flicker =
strongInversionNoiseEval(vds,
temp);
But
Compiler/Simulator
24
Events
Consider
this code:
@(initial_step) begin
isdrain = jsat * ad;
What
dont
Compiler/Simulator
25
Eg
PSP Verilog-A:
begin : initializeModel
NSUB0_i = `CLIP_LOW(NSUB0,1e20);
//
Doesnt
26
Software Practices
Use
consistent indentation
Align code vertically on =
Use meaningful names
use
Include
28
29
30
31
32
correct
indentation
Tratio_SH=(Tempp+V(TH)*SH_switch)/TNOMK;
BEX=BEX0/pow( abs(VG-VS) +1e-1,par_SHE);
KP_T=KP0*pow(Tratio_SH,BEX);
33
34
Coding Style
Verilog-A
Characterization
engineers and
simulator people will read it
Make
35
a good impression!
Conclusion
Verilog-A
Writing
Many
36
References
Designers
Guide
http://www.designers-guide.org/
Forum
Verilog-A model library (VBIC, MOS11, JFET, etc.)
MCAST
http://www.ee.washington.edu/research/
mscad/shi/mcast.html
Automatic compiler beats hand-coded C
37
Examples
Verilog-A
model library at
http://www.designers-guide.org/VerilogAMS/
VBIC,
Silvaco
https://src.silvaco.com/ResourceCenter/en/ do
wnloads/verilogA.jsp
BSIM3,
http://hitec.ewi.tudelft.nl/mug/
HiCUM
http://www.iee.et.tu-dresden.de/iee/
eb/hic_new/hic_intro.html
38