Re: [ng-spice-devel] [ng-spice] ACS, model compiler, cross-post from gEDA list (fwd)
On Fri, 08 Sep 2000, Steve Hamm wrote:
> We have a compiler like this under development for internal use; it's
> a bit crufty, but it works. But first, one needs a well-defined
> interface between models and the simulator to make this work at all. I
> haven't looked at the ng-spice code, but in SPICE3 there was too much
> information about models scattered about the program.
Note the words: "for internal use". There are lots of such things
for internal use. I think it is fair to say that every commercial
Spice vendor has one, and they are all different.
> One drawback to the compiled approach: Assuming that one uses an
> automatic differentiation technique to generate the required jacobian
> entries, the difference between a compiled description and a
> hand-coded model can be 3x or worse, depending.
Mine doesn't do automatic differentiation.
The purpose is to tame the nuisance stuff associated with models:
parsing, error checking, temperature control, binning, .....
> We use Verilog-A as our model prototyping language; I'd suggest that
> it be considered as a possible language. Verilog-A, with a few
> additions and some constructs avoided, can easily express any model
> one might want to develop.
Fine, but it still doesn't handle the nuisance stuff, and translating
existing models to Verilog-A probably won't happen. Mine is designed
so that transating the existing models to it is equivalent to
translating to a slightly different architecture. Then it opens up
the ability for bigger architecture changes.
> Alan> My first reaction was "do we really want LOTS of models". There's
> Alan> already so many around that it's difficult to keep up to speed. But,
> Alan> then I thought of what I've been doing to SPICE over the last few
> Alan> years, and it's basically been trying to add compatibility with other
> Alan> people's models to Berkeley Spice.
That's the point.
> I see the main advantage of a model compiler in adding models for
> strange stuff that nobody else wants: integrated accelerometers,
> sensors, micromechanical stuff, new semiconductor structures.
That's another one.
> The
> industry doesn't need yet another mosfet model, it just needs one good
> one.
And your more likely to get it if the model developer doesn't have to
deal with parsing, binning, the specifics of gather/scatter .. and the
other nuisance stuff, and he can concentrate on the science of
modeling.
> Alan> I had originally intended just a simpler C (or C++ if it's not too
>slow)
> Alan> framework for adding models, but maybe a compiler would be more
> Alan> general.
Actually, C++ should not be any slower.
The problem there is changing all those models. This is why the
Spice interface has remained the way it is for over 10 years.
> This isn't an either/or decision. Both a clean interface and a
> compiler would be good, I think.
Absolutely, and both will be made easier by the other.
Actually, the ACS interface is quite a bit cleaner than the Spice
interface, but you really need to know C++ to use it. The Spice-3
interface is quite a bit cleaner than some others I have seen.
The Spice-3 interface is not bad if you have an automatic generator.
It is terrible for manual generation because there is so much of the
nuisance code to do. All of the files for a particular model are in
one directory. That directory is only that model. One function per
file, etc.
My model compiler is only half done, for ACS, so there is still some
hand stuff. A good bit of the input language is straight C, which is
just copied to the output. There is not much to it, technically.
The compiler itself is in C++. The front end is a pure object
oriented design. The back end is procedural, meaning a C programmer
could handle it. Actually there are 2 backends. One generates the
.h file. The other generates the .cc file. For Spice, the easiest
way to do it is one for each of the files in the device directory.
They are pretty much knock-outs. The hard part for Spice would be
inheritance support. For ACS, I just let the C++ compiler take care
of it. For Spice, you would need to read multiple input files and
combine them.
Partial thread listing:
- Re: [ng-spice-devel] [ng-spice] ACS, model compiler, cross-post from gEDA list (fwd), (continued)
Models,
Alan Gillespie
personal note on ACS and NG-SPICE (fwd)
Paolo Nenzi