Beruflich Dokumente
Kultur Dokumente
Ahtisham Pampori
Nanolab, Indian Institute of Technology Kanpur
Contents
• According to them:
“Xyce (zīs, rhymes with “spice”) is an open source, SPICE-compatible, high-
performance analog circuit simulator, capable of solving extremely large circuit
problems by supporting large-scale parallel computing platforms.”
• Why XYCE?
One of the few open-source simulators to offer a well documented Verilog-A
integration.
• Quoting Wikipedia:
“ADMS is a public domain software to translate Verilog-A models into C-models
which can be directly read by a number of SPICE simulators”
• ADMS has a commercial analogue: Tiburon Design Automation (owned by
Mentor Graphics) which is used by most of the contemporary SPICE simulators.
• Drawbacks:
▪ ADMS adds a Verilog-A model at compile-time while all commercial simulators do this at
runtime.
▪ ADMS has a limited repertoire for converting Verilog-A constructs.
• A recent forked version is available at: https://github.com/Qucs/ADMS
.C
Verilog-A Inbuilt
Code ADMS XYCE Device
.h
Vg 2 0 1V Vg 2 0 1V
Vd 5 0 1V Vd 5 0 1V
R1 5 1 1M R1 5 1 1M
M1 1 2 0 0 NM M1 1 2 0 0 NM
.MODEL NM NMOS L=1u W=10u .MODEL NM NMOS L=1u W=10u
▪ Inline Comments:
▪ Block Comments:
• Both `include and `define simply paste the contents of what lies in
front of them.
• `include works with files i.e. it pastes the contents of the file
mentioned at the location it is invoked.
• Example:
• `define is used to abbreviate long strings or pieces of code by
assigning them a name (this name goes by the jargon “macro”)
• Example:
Example:
▪ Reals
– Described by IEEE STD-754-1985 for double precision floating point numbers.
– Saved in 64-bit registers.
– Default to zero.
Example:
• Example:
Disciplines are used to specify the type of a continuous wire (ex: electrical, mechanical, rotational,
optical, thermal, etc.). Natures are used to describe the signals used in disciplines.
• Nature:
▪ A collection of attributes shared by a class of signals. e.g. A signal can be a voltage, current, charge,
temperature, etc.
▪ The attributes defined in a nature are:
– Units
– Access
– Abstol
– Abstol_Override
– Related Natures: ddt_nature and idt_nature
▪ Example:
nature Current
units = "A";
access = I;
abstol = 1p;
idt_nature = Charge;
endnature
• Disciplines:
▪ A discipline is a type used when declaring analog nodes, ports, or branches.
▪ Logic discipline not valid for Verilog-A
▪ Attributes of disciplines:
– Potential: The nature of the signal
measured across nodes.
– Flow: The nature of the signal
measured through a node pair.
• Module:
▪ Modules define reusable components in Verilog-A. In our case, the module is the device we
are trying to model.
• Node:
▪ A node is an electrically infinitesimal point of interconnection.
▪ Need to define discipline.
• Net:
▪ Nodes within a module are called nets.
▪ Need to define discipline.
• Ports:
▪ Nets which lie at the boundary of the module and let it communicate with other modules.
▪ Need to define discipline as well as directionality.
• Branch:
▪ A branch is a path between two nets.
▪ The branch derives its discipline from the net it is connected to.
Module
Nets
Branch
Ports
= Nodes
Nanolab, Indian Institute of Technology Kanpur 19
Building Blocks - Access functions, contributions and
assignments
• Access functions, as the name suggests, are used to access potential
and flux signals between/on nets, ports or branches.
• Examples of access functions:
res1
• Model description
• Analog Functions
• Parameter Bounds
• Model description
• $temperature function:
• Implementation of polynomial using pow():
• Using macros.
• Macros are supposed to be single lines of code
• Escaping newline.
• Can make a macro span multiple lines for legibility by properly escaping
newline characters.
• A discussion about efficiency: Macros v/s Functions
▪ Functions: Lead to stack-frames and call stacks which involve memory
allocation (slow processes).
▪ Macros: Significantly faster than functions. However, type resolution is absent.
If we define `square(a) a*a
`square(5) is 5*5=25
However, `square(1+4) is 1+4*1+4 = 9!!
• Self heating
res1
Branch
te
rth ith
p n
A thermal
An electrical discipline net
discipline port
• https://nanohub.org/resources/20580/download/2014.02.21-
Coram-NEEDS.pdf
• How to (and how not to) write a compact model in Verilog-A –
Geoffrey Coram
• Best Practices for Compact Modeling in Verilog-A - IEEE JEDS 2015
Questions