tutorial: how to (and how not to) write a compact model in...

45
The World Leader in High Performance Signal Processing Solutions a Tutorial: How to (and How NOT to) Write a Compact Model in Verilog-A Geoffrey Coram Analog Devices, Inc. 2004 IEEE Behavioral Modeling and Simulation Conference (BMAS2004)

Upload: tranbao

Post on 26-Apr-2018

213 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

The World Leader in High Performance Signal Processing Solutions a

Tutorial:How to (and How NOT to)Write a Compact Model in

Verilog-A

Geoffrey CoramAnalog Devices, Inc.

2004 IEEE Behavioral Modeling and Simulation Conference (BMAS2004)

Page 2: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A2 a

Introduction

High-level language for compact modeling is long overdueVerilog-A is becoming the standardAnalog-only subset of Verilog-AMSCompact modeling extensions in LRM 2.2

Remaining steps:Compact model developers need to become comfortableCompilers must generate fast and reliable code

Page 3: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A3 a

What is a Compact Model?

A model of transistor currents & voltagesBuilt from physically-motivated equationsIntended for use in an analog circuit simulator

TCAD model

Gate-level model

accuracy

spee

d

compact model

Page 4: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A4 a

Why Verilog-A?

Faster implementation compared to C(or FORTRAN)BSIM3 self-heating: 1-2 days in Verilog-Aversus 2-3 weeks in CDerivatives coded automatically

Page 5: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A5 a

Why Verilog-A?

Faster implementation compared to C(or FORTRAN)BSIM3 self-heating: 1-2 days in Verilog-Aversus 2-3 weeks in CDerivatives coded automatically

Multiple simulator supportAnalog Devices:Adice, Motorola/Freescale:MicaCadence:Spectre, MentorGraphics:Eldo,Synopsys:NanoSim, Agilent:ADS & ICCap,Silvaco:SmartSpice & UTMOST, …No* simulator-specific details

Page 6: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A6 a

Many models, many simulators

SpectreEldo

ADSSmash

Nanosim

HSIM

APLAC

AMSGoldenGate

HSPICE

VBIC

HiCUMBSIM

Mextram

ACM

HiSIM

USIM

SP

EKVMM11

Source: C. McAndrew, et al, “Extensions to Verilog-A to Support Compact Device Modeling”

Page 7: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A7 a

Many models, many simulators

SpectreEldo

ADSSmash

Nanosim

HSIM

APLAC

AMSGoldenGate

HSPICE

VBIC

HiCUMBSIM

Mextram

ACM

HiSIM

USIM

SP

EKVMM11

Source: C. McAndrew, et al, “Extensions to Verilog-A to Support Compact Device Modeling”

Page 8: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A8 a

Ver

ilog-

A I

nter

face

The Solution

SpectreEldo

ADSSmash

Nanosim

HSIM

APLAC

AMSGoldenGate

HSPICE

VBIC

HiCUMBSIM

Mextram

ACM

HiSIM

USIM

SP

EKVMM11

Source: C. McAndrew, et al, “Extensions to Verilog-A to Support Compact Device Modeling”

Page 9: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A9 a

Why not Verilog-A?

Implementation problemsSlow performancePoor convergenceInconsistent results between simulators

Missing language constructsToo easy to create (bad) modelsDiscontinuitiesNon-physical equations that “blow up” outside expected range(but at least the derivatives are always right)

Page 10: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A10 a

Why not Verilog-A?

Implementation problemsSlow performance Compiled interfacesPoor convergenceInconsistent results between simulators

Missing language constructs Too easy to create (bad) modelsDiscontinuitiesNon-physical equations that “blow up” outside expected range(but at least the derivatives are always right)

Page 11: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A11 a

Why not Verilog-A?

Implementation problemsSlow performancePoor convergence Mature implementationsInconsistent results between simulators

Missing language constructsToo easy to create (bad) modelsDiscontinuitiesNon-physical equations that “blow up” outside expected range(but at least the derivatives are always right)

Page 12: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A12 a

Why not Verilog-A?

Implementation problemsSlow performancePoor convergenceInconsistent results between simulators

Missing language constructs CM extensionsToo easy to create (bad) modelsDiscontinuitiesNon-physical equations that “blow up” outside expected range(but at least the derivatives are always right)

Page 13: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A13 a

Why not Verilog-A?

Implementation problemsSlow performancePoor convergenceInconsistent results between simulators

Missing language constructsToo easy to create (bad) modelsDiscontinuities Verilog-A debuggers?Non-physical equations that “blow up” outside expected range(but at least the derivatives are always right)

Page 14: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A14 a

How TO

Verilog-A is a simple language

Most concepts can be learned from studying a simple example

Can write BSIM3 in Verilog-A using only the concepts discussed here

Page 15: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A15 a

Diode example, p1`include "disciplines.vams"`include "constants.vams"module diode(a,c);

inout a,c;electrical a,c,int;branch (a,int) res;branch (int,c) dio;parameter real is = 10p from (0:inf);parameter real rs = 0.0 from [0:inf);parameter real cjo = 0.0 from [0:inf);parameter real vj = 1.0 from (0:inf);

