×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Using float signal in VHDL

## Using float signal in VHDL

(OP)
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.
Replies continue below

### RE: Using float signal in VHDL

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.

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

regards,

Jeandelfrigo

### RE: Using float signal in VHDL

(OP)
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.

Regards.

dsimon19

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!