SPICE deep yogurt..

I suspect that spice does not handle them as would a code compiler in the same manner.

But the basic operation is the same in the long run.. With LIBS, you pick out what you need, INCLUDE, you bring it all in except the comments and maybe even convert it to some sort of internal token language. The extraction of selected pieces of subckts from LIBs can also be condensed down into the same token type stream of data..

Since LIBS apparently do no have an fast search index in the LIB file, due to its nature of being a Text file, that leads me to believe that at some point Ltspice needs to scan it all and build an index..

THat's just my beef!

Reply to
Maynard A. Philbrook Jr.
Loading thread data ...

How about running all of the spicy things in question under a Windows version of strace? That should show you all the system calls that the user program makes, including which files they open, when, and how much they read from each file. If done correctly, the strace output will be voluminous, but it's pretty easy to grep for fopen()/fread() (or whatever it uses) to find the lines of interest.

Several strace-like utilities appear to exist for Windows, such as

formatting link
and
formatting link
. I don't know the relative merits or otherwise of any of them.

Also, picture related:

formatting link

Standard disclaimers apply; I don't get money or other consideration from any companies mentioned.

Matt Roberds

Reply to
mroberds

Good idea. Or to put the question to bed another way, just run a sim once, load it up with a bunch of useless .LIB directives, and run it again.

Cheers

Phil Hobbs

--
Dr Philip C D Hobbs 
Principal Consultant 
 Click to see the full signature
Reply to
Phil Hobbs

Okay, I did some actual measurements. First, I took a directory of manufacturers' models, and did

cat $(find . -iname "*.lib") >> bubba.lib

yielding a 13.4 MB library full of random complicated stuff.

After stripping out a few things that caused errors (e.g. HSPICE S-parameter files) I ran 18 iterations of a simulation (four op amps and some passives) with and without the line

.lib bubba.lib.

Results:

no bubba: 53 seconds / 18 iterations

bubba: 252 seconds / 18 iterations.

The simulator did apparently parse the library file on each iteration.

So very roughly, the un-needed library call costs

delta Time/delta Libsize ~ 199 sec /(18 iterations * 13.4 MB) = 0.82 seconds per megabyte, mostly spent "expanding subcircuits" according to the status bar. For comparison, my library of common parts is about 100 kB, i.e. 80 milliseconds' worth.

So not huge, but not nothing.

The same file gave errors (multiply-defined parameters) when I tried

.INC bubba.lib

so I wasn't immediately able to compare the two.

Cheers

Phil Hobbs

--
Dr Philip C D Hobbs 
Principal Consultant 
 Click to see the full signature
Reply to
Phil Hobbs

There will not be much difference between .LIB and .INC (.INCLUDE) for small circuits. Where you will take a serious dose is a complex chip design, such as...

I only use .INC (.INCLUDE) on those occasions where my customer already has a chip core designed and wants me to add analog features around that core. Then my schematic simply "includes" the customer's netlist and I don't have to draw anything.

Somewhat similar to how I run PSpice schematics under LTspice... I don't redraw my PSpice circuits in LTspice, I simply run the .CIR file which "calls" my PSpice netlist. ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
 Click to see the full signature
Reply to
Jim Thompson

Maybe suffering from the fingernails down the blackboard Jim. Sure, it wastes memory, but so what.

The largest Spice model files going are barely going to make 1MB, and that is a huge model file. My laptop has 16GB. A decent transient run on a biggish design can be in GB range. Firefox easily gobbles up 500MB, so SuperSpice idling at 50MB is inconsequential, especially as its the data file that overwhelmingly is the main memory drain.

SuperSpice ljust oads all the shit it, so it sits there, with immediate access, and just passes the ones needed to the XSpice engine. No need for that legacy "rebuilding index" of the old PSpice DOS days.

Kevin Aylward

formatting link
formatting link
- SuperSpice

Reply to
Kevin Aylward

You're not up-to-date on PSpice?

You missed this comment?...

