This relates to task 2f in verilogams. A paramset produces a component type from an existing component type. The following statement
paramset new_type type parameter par [= value] [range]; [..] .instance_par = {expression}; [..] endparamset.
defines new_type from type. The former inherits the port names from the latter, but parameters, their ranges, and how they are forwarded is defined inside the paramset body (See LRM). Spice models do not work like this, but they need to be accessible from Verilog, and a Spice “model” instance must behave much like a paramset.
This means that a spice .model
statement must declare an instanciable prototype of a given name. Without a .model
statement, a device implemented for Spice is inaccessible.
The declaration
.model mynpn npn (bf=150)
should accomplish approximately the same as the following wrapper with parameters taken from the device stub.
.subckt mynpn c b e s .parameter area=1 off=0 [..] .model m npn (bf=150) Q1 c b e s m off=off area=area [..] .ends
This means that a “mynpn” instance as in
module main(); mynpn #(.area(17.)) nn(.c(a), .b(b), .e(c), .s(d)); endmodule
should work regardless of which definition for mynpn is in use.
Note that the letter 'Q' has lost it's meaning and purpose, consistent with use in Spice. In Spice, assignments of letters to devices are implementation defined and partly random. X
should work whenever a (sub)type name is provided.
Models with extended features will reflect the original intent. For example, if a Spice model supports binning, a model such as
.model mysmallfet some_nmos_model wmin=0 wmax=1,
will have to behave as if some_nmos_device existed, with a paramset declaration as follows.
paramset mysmallfet some_nmos parameter [..] parameter w=1 from [0:1]; [..] endparamset
- This is implemented except for binning.
- A Spice .model statement simply declares a type.
- The Spice .model directive makes little sense when using Verilog-AMS behavioural models.
- paramset could reference a .model instance as a prototype.
- The spice wrapper and instantiation mechanism needs to change a little…