Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using float signal in VHDL

Status
Not open for further replies.

dsimon19

Technical User
Jun 2, 2008
5
0
0
FR
Hi,

I have to implement mathématical function in VHDL. That function was previously done in C and uses floating point as input and output. I wonder how to simply deal with floating point in VHDL. It does not seem to be a predefined type from VHDL packages and I see 2 ways of doing it:
- Define my own type and use it as a normal type like integer or signed inside langage but I guess I also need to create my own function for mathematical operation (+, -, *, /)
- Instantiate floating point unit IP, but in that case I become target dependant (in case using core generator from Xilinx).

If you got any clue doing it simply it would help me.

Thanks.
 
dsimon19,

VHDL and floats.

A couple of questions you need to ask yourself first:

synthesis or simulation?
Do I really need floating pointor can I live with fixed point?

Some explanation:

VHDL supports floats for none synthesis.

When you want to synthesize the trouble starts.

Writing c <= a / b for synthesis will get you errors.

You are in fact correct to say that you need to make you're own "library" or whatever.

The thing is you need to implemnt these * / + - for float you self.

So you need to write you're own kind of ALU for floating point.

This means dig up the processor architecture books and floating point fundamentals.

It's not something you want to start with for fun, I'm sure professional code developpers would charge you a nice amount to use their cores.

So if you want to implement a floating point algoritm as a microcontroller extension for example try searching one that support floats. It will save you a lot of trouble.

Xilinx for example provide a floating point ALU core for the PPC in their Virtex devices (V4 FX V5 FX).

I still remember them saying yes the PPC now has a interesting interface method to interface to for exmaple your own floating point ALU extension.

I' haven't met a single guy who wrote this between to other jobs in.

So my best advise is:

Try to find another solution or else keep your agenda free for the rest of the year.

regards,

Jeandelfrigo
 
Jeandelfrigo,
Thanks very much for your advice. Yes I need to get on a chip later so I have to write synthetisable code. Briefly, I have to carry software function in VHDL to gain speed. Part of this function are using mathematical stuff like trigonometric function, and other operations on floating points.
I have understood the concept now. I will use floating point unit IP in a structural architecture.

Thanks for your help.

Regards.

dsimon19
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top