赛灵思
直播中

李思路

8年用户 173经验值
私信 关注
[问答]

如何在C中使用HLS中的pow功能?

你好,
我爸爸在我的代码中写了“#include”。
然而,仍然存在错误“数学函数'pow'不支持合成”。我选择哪个C库或者我用什么功能来获得数字的功率?
我试着自己编写pow函数以获得2的幂,代码如下:  
int power_func(int n){int power = 1,k;

为(K = 0; k 以下为原文

Hello,
      I dad write "#include " 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!

回帖(3)

陈苏文

2019-3-5 11:12:49
做一些代数:根据定义pow(x,y)= exp(y * log(x))。
exp和log都可用于综合。
- 如果提供的信息有用,请将答案标记为“接受为解决方案”。给予您认为有用且回复的帖子。
在原帖中查看解决方案

以上来自于谷歌翻译


以下为原文

Do some algebra:
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.View solution in original post
举报

陈苏文

2019-3-5 11:22:14
做一些代数:根据定义pow(x,y)= exp(y * log(x))。
exp和log都可用于综合。
- 如果提供的信息有用,请将答案标记为“接受为解决方案”。给予您认为有用且回复的帖子。

以上来自于谷歌翻译


以下为原文

Do some algebra:
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.
举报

h1654155275.5998

2019-3-5 11:28:26
谢谢!

以上来自于谷歌翻译


以下为原文

Thank you!
举报

更多回帖

发帖
×
20
完善资料,
赚取积分