Kevin Aylward said:
Why?
Which model, 1, 2, 3 bsim3?
Maybe. What do you want to do. Some things are easy, some things you
shouldn't mess with until you've figured out the code in more detail.
Some things you should never mess with
Ditto on that. Messing with the MOS equations on Spice 2 or 3 can
result in major accuracy and convergence problems that you may never
solve. I've been using Spice and doing device model extraction for 20
years and you couldn't pay me to jump into that code base to do that.
And that's with 20 years of C (and C++, Java, etc.) experience to
boot. I'd sooner start a new simulator from scratch.
Generally for the average Spice user only want to mess with device
models when you are using a Spice or Spice-like tool that was
specifically designed for user modifications. The issue is that in
Spice there are two areas of iterative numeric computation (non-linear
DC analysis and then transient analysis) which can be seriously messed
up with bad or malformed model equations. "Bad" can mean flawed
companion model, 1st or 2nd derivative discontinuities, etc. Consider:
why would everyone mess SUBCKTs or analog behavioral commands if you
could easily write some C and drop it in? It's because you usually
can't.
http://www.ecircuitcenter.com/Circuits/ABM1/ABM1.htm
It should also be noted that most/all of the MOS models were
originally PhD theses. Any one of the current models available will
probably be better than what you come up with. Just food for thought.
Despite that "fear-of-god" speech, here's a place to start. This is a
nice online exposition of how Spice works:
http://www.ecircuitcenter.com/SPICEtopics.htm
http://www.ecircuitcenter.com/SpiceTopics/Overview/Overview.htm
MM