Re: [myhdl-list] Proposal: SignalType symbol
Brought to you by:
jandecaluwe
From: Jan D. <ja...@ja...> - 2010-06-09 22:25:23
|
Tom Dillon wrote: > Jan, > > OK, I think I get it now. > > Your factory function Signal() must return the correct class object > based upon the parameters passed to it. > > So Signal is just a function now that returns a class object so there is > no such thing as an instance of it. Right. For completeness, there is still the guarantee that any returned object will be of type SignalType (so that the corresponding isinstance check will always be true), but the specific subtype depends on the parameters. > That is confusing, especially when you assume that Signal was a class. > > I would say the SignalType solution is good. > > Just out of curiosity, how do you define that SignalType symbol. The appropriate class exists (myhdl._Signal._Signal), so it is just a matter of making it user-visible. In the myhdl._Signal module I add, after the _Signal definition: SignalType = _Signal and then I export it just like the other visible symbols, in myhdl.__init__. Jan -- Jan Decaluwe - Resources bvba - http://www.jandecaluwe.com Python as a HDL: http://www.myhdl.org VHDL development, the modern way: http://www.sigasi.com Analog design automation: http://www.mephisto-da.com World-class digital design: http://www.easics.com |