Hi there.
playing with spectre netlists i came across a small issue about
parameter scopes in subdevice instances.
consider the netlist
====
parameters volts=2
subckt compon 1 2
V1 (1 2) vsource dc=volts
ends
instance (1 2) compon
====
there are three ways to resolve "dc" for instance.V1
(1) "no value", because "volts" has no value etc..
(2) look up volts in the scope containing instance
(3) look up volts in the scope where compon is declared
now, (1) is what gnucap does. (2) is what spectre is doing and (3) is
simple to implement. i propose to go for (2), at least before fine
tuning via OPT:: or language compatibility plugins is needed/available.
the easiest patch i could think of to achieve (2) is
in DEV_SUBCKT::precalc_{first,last}
replace the call
subckt()->precalc_{first,last}();
with
assert(!_parent->subckt()->params()->_try_again);
_parent->subckt()->params()->_try_again = (scope()->params());
subckt()->precalc_{first,last}();
_parent->subckt()->params()->_try_again = 0;
respectively.
this also works for expression arguments and cross-scope evaluation.
appearently it only makes a difference in cases where gnucap is
reporting 'no value' right now.
regards
felix
_______________________________________________
Gnucap-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/gnucap-devel