This shows you the differences between two versions of the page.
— |
gnucap:manual:examples:polyglot [2023/04/18 01:31] (current) felixs created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | In some situations it may be desirable to share circuit and analysis across multiple backends. Examples are cross verification, benchmarking, pointing out differences, or demonstrate problems. | ||
+ | Gnucap provides a mechanism that can be used to share batch files with other spice implementations more easily. Consider the following spice input. | ||
+ | |||
+ | <code> | ||
+ | spice | ||
+ | |||
+ | I1 1 0 1 | ||
+ | R1 1 0 1 | ||
+ | |||
+ | *>.print dc v(1) | ||
+ | .dc | ||
+ | *>.end | ||
+ | .print dc v(1) | ||
+ | </code> | ||
+ | |||
+ | The key concept here is the "anticomment": Spice normally ignores all lines starting with "*". Gnucap in spice mode does not ignore lines starting with *>. | ||
+ | |||
+ | With this, the input above runs with either gnucap, gnucap -b and ngpice -b, performing a similar simulation with similar results. | ||
+ | |||
+ | As you may have noticed, post-punchcard file formats often define preprocessor conditionals. Typical contenders for comparisons such as ngspice do not support any of these. |