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
- :
- How to use pow function in HLS with C?

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

smileworker2012

Visitor

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

12-19-2013 07:09 PM

3,621 Views

Registered:
06-05-2013

Hello,

I dad write "#include <math.h>" in my code. However there's still the error " math function 'pow' is not supported for synthesis".Which C library shoud I choose or whice function shoude I use to get number's power?

I tried to write the pow function myself to get the power of 2 ,codes like:

int power_func(int n)

{

int power=1,k;

for(k=0;k<=n-1;k++)

{

power=power*2;

}

return power;

}

The trip count and lentancy both are "?". Maybe because n is an variable.

What can I do for the power?

Thanks a lot!

1 Solution

Accepted Solutions

muzaffer

Teacher

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

12-19-2013 07:19 PM

4,453 Views

Registered:
03-31-2012

By definition pow(x,y) = exp(y*log(x)).

Both exp and log are available for synthesis.

- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.

Give Kudos to a post which you think is helpful and reply oriented.

2 Replies

muzaffer

Teacher

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

12-19-2013 07:19 PM

4,454 Views

Registered:
03-31-2012

By definition pow(x,y) = exp(y*log(x)).

Both exp and log are available for synthesis.

- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.

Give Kudos to a post which you think is helpful and reply oriented.

smileworker2012

Visitor

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

12-19-2013 09:50 PM

3,607 Views

Registered:
06-05-2013

Thank you!