problem with clone_instance

Felix Salfelder <[email protected]>
Newsgroups gmane.comp.gnu.gnucap.devel
Message-ID <[email protected]>
Hi Al.

bmm_semi.cc defines two MODEL_CARDs with no _device_proto. this is a
problem in

verilog
res X(1,2);.

res is a model, which is found by find_proto and LANGUAGE::new__instance
unuspectingly calls clone_instance. here assert(_device_proto) fails.

there ara multple ways to fix it. my favourite is something like this.

CARD* MODEL_CARD::clone_instance() const
{
  if (_component_proto) {
    return _component_proto->clone();
  } else if( const CARD* c = device_dispatcher[dev_type()] ) {
    return c->clone();
  } else { unreachable();
    throw Exception("cannot instanciate");
  }
}

(make sure dev_type is "resistor" and "capacitor" accordingly in
bmm_semi.cc. the dispatcher wont find "r" or "c" in case sensitive
mode.)

regards
felix
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.