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

    Hi,

    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.

    Regards,
    Balaji.
     
  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.

    Regards,
    Balaji
     
  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
    require.
     
  6. Hi,

    First take a look at the following sites:

    http://ngspice.sourceforge.net/

    http://www.fe.uni-lj.si/spice/welcome.html

    http://www.geda.seul.org/tools/gnucap/index.html


    Then maybe you could read Al Davis dissertation at
    http://www.geda.seul.org/tools/gnucap/papers/
     
  7. Mike Monett

    Mike Monett Guest

    ...Jim Thompson

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

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    RESEARCH SOFTWARE LICENSE AGREEMENT
    (revised October 1994)

    This agreement was originally found at

    http://buffy.eecs.berkeley.edu/IRO/Software/software.agree.html

    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)

    http://embedded.eecs.berkeley.edu/pubs/downloads/software.agree.html

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

    http://embedded.eecs.berkeley.edu/pubs/downloads/spice/index.htm

    The ILP Description includes a more complete description of the
    package.

    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.

    Regards,

    Mike Monett

    Antiviral, Antibacterial Silver Solution:
    http://silversol.freewebpage.org/index.htm
    SPICE Analysis of Crystal Oscillators:
    http://silversol.freewebpage.org/spice/xtal/clapp.htm
    Noise-Rejecting Wideband Sampler:
    http://www3.sympatico.ca/add.automation/sampler/intro.htm
     
  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.)

    ---Joel
     
  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

    Absolutely.

    ...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

-