Forum Discussion
Altera_Forum
Honored Contributor
15 years agoFixed point math functions
Hello, I know that fixed point logic circuits are similar to integers. But my question is. Say I convert a 15bit integer (A) to fixed point <15bits.10bits> by just using {A[14:0],10'b...
Altera_Forum
Honored Contributor
15 years agoThe notion of fractional fixed point is an extra complexity added recently by software mindset and their tools and imposed on fpga designers.
In fpga mindset you can use integer concept without any problem. fractional approach is just another mental perspective of location of an imaginary decimal point. If you add or subtract n bits to m bits then you need one more bit (carry) for the result. if you multiply signed n bits by signed m bits then you need n+m bits for result but can safely use n+m-1 bits if you saturate the only case of overflow when both n and m are at maximum negative (or ignore satuaration if you don't expect this extreme) As an example of decimal point meaning, imagine you are asked to multiply your input by anything between 0 ~ 1 then you can choose 9 bit factor (0 ~ 256) then truncate 8 bits of result of multiplication thus you get (0 ~ 256)/256 i.e. 0 ~ 1 in fractions of 1/256 steps. Thus you can say the 9 bits value has decimal point between bit(8) and bit(7) of the range bit(8) ~ bit(0)