Connect with us

Modifying Spice Source Code

Discussion in 'Electronic Design' started by [email protected], Aug 22, 2006.

Scroll to continue with content
  1. Guest


    I have to modify the spice source code. To be more spcific I need to
    change the way in which spice computes the poles and zeros of the
    tansfer function of the circuit under being simulated. I have not found
    any material on the web regarding the organisation of the spice source
    code and how it is organised.

    Could anybody advise me on where to start. Is there any resource
    availble on the inetrenet which explains what the functions of the
    files in the source code are? I have no familiarity with the basic code
    structure of spice. I have to start from scratch. I would be grateful
    if anybody could advise me on this issue.

  2. Guest

    I think you have to find a consultant.

    If you insist on this foolishness, search the Berkeley library for
    appropriate doctoral dissertations. Maybe a search on Stanford's
    socrates will turn up something. Their is also google scholar.
  3. Jim Thompson

    Jim Thompson Guest

    You can *purchase* it from Berkeley.

    ...Jim Thompson
  4. Guest

    Is it impossible to modify the spice source code. I have to use a new
    algorithm to speed up spice execution time. This is a part of my
    masters thesis. Could you please be more specific why you said that it
    would be foolishness. I have almost 6 months to work on this.

  5. Now you have explained a bit more, we can help. It appeared that you
    might have been an inexperienced hacker, with no idea of the magnitude
    of the task you were attempting.

    Since you are in academia, you should definitely approach the relevant
    people at Berkeley, who will no doubt provide all the support you
  6. Hi,

    First take a look at the following sites:

    Then maybe you could read Al Davis dissertation at
  7. Mike Monett

    Mike Monett Guest

    ...Jim Thompson

    Used to. It's free now. Here's the software license:

    (revised October 1994)

    This agreement was originally found at

    It is no longer necessary to sign the agreement.

    Software that was originally distributed by the Industrial Liason
    Project is covered by this agreement. Those packages include Spice
    and Magic. (7/01)

    The source for spice3f5.tar.gz and other versions are available at

    The ILP Description includes a more complete description of the

    Please ignore the prices and email addresses, this file is made
    available for historical reasons only.

    Looks like fun. It might take a while to go through 6 megabytes of
    code. I understand there are some bugs.


    Mike Monett

    Antiviral, Antibacterial Silver Solution:
    SPICE Analysis of Crystal Oscillators:
    Noise-Rejecting Wideband Sampler:
  8. Joel Kolstad

    Joel Kolstad Guest

    No; many people do.
    Do you have to support fancy non-linear devices? (E.g., BSIM3 models?) If
    not, it's probably faster to just write your own SPICE simulator supporting R,
    L, C, and low-end (e.g., Ebers-Moll) transistors, diodes, etc. than to try to
    modify the "real SPICE." If such a simulator is sufficient to demonstrate
    your reduction in execution time, it's the route I'd take.

    What kind of analysis are you trying to speed up? I'd perform a thorough
    literature search before you embark on your quest, since unfortunately many
    professors are rather out of touch with what's already been done in the area
    of circuit simulation (it's a very mature topic) and it's often easy for them
    to suggest you go and spend six months doing something that has been done many
    times before. (For instance, you'll find that many commercial simulators
    already incorporate numerous improvements to SPICE that make it markedly
    faster than the Berkeley version.)

  9. Guest

    I run ngspice. BTW, you don't need to purchase the source code as it is
    supplied in source. It really kicks ass under 64 bit linux (suse),
    probably due to the double precision now fitting in one word.
  10. Guest

    Your explanation of the task is so vague that it is hard to tell what
    you are doing. This doesn't give me the warm and fuzzies. Nothing
    personal here.
  11. SPICE is old numeric code. It is likely bummed into peak performance over
    many years and one suspects that it is brittle and relies on very specific
    compile options and tools - maybe some of it is hand-tuned fortran-to-c
    (f2c) (gackkk). It might be much harder than you seem to think. Or not!
  12. SPICE 3 is written in C (a complete re-write, rather than a conversion
    of the Fortran source for SPICE 2).

    David, VA3DKS
  13. Jim Thompson

    Jim Thompson Guest

    That is correct. But all I've ever dared twiddle with was the device
    code for the BJT, in the late '80's. The emitter current crowding and
    capacitance were not correct back then, and I had a GenRad software
    gal patch it for me.

    ...Jim Thompson
  14. joseph2k

    joseph2k Guest

    Actually SPICE 3 series is a complete rewrite from scratch in C.
  15. Jim Thompson

    Jim Thompson Guest


    ...Jim Thompson
  16. Ken Smith

    Ken Smith Guest

    Yes, complete with the dereferencing of uninitialized pointers. For
    certain syntax errors, it did a seg-fault. Somewhere out there you may
    even find "kensmith" if you grep through the source code of a spice
    version. I spent several days feeding it mistakes and tracking down the
    bad dereferences.
  17. joseph2k

    joseph2k Guest

    And for your work improving spice we thank you.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day