As an example, suppose we have a device line
C126 2 4 50fFin a subcircuit which is instantiated as a subcircuit instance Xgate, which itself is instantiated at the top level in a subcircuit instance Xadder. After applying the wrspice algorithm, this line becomes
C126.Xgate.Xadder 2.Xgate.Xadder 4.Xgate.Xadder 50fFassuming the use of `.' as the concatenation character. Note the straightforwardness of this approach: one merely starts with the given name (device or node) and appends a concatenation character and subcircuit instance name, walking up the hierarchy. The `x' or `X' characters of the instance names are retained.
In addition, if a device model is defined in a subcircuit, the model name is mapped as follows. Suppose that the subcircuit instantiated as Xgate contained a .model line like
.model foo nmos(...)
The model is only accessible in instances of this subcircuit (and any sub-subcircuits), with the name mapped to (for example)
.model foo.Xgate.Xadder nmos(...)
Thus models use exactly the same naming convention. Note that models are generated per-instance rather than per-subcircuit. The reason is that if the subcircuit is parameterized, the model in each instance may be different, if different parameters are provided to the instances, and model text uses the parameters.