简体   繁体   English

Icarus verilog 转储内存阵列 ($dumpvars)

[英]Icarus verilog dump memory array ($dumpvars)

I try to dump an array (reg [31:0] data [31:0]) but I can't do it successfully.我尝试转储一个数组(reg [31:0] data [31:0]),但我无法成功。 I've tried the way that is in the iverilog wiki:我已经尝试过 iverilog wiki 中的方法:

integer idx;
for (idx = 0; idx < 32; idx = idx + 1)
    $dumpvars(0,cpu_tb.cpu0.cpu_dp.cpu_regs.data[idx]);

It works, but 2 things happen.它有效,但发生了两件事。

  1. A warning shows up: VCD warning: array word cpu_tb.cpu0.cpu_dp.cpu_regs.data[0] will conflict with an escaped identifier.出现警告:VCD 警告:数组字 cpu_tb.cpu0.cpu_dp.cpu_regs.data[0] 将与转义标识符冲突。
  2. In GTKWave I have something like this in SST window: \\data[0][31:0]在 GTKWave 中,我在 SST 窗口中有类似的东西:\\data[0][31:0]

Is there any solution about that?有什么解决办法吗?

Thanks in advance and sorry for my English.预先感谢并为我的英语感到抱歉。

I have e-mailed the mailing list of Icarus Verilog.我已经通过电子邮件发送了 Icarus Verilog 的邮件列表。 Here are some answers:以下是一些答案:

To dump an array word Icarus needs to escape the name so it is compatible with the VCD dump format.要转储一个数组单词,Icarus 需要对名称进行转义,以便与 VCD 转储格式兼容。 That's what \\data[0][31:0] is.这就是 \\data[0][31:0] 。 It is the zeroth 32-bit word of the data array.它是数据数组的第零个 32 位字。 Because an escaped name and an array name could now conflict Icarus produces the warning.因为转义名称和数组名称现在可能会发生冲突,因此 Icarus 会产生警告。 It would be best if it could check for an escaped identifier conflict and only print a message when there is a problem, but as I remember this was not possible.如果它可以检查转义标识符冲突并仅在出现问题时打印一条消息,那将是最好的,但我记得这是不可能的。

We chose to use escaped identifiers so that all the dumpers could handle array words.我们选择使用转义标识符,以便所有转储程序都可以处理数组字。 The other common choice is to only support them using a special dump command that only works with certain dump formats.另一个常见的选择是仅使用仅适用于某些转储格式的特殊转储命令来支持它们。

I agree it would be nice if we could make the warning more accurate, but we are usually busy working on other things so minor annoyances that appear to be complicated to fix do not often get fixed.我同意,如果我们能让警告更准确,那就太好了,但我们通常忙于处理其他事情,因此看起来很难修复的小烦恼通常不会得到修复。 As I remember, and it has been a number of years, the issue is if you search for the escaped identifier it find the array element and there is no way in the VPI to search for the next occurrence.我记得,并且已经很多年了,问题是如果您搜索转义标识符,它会找到数组元素,而 VPI 中无法搜索下一次出现。 It's possible that finding the array element in the Icarus search by name implementation is a bug.在按名称搜索 Icarus 中查找数组元素可能是一个错误。

Cary卡里


"To dump an array word Icarus needs to escape the name so it is compatible with the VCD dump format. That's what \\data[0][31:0] is. It is the zeroth? 32-bit word of the data array. Because an escaped name and an array name could now conflict Icarus produces the warning. It would be best if it could check for an escaped identifier conflict and only print a message when there is a problem, but as I remember this was not possible." “要转储一个数组字,Icarus 需要对名称进行转义,以便它与 VCD 转储格式兼容。这就是 \\data[0][31:0] 是什么。它是数据数组的第零个?32 位字。因为转义名称和数组名称现在可能会发生冲突 Icarus 会产生警告。最好是它可以检查转义标识符冲突并仅在出现问题时打印一条消息,但我记得这是不可能的。

...I don't think that there's a need to escape the names. ...我不认为有必要逃避这些名字。 Both VCS (followed by fsdb2vcd) and CVC emit the name directly with no problems. VCS(后跟 fsdb2vcd)和 CVC 都直接发出名称,没有问题。 Cut and paste example shown below:剪切和粘贴示例如下所示:

