Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

- Community Forums
- :
- Forums
- :
- About Our Community
- :
- General Technical Discussion
- :
- Implementing fixed point arithmetic in VHDL

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

maharjanmilan

Participant

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

09-19-2009 02:45 PM

16,221 Views

Registered:
07-11-2009

Implementing fixed point arithmetic in VHDL

Hi, I'm trying to implement a fixed point multiplication in VHDL targeting Xilinx V2Pro board using xilinx ISE 10.1. Can anyone suggest me how I can do it? I got two variables a and b, where for example a=3.24 and b=-1.6. How can I represent these numbers in fixed point and how can i get them multiplied?

Milan

3 Replies

eilert

Teacher

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

09-21-2009 07:02 AM

16,204 Views

Registered:
08-14-2007

Hi Milan,

if you don't even know how fixed point numbers are calculated from floating point numbers you should join a class for digital basics first.

Have a nice synthesis

Eilert

maharjanmilan

Participant

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

09-21-2009 04:18 PM

16,192 Views

Registered:
07-11-2009

Hi Eilert !

My question is about implementing the fixed point multipication in VHDL. I'm sorry if I gave u an impression that i don't know how to calculate the fixed point from floating. Now, back to my question, how can I implement it in VHDL with Xilinx for V2pro board?

eilert

Teacher

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

09-21-2009 11:20 PM

16,178 Views

Registered:
08-14-2007

Hi Milan,

well, you really gave that impression. Sorry.

About your question:

Fixed point arithmetic works just like ordinary binary arithmetic. It's the same hardware.

You only have to care where your fixed point is after the calculation.

eg:

you want to multiply 1110.1101 (14.8125) by 0011.0100 (3.25)

so your result will be :

00110000.00100100 (48.140625)

So when you have 4 decimal places in each operand, the result has 8 decimal places.

If you want your result to have the same accuracy as your inputs you can drop some decimal places by truncation or rounding.

You have to keep your integer bits.

Or you can do scaling. That is, you use the 8 MSBs and drop the rest. You treat these 8 bits still as a fixed point number, but for your calculation you keep in mind that it is actualy divided by 16 (and the lower 8 bit truncatet).

So the only thing you have to worry about is your numerical range and the interpretation of your result.

The hardware elements are unchanged.

Have a nice synthesis

Eilert