I am trying to port a behavioral device model from Cadence Spectre to Spice. In Spectre it is very easy to instantiate multiple parallel instances of a subcircuit automatically - one just calls the subcircuit - an it works for any subcircuit - with an M factor. I have seen that Spice has this functionality for some components - e.g. capacitors, but I could not find anywhere any documentation on how to do it for my on subcircuits. Does anyone know if it is is possible in Spice and how to enable multiplicity in subcircuits?
m is nothing but a convenient shortcut to adding several subcircuits/symbols in parallel. Internally, that's how the circuit is expanded/flattened. If your simulator doesn't have this option, then about the only alternative is to simply add, possibly ad nauseam, several subcircuits and connect them all in parallel. I don't know if
m can be a
float (as opposed to an
int), but if so, then, obviously, you'll have to restrict yourself to a fixed number of subcircuits.
I figured out how it works in Spice. Some Spice implementations, like LTSpice don't seem to have native support for subcircuit multiplicity, and some like ngspice do (see section 3.2 of ngspice v32 manual). This means that for a portable model the multiplicity in the subcircuit has to be implemented like in e.g. a Verilog-A module - explicitly in your model. In the end the multiplicity factor "m" becomes just a parameter of the model.