Last week I was lucky enough to get tipped off about the last seminar this year for Linear Technology’s free Spice program, LTspice. The seminar was given by the author of the program, Linear Tech employee Mike Engelhardt. From hanging around LT design engineers, I have heard that there is a little PSpice DNA in the company. Mike once said that he hired a former PSpice programmer to help with the project, but LTspice seems to have progressed past PSpice, at least for switching power supply design. Make says that the IC designers at LT use LTspice. This may be why Mike started out with the assertion that a semiconductor company that uses Spice will do a better job than an EDA company that just does programming. I know Barrie Gilbert at Analog Devices would agree, since they have their own awesome Spice, ADICE. I would even accept that for switching power analysis, LTspice has progressed beyond PSpice. But I think my pals at Mentor Graphics and analog IC design standard-bearer Cadence would take exception to the assertions that EDA companies cannot deliver good simulators. Synopsys HSPICE is a standard for a reason, and we won’t even get into to field solvers like Ansoft’s HFSS, that do things Spice programs cannot, like solve Maxwell’s equations in 3-D.

Mike Engelhardt stands beside the timeline of LTspice.

Still, in a way Mike was being way too modest about his achievements with LTSpice. I had a retired LT IC designer clue me in, when I asked him if it was true that you could only use LT parts in LTSpice. He explained that was not true, indeed one of my buddies at Maxim tells me he uses LTspice almost every day. The LT designer then went on to explain what was really cool about LTspice. See, a switching power supply has the same simulation problem as a PLL (phase-locked loop). It takes milliseconds to start up and get to steady-state. But to help the program converge you want slender nanosecond time slices for the matrix solver. What Mike did was craft a way to speed up the billions of calculations that LTspice does, so you can capture that switching power chip start up in a reasonable amount of computational time. This is what I do hear the big EDA companies bragging about lately, how you can run fast Spice for PLL design, but it seem to me that Engelhardt was doing this a decade ago. And that is what gives rise to the urban legend that LTspice can only run LT parts. LTspice will run any standard model that works in PSpice or other simulators. LTspice is not node-limited or crippled in any way. It is the same program the IC designers at LT use. But Engelhardt writes the models for Linear Tech’s switching regulator chips. That is when he consults the IC designer and uses all his magic to properly model the switcher chip, as well as use all the hooks in LTspice to speed up the simulation as the circuits runs up towards steady-state. So no, most companies don’t even offer models of their switcher parts, and if they did the models would not be able to use all of Mike’s tricks inside LTspice. But if you want to model a controller, or even use a giant slow transistor-level model of a controller or op-amp, LTspice will run it, and probably a lot faster than many other simulators. That is because the specialized tricks are not the only thing making LTspice fast.

Mike explained in the seminar that he started using multithreading and assembly language back in 2008, to get the program to do simulations in what to me appeared to be way under 1 second. He also said that the program self-authors- it examines the hardware, and invokes some of the 50 or so hardware description compliers he has coded. Then the program writes, compiles, and links its own assembly code, and runs the simulation.

Now my programmer consultant buddy said that does not make sense, you should be able to run an interpreted program faster than you can compile and run an assembly language program, so it is likely I have misconstrued what Engelhardt said, or he simplified his explanations for a bunch of hardware folks in the seminar. All I know is that LTspice runs quite fast.

What else? Well Engelhardt said there have been 3 million downloads of LTspice. I assume he is including the earlier SwitherCAD program in that tally. Mike said that a current-feedback switcher is a glorified flip-flop, but the model has to account for every single thing that can set or reset the flip-flop. Engelhardt then did a demo of the program simulating a switching regulator circuit. It was fast and impressive. He showed how to edit symbols three different ways.

One thing he demonstrated is how a perfect output capacitor with no ESR (equivalent series resistor) will make most converters unstable, since the lack of ESR means that there is no ripple generated that you can feedback to the controller. He then showed how you could edit the ideal symbol to add an ESR and then the controller becomes stable. When asked if the capacitor with ESR will then report a power loss if you queried it, he said the program “cannot be better than perfect” and that the cap both accepts and delivers power. You can always add a resistor in series to the output cap and query that for power loss, but Engelhardt felt that was a kludge.

This is where we see the divide between programmers and hardware people. I think that if a real cap with real ESR gets hot, than the simulator should show it. When asked about Spice results not agreeing with your hardware Engelhardt said “If your simulation doesn’t agree with the lab results, you did not build what you simulated.” Spoken like a true programmer, who sees the virtual world as the reality that the real world must emulate. I just had lunch with three experienced RF engineers and they went ballistic when I told them that quote. Then we talked about all the ways Spice will give bad results. We blame the program, and by inference, the programmer. The programmer blames us for not building what we simulated. As I get older, I can see that both positions are right. The thing is, it is the college kids and inexperienced engineers who need Spice the most. None of the three older expert RF engineers put much credence in Spice. So if the young people who need Spice don’t know how to build what they simulated, the old folks who would know how to do that don’t use Spice at all, where does that leave us? I do see my RF buddies’ point. After all, if you knew how to build a circuit that emulates your Spice, why use Spice at all? Save the time and just build it, put in a decade box to tweak the values and save a month or week off the development time. So I think as an industry we all have to try to meet in the middle. Our CAD tools should help understand what will happen in the real world, and even us old guys have to celebrate all the things Spice can do, like Monte Carlo and sensitively analysis, something that would take weeks to do on the bench. Oh, and a buddy that loves LTspice showed me how to get a power level in the output cap. He just built an mathematical entity that took the current inand out of the cap and multiplied the square by the ESR to get power. You can then read that out, if you also think adding a separate little ESR resistor is too kludgey.

All I know is that Spice is an important tool for electrical engineers. Even a tool as advanced as LTSpice will lie to you if you don’t know what you are doing. But if you use Spice to learn, and do analysis, and then most importantly, figure what happened if the simulation does not match the lab, you would be a much better engineer than the zombies that just sit behind a computer or the old salts that just rely on experience.

Finally, Mike Engelhardt mentioned a classic book on modeling “by two Italians,” I assume that is Semiconductor Device Modeling with Spice. I want to toss in the great book Matthew Berggren at Altium tipped me off to, Inside Spice. This out-of-print book is for us system folks. It points out that Spice stands for “simulation program with IC emphasis” and that all the defaults of many programs are set up for ICs. The author, Ron M. Kielkowski, then shows how to tweak all the little setting so your board-level simulation converges. It is way cooler than putting 0.001 ohm resistors in series with all the diodes like I do. No way to get around no capability for floating nodes though, keep those 100Gohm resistors handy.

Here is a picture of Bob Widlar’s Spice, an RC pot box he used to figure out compensation of his amplifiers.

And really really finally, here is a picture of my dear departed Spice-hating friend, Bob Pease, holding a soldering iron I gave him in honor of his assertion that “A soldering iron is my Spice.”