# HELP...fixed-point multiply using VHDL

1. ## fixed point multiply

Hi, pals,

I'm a green hand in VHDL and doing a very simple FFT. The first problem I encouter is how to program a 16 bits fixed point multiplier with 8 bits fraction. I don't want to use any multiplier module even they can save a huge number of logic gates. I just want to use "*" to do the multiplication.

But since the data type is fix point with fraction, I suppose the result have to be shifted after calculation by "*". But I am not sure about that and don't know how start this program.

Thanks a lot.

•

2. ## vhdl multiply

First, if you are intending to use a fractional fixed notation like xxx.xxx, then you can perform multiplication by shifting each operand to the left by 8 and consider them as integers .Then, you can perform integer multiplication which can be performed by "*" .After finishing the multiplication, you must shift the result by 16 because you shifted each operand by 8 .If you only need 8 bits after the point, you can simply discard the rest of bits .
You can also use the IEEE floating point notation i.e you can represent the number as a sign ,exponent and magnitude .You simply multiply the magnitudes together and add the exponents .Note that this formats considers the number as 1.xxxeyyy i.e after magnitude multiplication, you may need to perform shifting till you achieve only 1 before the point ,and add the number of shifts to the exponent .
If your numbers' range is small I'd recommend the fixed point notation, but if you're expecting your system to handle large values of numbers, then you should consider the floating point notation .

2 members found this post helpful.

3. ## vhdl x001

Thanks a lot. That's a really smart way to shift and treat it like integer.

•

4. ## vhdl fixed point multiplication

I have tried this, but it's not working with me,

i have inputs X, Y bit_vector( 9 downto 0), i'm having 7 decimal places

mulRes <= bit_vector((signed(X) * signed(Y))); -- mulRes bit_vector(19 downto 0)
res <= mulRes(16 downto 7);

X = 001 1010000 "1.5"
Y = 010 0000000 "2.0"

mulRes = 00001101000000000000
res = 0110100000 which is not 3 :(

Have i understood something in a wrong way ??

5. ## how to multiply integers in vhdl

Yes, you apparently misunderstood the concept of fractional numbers.
This is the correct fractional representation for sfixed(2 downto -7) format
Code:
`X = 001 1000000 "1.5"`
Your example represents a different value
Code:
`X = 001 1010000 "1.625"`
Generally, you have to multiply your input number (e.g. 1.5) with a power of two to get the integer representing the fractional number.

6. ## vhdl multiply by fraction

YESSSSSSS, that's great,
sorry i thought in a wrong way,
It's working perfectlyyy,
Thank you so much :)

•

7. ## HELP...fixed-point multiply using VHDL

Read tutoRial seRies on fixed point vhdl package heRe..
http://vhdlguru.blogspot.com/2010/03...-tutorial.html

--[[ ]]--