Re: [myhdl-list] AttributeError in 0.8-dev but not in 0.7
Brought to you by:
jandecaluwe
From: Per K. <bas...@gm...> - 2013-01-24 14:40:16
|
Yes, I think you're right! It is mixing intbv[1:0] and bool that causes it. If that is to be forbidden, there needs to be an assert as soon as possible. But I don't see why we should disallow it. The reason I didn't see it sooner was that the bool and the intbv were instantiated in separate modules. And unless we ban one-bit intbvs or bools outright I don't see how that sort of thing can be avoided. One hardware designer's bool is another's one bit integer. :) /Per On Thu, Jan 24, 2013 at 3:08 PM, Christopher Felton <chr...@gm...>wrote: > On 1/24/2013 7:41 AM, Per Karlsson wrote: > > The problem is that val is an intbv (that is checked) but next is a bool > > (and next is never checked). So next has no ._val > > I don't think the problem can be reproduced using mere assignments. It > is, > > I think, the mixed types in the conditionals that cause the error. > > I'll make another try at reproducing it 'in vitro' once I get the time. > > /Per > > > > On Thu, Jan 24, 2013 at 1:15 PM, Christopher Felton > > <chr...@gm...>wrote: > > > >> The /self._val._val = next._val/ is correct, it says > >> assign the /Signal.intbv._val/, the _val of the signal > >> is an intbv (per the check right before). > >> > > > > Hmmm, I don't think a conditional will cause the the > myhdl.simulator to invoke the /update/ functions. > > Looking at the code, I could see the attribute hazard in > the /_update()/ function if: > > _val : type == intbv > _next : type == bool > > But for the above to occur the /Signal._SetNextVal/ would > need to be assigned to /Signal._SetNextBool/. Now, for that > to occur the /Signal/ would need to be instantiated with a > /bool/ ... > > Do you see the error now? You need a complex set of > events. You need to create a /Signal/ of type /bool/ > then assign it to and /intbv/ and then assign it to a > /bool/ again. If your code inter-mixes /bool/ and > /intbv[1:]/ a bunch there is this potential to hit this. > > code snip: > > x = Signal(bool(0)) > x.next = intbv(1)[1:] > print(type(x._val), type(x._next)) > x._update() > print(type(x._val), type(x._next)) > x.next = False > print(type(x._val), type(x._next)) > x._update() > > > The above will cause the error you are seeing. > > Now the question is, does the design intend for /bool/ > and /intbv[1:]/ interchanged. If it does then this needs > to be fixed, if it doesn't then we need to add an assert > that prevents the first /intbv/ assignment to the bool. > > Regards, > Chris Felton > > > > > ------------------------------------------------------------------------------ > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft > MVPs and experts. ON SALE this month only -- learn more at: > http://p.sf.net/sfu/learnnow-d2d > _______________________________________________ > myhdl-list mailing list > myh...@li... > https://lists.sourceforge.net/lists/listinfo/myhdl-list > |