Paramset, PARAM_LIST branch

Felix Salfelder via Gnucap-devel <[email protected]> Sat, 19 Nov 2022 00:42:58 +0100
Newsgroups gmane.comp.gnu.gnucap.devel
Message-ID <[email protected]>
Hi Al.

A paramset instance, such as in

paramset myR resistor;
	parameter someR = 1 [..];
	.r(someR);
endparamset

module main()
	myR #(.someR(2)) r1(1 0); // <= here
	[..]
endmodule

needs some additional PARAM_LIST to resolve "someR".

In order to do so, COMPONENT::precalc_X needs a change,

      mutable_common()->precalc_X(scope());

should read

      mutable_common()->precalc_X(params());

and a function similar to

PARAM_LIST const* COMPONENT::params()
{
	if(common() && common()->has_params()){
	   // assert common()->params()->_try_again == scope()->params();
		return common()->params();
	}else{
		assert(scope());
		return scope()->params();
	}
}.

In particular, COMMON_COMPONENT::precalc_X needs to take a PARAM_LIST*
instead of a CARD_LIST*. I tried this in the PARAM_LIST branch, and
there seem to be no side-effects other than the interface change.

I wonder if it is better to just add a CARD_LIST* to COMMON_COMPONENT.
With that, the interface stays intact. Is there any genuine use for a
CARD_LIST in a common? It takes some extra space, but also ...  there is
a CARD_LIST* in CARD, which could move to BASE_SUBCKT, saving much more
in comparison, and even avoid the indirection.

cheers
felix