Re: [myhdl-list] fixed_point library and VHDL generation
Brought to you by:
jandecaluwe
From: Christopher F. <chr...@gm...> - 2010-01-18 15:34:27
|
On 1/12/10 3:30 PM, Christopher Felton wrote: > Jan L. > > a = Signal(fxintbv(0,Q=(0,16)) > b = Signal(fxintbv(0,Q=(0,16)) > > i = 2 > > @always(clk.posedge) > def beh(): > if b < 0: > d = 1 > else: > d = -1 > a.next = a - ((d*b) >> i) > > The way I made that code working correctly is just casting a to int: > a.next = a*1 - ((d*b) >> i) > > > The actual problem is that I relied on the lower level intbv to handle > the logical and shift operators. The lower level intbv operators simply > return an 'int' type. I need to add the operator overloads (all of > them) to the fxintbv and have them return fxintbv type. They you will > not get the error. I will try to have the 0.4 release ASAP to fix this. I have fixed these issues and put a new release on http://www.myhdl.org/doku.php/users:cfelton:projects:fxintbv I explain the issue incorrectly previously. The math operators (add, sub, mul) were returning an int value the same as the underlying intbv (not the shift op). That in turn would break the point alignment checking. There should be more examples included in this release. .chris |