Re: [myhdl-list] essay about integer arithmetic
Brought to you by:
jandecaluwe
From: Pieter <pie...@gm...> - 2009-03-06 13:36:17
|
> If you want to multiply 8bit x 8bit and result in 16bit, what you do in > convert both operands to 16bit first. Hmm, for me it seems more logical that you should have 16 bits at the left hand side of the assignment, to get a 16 bit result? result_16 = op_a_8 * op_b_8; 2009/3/6 Neal Becker <ndb...@gm...>: > 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. > > > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA > -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise > -Strategies to boost innovation and cut costs with open source participation > -Receive a $600 discount off the registration fee with the source code: SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > myhdl-list mailing list > myh...@li... > https://lists.sourceforge.net/lists/listinfo/myhdl-list > -- Pieter Cogghe Iepenstraat 43 9000 Gent 0487 10 14 21 |