问题描述
我正在尝试使用 $readmemh
读取内存文件,但我不确定正确的文件格式是什么,因为我看到了警告.
I'm trying to read a memory file using $readmemh
, but I'm not sure what the correct file format is since I'm seeing a warning.
在我的测试平台中,我有以下内容:
In my testbench, I have the following:
reg [7:0] progmem [4095:0];
initial begin
$readmemh("progmem.txt", progmem);
end
并且 progmem.txt
包含:
01
03
ff
00
以此类推,总共 4096 行.运行测试平台时,vvp
显示:
and so on for a total of 4096 rows. When running the testbench, vvp
displays:
$readmemh: Standard inconsistency, following 1364-2005
我曾尝试查找此内容,但我还没有找到有关其实际含义的解释.
I have tried looking this up, but I haven't found an explanation as to what that actually means.
推荐答案
不同版本的 IEEE Std 1364 指定了如何通过 $readmemh
不同地加载内存.
Different versions of the IEEE Std 1364 specify how memories are loaded via $readmemh
differently.
1364-1995 状态:
1364-1995 states:
...默认起始地址是左手地址内存声明.连续的单词被加载,直到内存已满...
1364-2001 状态:
1364-2001 states:
...默认起始地址应为最低地址记忆.应加载连续的单词,直到最高的到达内存中的地址...
在您的声明中,左侧地址为 4095,但最低地址为 0.
In your declaration, the left-hand address is 4095, but the lowest address is 0.
不是将第一个单词 (01) 加载到 progmem[4095]
,我相信警告是在告诉您它正在将第一个单词加载到 progmem[0]
>.
Instead of loading the 1st word (01) into progmem[4095]
, I believe the warning is telling you that it is loading the 1st word into progmem[0]
.
当我将声明更改为以下内容时,edaplayground 上的 iverilog
警告消失了:
When I change the declaration to the following, the warning disappears for me on iverilog
on edaplayground:
reg [7:0] progmem [0:4095];
这篇关于Icarus Verilog 警告 $readmemh:标准不一致,遵循 1364-2005的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!