**UPGRADE YOUR BROWSER**

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

Turn on suggestions

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

Showing results for

- Community Forums
- :
- Forums
- :
- Hardware Development
- :
- Other FPGA Architecture
- :
- How to implement log10 (x) in verilog in Vivado?

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

shruthi_07

Observer

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

06-08-2016 12:50 PM

7,681 Views

Registered:
09-30-2015

1 Solution

Accepted Solutions

LawsonSSEC

Visitor

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

06-08-2016 02:51 PM

13,182 Views

Registered:
06-03-2016

Sorry I don't have FPGA code handy, but I have implemented a fixed point integer logarithm on small microprocessors. I used a successive approximation algorithm similar to CORDIC. http://www.quinapalus.com/efunc.html <= is where I found the basic algorithm. In my case, I built a Log2() function covering an input range of 1 to 2 with a prescaling loop to find the integer portion of the answer. Then I used the change of base formula to convert any logarithm to Log2(). example: 10*log10(x) = 10/log2(10)*log2(x). Gave about 1-bit per loop and I would expect a state machine implementing it to be pretty simple.

Also found this quick discussion that links to a few other algorithms in current use for calculating logarithms. What algorithm is used by computers to calculate logarithms?

Marty

3 Replies

bwiec

Xilinx Employee

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

06-08-2016 02:20 PM

7,664 Views

Registered:
08-02-2011

Re: How to implement log10 (x) in verilog in Vivado?

A lookup table is common for this, depending on your requirements.

www.xilinx.com

LawsonSSEC

Visitor

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

06-08-2016 02:51 PM

13,183 Views

Registered:
06-03-2016

Sorry I don't have FPGA code handy, but I have implemented a fixed point integer logarithm on small microprocessors. I used a successive approximation algorithm similar to CORDIC. http://www.quinapalus.com/efunc.html <= is where I found the basic algorithm. In my case, I built a Log2() function covering an input range of 1 to 2 with a prescaling loop to find the integer portion of the answer. Then I used the change of base formula to convert any logarithm to Log2(). example: 10*log10(x) = 10/log2(10)*log2(x). Gave about 1-bit per loop and I would expect a state machine implementing it to be pretty simple.

Also found this quick discussion that links to a few other algorithms in current use for calculating logarithms. What algorithm is used by computers to calculate logarithms?

Marty

ctpoomagal

Newbie

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

06-11-2018 12:45 AM

2,341 Views

Registered:
06-11-2018

Re: How to implement log10 (x) in verilog in Vivado?

How the lookup table method is used to implement log10 (x) in verilog. Please give me some example?