Re: [myhdl-list] essay about integer arithmetic
Brought to you by:
jandecaluwe
From: Jan D. <ja...@ja...> - 2009-03-10 14:50:21
|
Pieter wrote: >> 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; There we go :-) See? If you start from the bit-widths, nobody agrees and the result seems always wrong. I think bit widths should be such that an integer interpretation works as expected. However, calling this "automating bit-widths" is really too much honour. It's close to trivial. The trick is in the mindset. Jan -- Jan Decaluwe - Resources bvba - http://www.jandecaluwe.com Python as a hardware description language: http://www.myhdl.org |