Turn on suggestions

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

Showing results for

- Intel Community
- FPGAs and Programmable Solutions
- Intel® FPGA University Program
- How to use floating-point number in verilog code?

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

Altera_Forum

Honored Contributor I

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

07-11-2012
02:30 PM

1,959 Views

How to use floating-point number in verilog code?

Hi,

I would like to ask anyone here can please teach me how to use floating-point number in verilog code? For example, I got a formula, y=100*p^(1000/5255); if I enter p=100000, I want my y value=894 Is it possible to do that in verilog? Thanks. Best regard, TWKLink Copied

3 Replies

Altera_Forum

Honored Contributor I

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

07-16-2012
11:38 PM

150 Views

Verilog has very specific rules about how data types (bit widths, signedness, and realness) are propagated through an expression.

Verilog uses integer arithmetic by default when all operands are integers. You can covert to real arithmetic by using real constants writing: y - 100.0*p^(1000.0/5200.0);
Altera_Forum

Honored Contributor I

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

07-17-2012
12:52 PM

150 Views

Altera_Forum

Honored Contributor I

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

07-30-2012
10:48 AM

150 Views

If you are using constants you could represent them using binary form.

http://davidcastells.blogspot.com.es/2012/07/floating-point-to-fixed-point-online.htmlTopic Options

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

For more complete information about compiler optimizations, see our Optimization Notice.