Friday, November 22, 2024

eispice: When SPICE Says Hi To Python

- Advertisement -

eispice, a clone of Berkley SPICE 3 simulation engine. It is optimised for high-speed digital design and has a front-end backed, based and powered by Python.

The design philosophy of Python lends itself to be used for simulators. By design philosophy, I mean the core philosophy that was handily jotted down in the document ‘The Zen of Python,’ which includes gems such as ‘Beautiful is better than ugly,’ ‘Simple is better than complicated’ and others like ‘Readability counts.’ Such an array of underlying principles is the reason why Python is highly extensible.

SPICE and behind the SPICE

Fig 115
Fig. 1: Simulating IBIS using eispice

eispice is one of those products that change the landscape of their intended use by virtue of being so good. It was initially developed and targeted towards PCB-level signal integrity simulation, simulating Input/output Buffer Information Specification (IBIS) model-defined devices, transmission lines and passive termination. Over the years though, scope of the tool has been expanded to include general-purpose simulation features as well.

- Advertisement -

Other than being the only open source simulator that provides native IBIS model support, the most unique feature of eispice is its Python based front-end. This is achieved by wrapping the simulator into a Python module that makes it possible to use Python language to control simulations and process results. If you are not strong with Python, but do work on Berkley SPICE, you can use Python shell instead of nutmeg, and Python scripts can be run like batch-mode SPICE.

Features

eispice has a multitude of features, both regular and unique, so as to help you with a variety of tools. The sub-circuit support allows probing at a deeper level, right to where the sub-assemblies are. It also supports a simple Tk based plotter inhouse, so as to alleviate that concern. It lets you plot characteristic graphs, input and output by means of transient analysis and operating-point analysis.

In addition, a bevy of models also helps in increasing the usefulness of the program. These models are not part of a secret covenant, but are non-linear current and voltage source models, independent source models (like current generator/voltage generator), device models like resistance model, capacitance model or inductance model. Long-length transmission models are also incorporated into it by way of T lossless transmission model. There is also a diode model for diode circuits.

eispice provides access to Python language in order to manipulate SPICE decks and results. This feature lets you present the characteristics and plots as you desire, keeping in mind the customisability/readability of said project. The software has IBIS model import tool, plus all requisite drivers, receivers and pin models for easy use.

eispice software
Fig. 2: eispice software

There is a new piece-wise cubic-spline extension for the incumbent pwl, except for the addition of a pwl keyboard in order to spice it up. Models for VI curves and TA x VI curves have been improvised to increase clarity associated with these. Then there is an improved B-element that includes a time variable and is based on Python call-back, that is, it can use Python statements within B-element model.

Installation

espice is available for free for Windows and Linux operating systems. Whereas for Windows you only need to install it like any other software, for Linux code you need to compile the code before you run it.

So for win edition, download and install Windows version of Python 2.5 and then download and install Numpy, before finally downloading and installing it. As of time of writing, in order to work with eispice version 0.9, you need to install the additional Python and Numpy Python Module installed on your system.

Running eispice

To fire up Python, run Python from the command line and then import eispice module with Import eispice command. Then, check out Python scripts in the test/pass directory for some examples, or try out the example below:

import eispice

 [stextbox id=”info”]cct = eispice.Circuit(“Capacitor Test”)
cct.Vx = eispice.V(1, eispice.GND, 4,
eispice.Pulse(4, 8, ‘10n’, ‘2n’, ‘3n’, ‘5n’, ‘20n’))
cct.Cx = eispice.C(1, eispice.GND, ‘10n’)
cct.tran(‘0.5n’, ‘100n’)
eispice.plot(cct)[/stextbox]

Just like SPICE 3, eispice statements also come in three distinct varieties: component definition (these are device names, types, connection nodes and parameter values), analysis commands (these obviously work on the analysis part, beefing up the back-end analyses) and post-processing commands (like plot, these give a visual look to the data that you get otherwise).

The direction the future is staring at

The primary new feature for the next release is supposed to be this revolutionary W-element-like multi-conductor, frequency-dependent model. Plans for eispice also reveal something known as a digital signalling layer, which assists in driving real signals and not just the rising or falling edge.

Box15

To add to this list, a graphical schematic entry tool and an even better graphing tool is expected to replace the obsolete counterparts as of now.

There are many more features that have been promised by the developers of eispice project. They say, you can get the hang of Python from a newbie level to beginner level in a mere half an hour. Though the time seems adequate for Mensa people, even I was able to do some Python coding after only a couple of hours!

Charles Eidsness is the main developer behind eispice, and it has been nothing short of a miracle for many simulation users who wanted to use a front-end driven neatly by Python.

For more exciting software reviews: click here


Ashwin Gopinath, an engineer, is currently pursuing MBA in operations from Great Lakes Institute of Management (GLIM), Chennai

1 COMMENT

SHARE YOUR THOUGHTS & COMMENTS

EFY Prime

Unique DIY Projects

Electronics News

Truly Innovative Electronics

Latest DIY Videos

Electronics Components

Electronics Jobs

Calculators For Electronics