Page 16: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A16 a

Diode example, p1`include "disciplines.vams"`include "constants.vams"module diode(a,c);

inout a,c;electrical a,c,int;branch (a,int) res;branch (int,c) dio;parameter real is = 10p from (0:inf);parameter real rs = 0.0 from [0:inf);parameter real cjo = 0.0 from [0:inf);parameter real vj = 1.0 from (0:inf);

modules replace Spice primitives

Page 17: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A17 a

Diode example, p1`include "disciplines.vams"`include "constants.vams"module diode(a,c);

inout a,c;electrical a,c,int;branch (a,int) res;branch (int,c) dio;parameter real is = 10p from (0:inf);parameter real rs = 0.0 from [0:inf);parameter real cjo = 0.0 from [0:inf);parameter real vj = 1.0 from (0:inf);

terminalsaka ports(int is internal)

Page 18: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A18 a

Diode example, p1`include "disciplines.vams"`include "constants.vams"module diode(a,c);

inout a,c;electrical a,c,int;branch (a,int) res;branch (int,c) dio;parameter real is = 10p from (0:inf);parameter real rs = 0.0 from [0:inf);parameter real cjo = 0.0 from [0:inf);parameter real vj = 1.0 from (0:inf);

branches connect nodes

Page 19: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A19 a

Diode example, p1`include "disciplines.vams"`include "constants.vams"module diode(a,c);

inout a,c;electrical a,c,int;branch (a,int) res;branch (int,c) dio;parameter real is = 10p from (0:inf);parameter real rs = 0.0 from [0:inf);parameter real cjo = 0.0 from [0:inf);parameter real vj = 1.0 from (0:inf);

parameter declarations include default values and ranges

Page 20: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A20 a

Diode example, p2`ifdef VAMS_COMPACT_MODELING

aliasparam phi = vj;(*desc="jct. voltage"*) real vd;(*desc="current"*) real id;(*desc="depl. charge"*) real qd;(*desc="depl. cap."*) real cd;(*desc="conductance"*) real gd;`define GMIN ($simparam("gmin"))

`elsereal vd, id, qd;`define GMIN (1.0e-12)

`endif

Page 21: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A21 a

Diode example, p2`ifdef VAMS_COMPACT_MODELING

aliasparam phi = vj;(*desc="jct. voltage"*) real vd;(*desc="current"*) real id;(*desc="depl. charge"*) real qd;(*desc="depl. cap."*) real cd;(*desc="conductance"*) real gd;`define GMIN ($simparam("gmin"))

`elsereal vd, id, qd;`define GMIN (1.0e-12)

`endif

compiler directive for CM extensions

Page 22: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A22 a

Diode example, p2`ifdef VAMS_COMPACT_MODELING

aliasparam phi = vj;(*desc="jct. voltage"*) real vd;(*desc="current"*) real id;(*desc="depl. charge"*) real qd;(*desc="depl. cap."*) real cd;(*desc="conductance"*) real gd;`define GMIN ($simparam("gmin"))

`elsereal vd, id, qd;`define GMIN (1.0e-12)

`endif

outputvariables

Page 23: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A23 a

Diode example, p3analog begin

V(res) <+ I(res) * rs;vd = V(dio);id = is * (limexp(vd/$vt) - 1.0);if (vd < 0) begin

qd = 2.0 * cjo * vj * (1.0 - sqrt(1.0 - vd/vj));end else begin

qd = cjo * vd * (1.0 + vd / (4.0 * vj) );endI(dio) <+ id + `GMIN * vd;I(dio) <+ ddt(qd);

Page 24: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A24 a

Diode example, p3analog begin

V(res) <+ I(res) * rs;vd = V(dio);id = is * (limexp(vd/$vt) - 1.0);if (vd < 0) begin

qd = 2.0 * cjo * vj * (1.0 - sqrt(1.0 - vd/vj));end else begin

qd = cjo * vd * (1.0 + vd / (4.0 * vj) );endI(dio) <+ id + `GMIN * vd;I(dio) <+ ddt(qd);

one analog block per module; describes behavior

Page 25: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A25 a

Diode example, p3analog begin

V(res) <+ I(res) * rs;vd = V(dio);id = is * (limexp(vd/$vt) - 1.0);if (vd < 0) begin

qd = 2.0 * cjo * vj * (1.0 - sqrt(1.0 - vd/vj));end else begin

qd = cjo * vd * (1.0 + vd / (4.0 * vj) );endI(dio) <+ id + `GMIN * vd;I(dio) <+ ddt(qd);

parasiticresistance

Page 26: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A26 a

Diode example, p3analog begin

V(res) <+ I(res) * rs;vd = V(dio);id = is * (limexp(vd/$vt) - 1.0);if (vd < 0) begin

qd = 2.0 * cjo * vj * (1.0 - sqrt(1.0 - vd/vj));end else begin

