Re: [myhdl-list] essay about integer arithmetic
Brought to you by:
jandecaluwe
From: Neal B. <ndb...@gm...> - 2009-03-06 13:22:23
|
Michael Baxter wrote: > IMHO, though informed with years of hardware implementation experience, > automating bit-widths should be 100% a non-goal. It should never be done > under any circumstances whatsoever. > > IMHO, this is a serious failing of MyHDL. > Actually, I agree. That's why I wrote about my c++ approach to fixed-pt integers. There, the approach is: For unary op, the output size is same as input For binary op, the 2nd operand is converted to the first, then the output size is same as input (Actually, fixed-pt has 2 attributes: a number of integer bits and a number of frac bits, or equivalently a size and a binary point) If you want to multiply 8bit x 8bit and result in 16bit, what you do in convert both operands to 16bit first. The reason is, I really don't think it's possible to have a machine correctly deal with these issues in all cases. Perhaps more important, though, is the question of even if it is possible for some kind of algorithm to decide the bit widths, is this really desirable? I'm not sure about that. Maybe the designer really should be aware of these details. |