There will not be much difference between .LIB and .INC (.INCLUDE) for small circuits. Where you will take a serious dose is a complex chip design, such as...

I only use .INC (.INCLUDE) on those occasions where my customer already has a chip core designed and wants me to add analog features around that core. Then my schematic simply "includes" the customer's netlist and I don't have to draw anything.

Somewhat similar to how I run PSpice schematics under LTspice... I don't redraw my PSpice circuits in LTspice, I simply run the .CIR file which "calls" my PSpice netlist. ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
 Click to see the full signature
Reply to
Jim Thompson

This is what I do.

SuperSpice reads in all models and symbols into memory at startup. It is the absolutely best way to do it today. Period. Memory is insignificant compared to the output data file of a tran run, which SuperSpice also reads in in one go in its entirety.

All the models and symbols are held in class arrays, scanning for a model and processing it, probably takes micro seconds. Time consuming bits are things like netlisting, but again, insignificant to the time of a transient run. My laptop has 16GB, SS idles at around 50MB.

The SuperSpice GUI only passes on the models that the XSpice engine needs. The engine is run as a pure separate Windows exe program, not a dll. This means memory leaks in the Berkely student written code are automatically taken care of by the OS, when the engine finishes.

Kevin Aylward

formatting link
formatting link
- SuperSpice

Reply to
Kevin Aylward

I have to agree with you on the libs and sym in the schematics. Its one messy schematic.

SuperSpice defaults with loading in about 20 model files and 20 symbol files, takes about 1 sec. They are then there for immediate access.

Kevin Aylward

formatting link
formatting link
- SuperSpice

Reply to
Kevin Aylward

PSpice reads in the _index_ to all symbols at start-up, and loads all the "standard" libraries.

Foundry-specific libraries I call via .LIB statements.

...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
 Click to see the full signature
Reply to
Jim Thompson

Had .LIB directive in place, tested as working pointer. Circuit still did not work. Could not get a drawing in the workspace to show everything (ie: to include LM285ADJ scribble). Tried without that scribble, and finally got some curves, but all wrong. Went back to the DOS CIR file, made minor mods (commented out 1 or 2 lines with unrecognized commands like STEP). Got some curves, a bit better,but still not right. Have yet to try different configurations.

Reply to
Robert Baer

DOD based TopSpice used .LIX text based index files for exactly that: give offset into .LIB file foe given part model or subcircuit. Did not use it enough to learn if there was something that would generate a new .LIX file if you wanted to insert a new model, so i had to put them on the end and hand-calculate the index(es).

Reply to
Robert Baer

Why should he make like Polly and repeat what you said? Do you have a cracker for him? Awwkkkkk...

Reply to
Robert Baer

Phil has already said that his small circuit experiment was, indeed, slightly slower. So 'nuff said. ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
 Click to see the full signature
Reply to
Jim Thompson

[snip]

It appears that available Spice models for LM185 may be faulty... or with poor information.

I haven't pursued walking my way thru the published models, but the datasheet says adjustable from 1.24V to 5.3V max ??? ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
 Click to see the full signature
Reply to
Jim Thompson

It's possible to (and I have) run LTSpice under a tracing program that logs all calls to the operating system. I did this to find exactly how and when it was searching directories, and in what order, because the difference in search algorithm between symbols and libraries is annoying and I wanted a work-around.

If you can propose a specific experiment I can do it and report back.

Clifford Heath.

Reply to
Clifford Heath

It's no biggy. At the experimental level, there's hardly any noticeable difference between .LIB and .INC

Try something like this...

and .INC will sink your boat.

...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
 Click to see the full signature
Reply to
Jim Thompson

I don't :-)

As noted prior, on boot, all files are read into memory class arrays of the SS GUI. Its a simple matter to scan e.g. model[n].name and then extract the model[n].data. Only those models are passed on the spice engine, which is ran as a separate windows exe process. Mike may or may not do this.

Kevin Aylward

formatting link
formatting link
- SuperSpice

Reply to
Kevin Aylward

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.