Forum Discussion
Azay, do you really need floating point operations or you just to multiply by fractional numbers with fixed point (for example 0.800, 0.625, 0.125)? I've never used floating point operations. If you just want to multiply by fractional number you have to increase number of digits you use to represent values you're going to average. For example, number 4 represented by 5 bits is "00100". Let's multiply 4 by 0.125 which can be represented by "0.001" - 4 bits. We can perform this multiplication by conv_std_logic_vector(signed(x)*signed(y),9), were x="00100", y="0001". The result will be "000000100" - the resolution of multiplication is 9 bits = 5bits+4bits. Get rid of 1 MSB (we add just 3 bits of fractional part and we don't need 1 extra bit) and take into account that 3 lower bits are representing fractional part and you'll get "00000100" or "00000.100". This is integer number=4, but we know that it's actually 0.5.