qd = cjo * vd * (1.0 + vd / (4.0 * vj) );endI(dio) <+ id + `GMIN * vd;I(dio) <+ ddt(qd);

diode dc current

Page 27: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A27 a

Diode example, p3analog begin

V(res) <+ I(res) * rs;vd = V(dio);id = is * (limexp(vd/$vt) - 1.0);if (vd < 0) begin

qd = 2.0 * cjo * vj * (1.0 - sqrt(1.0 - vd/vj));end else begin

qd = cjo * vd * (1.0 + vd / (4.0 * vj) );endI(dio) <+ id + `GMIN * vd;I(dio) <+ ddt(qd);

depletion capacitance

Page 28: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A28 a

Diode example, p4`ifdef VAMS_COMPACT_MODELING

gd = ddx(id, V(int));cd = ddx(qd, V(int));

`endifI(dio) <+ white_noise(2 * `P_Q * id, "shot");V(res) <+ white_noise(4 * `P_K *

$temperature * rs,"thermal");

endendmodule

Page 29: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A29 a

Diode example, p4`ifdef VAMS_COMPACT_MODELING

gd = ddx(id, V(int));cd = ddx(qd, V(int));

`endifI(dio) <+ white_noise(2 * `P_Q * id, "shot");V(res) <+ white_noise(4 * `P_K *

$temperature * rs,"thermal");

endendmodule

small-signal output variables

Page 30: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A30 a

Diode example, p4`ifdef VAMS_COMPACT_MODELING

gd = ddx(id, V(int));cd = ddx(qd, V(int));

`endifI(dio) <+ white_noise(2 * `P_Q * id, "shot");V(res) <+ white_noise(4 * `P_K *

$temperature * rs,"thermal");

// I(dio) <+ flicker_noise(…);end

endmodule

noisecontributions

Page 31: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A31 a

Parameter handling

Default expressionsparameter integer mobmod = 1 from [1:3];parameter real uc =

(mobmod==3) ? –46.5e-3 : -46.5e-12;

Testing if a parameter was specified with $param_given()

String parametersparameter string type = "NMOS"

from {"NMOS", "PMOS"};

Page 32: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A32 a

How NOT toDon’t use log() where you mean ln()

Don’t introduce discontinuities:abs(x) when x is bias-dependentif() clauses that don’t join up

Don’t use analysis() or events

Page 33: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A33 a

log() vs ln()Languages that use log() to mean the natural logarithm:

C, C++ FORTRANMATLAB VHDL-AMS…

Languages that use ln()Verilog-A

THREE independent model writers have been tripped up by this

Page 34: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A34 a

Discontinuities

SPICE models (for analog simulators) must be well-behaved:I(V) continuousdI/dV continuous for Newton’s methoddnI/dVn continuous for distortion simulationsphysical charges and currents arewell-behaved

Page 35: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A35 a

Discontinuities

Consider this code:if (vbs == 0.0) beginqbs = 0.0;capbs = czbs+czbssw+czbsswg;

end else if (vbs < 0.0) beginqbs = …

…I(b,s) <+ ddt(qbs);

Page 36: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A36 a

Discontinuities

Resulting C code:if (vbs == 0.0) {qbs = 0.0;dqbs_dvbs = 0.0;//capbs=czbs+czbssw+czbsswg;

} else if (vbs < 0.0) {qbs = …

Automatic derivative differs from

intended value

Page 37: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A37 a

analysis()

Consider this code:

if (analysis("tran")) beginqd = …

Page 38: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A38 a

analysis()

Consider this code:

if (analysis("tran")) beginqd = …

Capacitance in small-signal ac analysis,harmonic balance, envelope followingPseudo-transient homotopy

Page 39: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A39 a

analysis()

Consider this code:if (analysis("noise")) begin

flicker = strongInversionNoiseEval(vds, temp);

Page 40: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A40 a

analysis()

Consider this code:if (analysis("noise")) begin

flicker = strongInversionNoiseEval(vds, temp);

But what about PNOISE, HBNoise, …?

Compiler/Simulator MUST do this optimization

Page 41: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A41 a

Events

Consider this code:@(initial_step) beginisdrain = jsat * ad;

Page 42: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A42 a

Events

Consider this code:@(initial_step) beginisdrain = jsat * ad;

What happens for a dc sweep?don’t want re-computing for bias sweepneed re-computing for temperature sweep

Even for transient, initial_step is true for every iteration at time=0Compiler MUST do this optimization

Page 43: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A43 a

OptimizationsDependency treesreplace analysis() and initial_step

Common subexpressionsid = is * (exp(vd/vtm) – 1.0);gd = is/vtm * exp(vd/vtm);

Eliminating internal nodesif (rs == 0.0)V(res) <+ 0.0;elseI(res) <+ V(res) / rs;

Page 44: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A44 a

Conclusion

(Almost) everything you need has been demonstratedHazards have been identifiedLeave optimizations to the simulator

Page 45: Tutorial: How to (and How NOT to) Write a Compact Model in ...bmas.designers-guide.org/2004/presentations/bmas04-coram-preso.pdf · Tutorial: How to (and How NOT to) Write a Compact

G.J. Coram: BMAS2004 Tutorial: Compact Modeling in Verilog-A45 a

Conclusion

(Almost) everything you need has been demonstratedHazards have been identifiedLeave optimizations to the simulator

Go write a Verilog-A model!