gnucap-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnucap-devel] parameter scopes for subckt instances


From: Felix Salfelder
Subject: [Gnucap-devel] parameter scopes for subckt instances
Date: Thu, 18 Oct 2012 09:52:51 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]