$var wire 5 `' IC_DrAd0 [3][4:0] $end $var wire 5 a' IC_DrAd0 [2][4:0] $end $var wire 5 b' IC_DrAd0 [1][4:0] $end $var wire 5 c' IC_DrAd0 [0][4:0] $end $var wire 5 `' IC_DrAd0 [3][4:0] $end $var wire 5 a' IC_DrAd0 [2][4:0] $end $var wire 5 b' IC_DrAd0 [1][4:0] $结束 $var 线 5 c' IC_DrAd0 [0][4:0] $end

I realize the VCD spec doesn't define this, but I've had to fold in a lot of these kinds of extensions into gtkwave over the years as other tools generate these constructs.我意识到 VCD 规范并没有定义这一点,但多年来我不得不将许多此类扩展折叠到 gtkwave 中,因为其他工具会生成这些结构。 The escapes can cause save file incompatibilities (missing signals) when trying to simulate on iverilog versus VCS.尝试在 iverilog 与 VCS 上进行模拟时,转义可能会导致保存文件不兼容(丢失信号)。

Over time, SV constructs likely will cause further things added to the VCD files.随着时间的推移,SV 构造可能会导致更多内容添加到 VCD 文件中。 AFAIK, the VCD part of the 1364 spec hasn't updated at all since Verilog-XL. AFAIK,自 Verilog-XL 以来,1364 规范的 VCD 部分根本没有更新。 CVC gets around possible incompatibilities by adding a +dump_arrays plusarg (and no, you don't have to loop on each array element either). CVC 通过添加 +dump_arrays plusarg 来解决可能的不兼容问题(不,您也不必在每个数组元素上循环)。

-Tony -托尼

I also sent a mail to GTKWave creator Tony Bybell:我还给 GTKWave 的创造者 Tony Bybell 发了一封邮件:

Hello,你好,

The problem is that the compiler is not emitting those values into the dump file.问题是编译器没有将这些值发送到转储文件中。 You'll have to get in contact with the iverilog developers.您必须与 iverilog 开发人员取得联系。 I see the same problem if I run sim and compare against another simulator such as CVC with +dump_arrays turned on which does dump the arrays and they are visible in gtkwave.如果我运行 sim 并与另一个模拟器(例如 CVC 并打开 +dump_arrays 进行比较,它会转储数组并且它们在 gtkwave 中可见),我会看到同样的问题。

http://iverilog.wikia.com/wiki/Release_Notes_Icarus_Verilog_0_9_2 | http://iverilog.wikia.com/wiki/Release_Notes_Icarus_Verilog_0_9_2 | Allow $dumpvars to accept array members for dumping,允许 $dumpvars 接受数组成员进行转储,

...it looks like during "initial" time you might need to add a $dumpvars statement for each array element you want dumped. ...看起来在“初始”期间,您可能需要为要转储的每个数组元素添加 $dumpvars 语句。 I don't know if the array name by itself works.我不知道数组名称本身是否有效。 Assigning each element to a "wire" might work too.将每个元素分配给“电线”也可能有效。

I have never tried this functionality in iverilog so I don't know if it works.我从来没有在 iverilog 中尝试过这个功能,所以我不知道它是否有效。 You might have to experiment or ask the developers.您可能需要进行试验或询问开发人员。

-Tony -托尼

I had a similar issue recently:我最近遇到了类似的问题:

When dumping vars with the for cycle like the question, this vcd error happens:当像问题一样使用 for 循环转储 vars 时,会发生此 vcd 错误:

ERROR: $dumpvars cannot dump a vpiConstant.

My workaround is to generate n wires with assign statement assigning it the respective array word like this:我的解决方法是使用assign语句生成n条连线,为它分配相应的数组字,如下所示:

reg     [31:0]  registers [31:0];
generate
  genvar idx;
  for(idx = 0; idx < 32; idx = idx+1) begin: register
    wire [31:0] tmp;
    assign tmp = registers[idx];
  end
endgenerate

Now in GTKWave I have the generate blocks dumped correctly.现在在 GTKWave 中,我正确地转储了生成块。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM