arrays - 访问 Verilog 代码中的 2d 寄存器数组以在 leonardo 工具中合成时出现语法错误
问题描述
我用 ISE 工具中的 verilog 代码制作了一个简单的缓存,并使用了一个 2d 寄存器数组作为我的缓存,在 Modelsim 中模拟测试平台做得很好,没有语法错误,也没有错误的输出信号,但是当我在 Leonardo 工具中告诉莱昂纳多在库 ams600nm 中读取它,它在我访问我的二维数组(缓存)的第一行附近返回语法错误,你知道吗?
代码:
module Cache(clk , wr
,din,adr,dout
);
input clk;
input wr;
input [3:0] din;
input [3:0] adr;
output [3:0] dout;
output hit;
reg [8:0] cache [3:0];
reg h;
reg [3:0] out;
initial
begin
***cache[0][8] = 1'b0; -----here-----
cache[1][8] = 1'b0; -----also here for sure-----
cache[2][8] = 1'b0;
cache[3][8] = 1'b0;***
end
解决方案
hit
您在模块端口列表中没有输出。- 你没有
endmodule
关键字。 - 一些软件只允许访问数组行中的所有位。我无权访问您的软件,因此无法对其进行测试,但您应该尝试以下方法:
temp = cache[0];
cache[0] = {1'b 0, temp[7:0]};
这相当于:
cache[0][8] = 1'b0;
temp
应声明为reg [8:0] temp;
(与 相同的宽度cache
)。
推荐阅读
- opencv - libdl和librt引起的OPENCV交叉编译链接错误
- javascript - 根据经过的秒数关闭超时
- php - 通过 php (Google Places API) 从多维数组中获取值
- python - AES 密钥,解密器 = AES.new(HEADER_KEY, AES.MODE_CBC, 16 * '\x00')
- flutter - Flutter Complex Parsing Json Undefined getter "List
' - amazon-web-services - 无法将弹性 IP 重新分配给 EC2 扩展组
- fabricjs - 如何在自由绘图中重复路径?
- sql-server - “服务器”在嵌入式服务器 dbms 中的作用是什么?- 在寻找合适的 rdbms 时出现的许多与“服务器”相关的术语感到困惑
- python-3.x - 如何使用 for 循环将键和值对添加到新的空字典?
- flutter - 在没有互联网的情况下连接两部智能手机 (Flutter)