如何在verilog中初始化参数数组? [英] How to initialize parameter array in verilog?

查看:4904
本文介绍了如何在verilog中初始化参数数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Verilog中初始化参数类型数组,其中每个成员都是32位十六进制符号数?
我尝试了以下方法,但它给了我语法错误。

 参数[31:0] k [0: 63] = {32'habc132,32'hba324f,...}; 

我正在使用最新版本的iverilog进行编译。

解决方案

EDA Plyground 下面的示例使用modelsim 10.1时,该文件具有.sv扩展名,导致它被解释为SystemVerilog:

  module test; 
参数[31:0] k [0:1] = {32'habc132,32'hba324f};

初始开始
$ displayh(k [0]);
$ displayh(k [1]);
end
endmodule

如果设置为SystemVerilog不起作用或不可用对于你的模拟器,我建议在问题中包括语法错误。


How can one initialize parameter type array in verilog where each of members are 32 bit hexadecimal notation numbers? I have tried the following but it gives me syntax error.

parameter [31:0] k[0:63] = {32'habc132, 32'hba324f, ...};

I'm using latest version of iverilog for compiling.

解决方案

On EDA Plyground The following example works using modelsim 10.1, the file has a .sv extension, causing it to be interpreted as SystemVerilog:

module test;
parameter [31:0] k [0:1] = {32'habc132, 32'hba324f};

  initial begin
    $displayh(k[0]);
    $displayh(k[1]);
  end
endmodule

If setting to SystemVerilog does not work or is not available for your simulator I suggest including the syntax error in the question.

这篇关于如何在verilog中初始化参数数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