[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnucap-devel] problem with clone_instance
From: |
Felix Salfelder |
Subject: |
Re: [Gnucap-devel] problem with clone_instance |
Date: |
Mon, 18 Nov 2013 12:36:23 +0100 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
On Sun, Nov 17, 2013 at 02:33:43PM -0500, al davis wrote:
> Immediately, my suggestion followed in that same email.
i didn't get it, and i still fail to see the connection to "pulse".
the example in d_logic looks more instructive.
> An assert in the code is documentation of some condition that is
> assumed to be true. An assert fail is not a bug in itself, but
> rather a hint at where the bug really is.o
i'm now considerably successful with something like
/*--------------------------------------------------------------------------*/
class NOTHING : public COMPONENT { //
public:
NOTHING():COMPONENT(){ }
CARD* clone() const { return new(NOTHING);}
private:
std::string value_name()const { return "error";}
int max_nodes()const {return 0;}
std::string dev_type()const {return "error";}
std::string port_name(int)const {untested(); return "error";}
bool print_type_in_spice()const {return 0;}
};
/*--------------------------------------------------------------------------*/
static NOTHING p0;
static MODEL_SEMI_RESISTOR p1(&p0); // <= fix the corresponding constructors
static MODEL_SEMI_CAPACITOR p2(&p0); // <= fix the corresponding constructors
static DISPATCHER<MODEL_CARD>::INSTALL
d1(&model_dispatcher, "r|res", &p1),
d2(&model_dispatcher, "c|cap", &p2);
/*--------------------------------------------------------------------------*/
in bmm_semi.cc. but it segfaults because of what i consider a bug in
COMPONENT::set_port_by_index(..). the comparison "num <= max_nodes()" seems to
be off by one.
try
gnucap>verilog
gnucap-verilog>resistor r(1,2);
gnucap-verilog>resistor r(1,2,3);
gnucap-verilog>resistor r(1,2,3,4);
resistor r(1,2,3,4);
^ ? too many: requested=3 max=2
it should read "num < max_nodes()" in COMPONENT::set_port_*, no?
and, while i'm at it. in e_compon.h i found
[..]
public: // obsolete -- do not use in new code
virtual bool print_type_in_spice()const = 0;
[..]
which should read
virtual bool print_type_in_spice()const{return some_default;},
if that member is really obsolete.
regards
felix