$clog2(转)
(转http://www.xilinx.com/support/answers/44586.html)
13.2 Verilog $clog2 function implemented improperly
Description
The $clog2 function returns the ceiling of the logarithm to the base e (natural logarithm)rather than the ceiling of
Here is a sample Verilog code that uses the $clog2 function,
module tb;
parameter A = $clog2(325);
endmodule
When 13.2 XST synthesizes the above piece of Verilog,it generatesa value 6 for A instead of an expected value of 9,
Solution
The XST parser of ISE 13.2design tools supports Verilog-2001, therefore,customers will not be able to get a proper outputfor $clog2 function.
The Math function $clog2 was incorporated starting from Verilog-2005 (IEEE 1364-2005). Before that, clog2 could be realized as a Constant Function
in Verilog 2001. Following is a samplefunction that can be used insteadfor the $clog2 function to get a proper output:
function integer clog2;
input integer value;
begin
value = value-1;
for (clog2=0; value>0; clog2=clog2+1)
value = value>>1;
end
endfunction
The above sample Verilog code with use of this function willnow become as follows:
module tb;
parameter A = clog2(325);
function integer clog2;
input integer value;
begin
value = value-1;
for (clog2=0; value>0; clog2=clog2+1)
value = value>>1;
end
endfunction
endmodule
This issue has been fixed as part of the 14.1 XST release. Also, It is in the road map to support System Verilog, which isa superset of Verilog-2005
using Xilinx tools and would include all advanced functionsmentioned in theLRM.
随机推荐
- Unified shader model
https://en.wikipedia.org/wiki/Unified_shader_model In the field of 3D computer graphics, the Unified ...
- state介绍
state是salt最核心的功能,通过预先定制好的sls(salt state file)文件对被控主机进行状态管理,支持包括程序包(pkg).文件(file).网络配置(network).系统服务( ...
- Haskell语言学习笔记(58)Bifoldable
Bifoldable class Bifoldable p where bifold :: Monoid m => p m m -> m bifold = bifoldMap id id ...
- Haskell语言学习笔记(54)Data.Set
Data.Set Prelude> import Data.Set as Set Prelude Set> :set -XOverloadedLists Construction Prel ...
- apache commons pool
apache commons下的pool 其中的borrowObject函数源代码显示其产生可用对象的过程: 如果stack中有空闲的对象,则pop对象,激活对象(activate函数),验证对象(v ...
- scala 2.11.6 卸载 2.12.6 安装
.yum remove scala .安装scala wget -O scala-.rpm https://downloads.lightbend.com/scala/2.12.6/scala-2.1 ...
- Java工具类_表结构自动生成对应的实体类、Mapper.xml文件、Dao类
import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWrit ...
- clear(), evict(), flush()三种方法的用法实例
先贴代码: @Before public void init() { System.out.println("Test开始之前执行"); Configuration configu ...
- Minimum Cost(最小费用最大流,好题)
Minimum Cost http://poj.org/problem?id=2516 Time Limit: 4000MS Memory Limit: 65536K Total Submissi ...
- 条款1:视C++为一个语言联邦
C++是门多范式语言,至少包括面向过程,面向对象,泛型,函数式,元变成等. 但谨记,不要随意混合使用各种特性,为自己制定使用原则,针对不同项目.业务. 如: 类C风格编程:没有模板,没有异常,没有重载 ...