Forum Discussion
Altera_Forum
Honored Contributor
14 years agoYour two number example is no good for demonstration.
Because I can scale up by 10 into 15 * 27 and you get 405 (needs 9 bits) then divide by 100 and you get 4. As such it is restricted and needed division. I can also say scale up by 16 instead of 10 and you get 24 * 43 = 1032 (needs 11 bits) then discard 8 bits and you get 4 without the need for division. The regular method used by classic HDL designers is this: You look at your input possible range and scale it up rounding to nearest integer. 8 bits can represent integers from 0 ~ 255 unsigned or -128 ~ +127 signed and the result can be either 16 bits or if you like less e.g. 8 MSBs implying division by 2^8. Once you get the result then you interpret it as required. Software designers on the other hand cannot deal with wires and so think of imagiary decimal point to make their life easy and ours hard.