gpt4 book ai didi

verilog - 如何查看内存波形?

转载 作者:行者123 更新时间:2023-12-02 04:07:56 25 4
gpt4 key购买 nike

我无法使用 gtkwave 查看内存:

    module internal_memory(
output [31:0] hrdata,
input mem_enable,
input [31:0] haddr,
input [31:0] hwdata,
input hwrite,
input hreset,
input hclk
);
reg [31:0] memory [0:1023]; // <-------------- can't find its waveform
reg [31:0] internal_hrdata;

always @(posedge hclk, hreset) begin
if (!hreset) begin
internal_hrdata <= 32'h0000_0000;
end
else begin
if (mem_enable) begin
if (hwrite) begin
memory[haddr] <= hwdata;
end
else begin
internal_hrdata <= memory[haddr];
end
end
end
end

assign hrdata = internal_hrdata;

endmodule

您有什么建议可以查看内存的波形?

或者如何在 gtkwave 或任何 .vcd/waveform 查看器中显示二维数组?

最佳答案

我知道这是一个老问题,但我最近不得不在类(class)期末项目中使用 Icarus/GTKWave 查看模拟内存,并希望为阅读此问题的任何人回答这个问题。我在 Icarus Verilog 可移植性说明中找到了答案(参见源代码)。

使用 Icarus,您需要转储要显式查看的每个数组字(内存位置):

module top;
reg [7:0] array [2:0];
initial begin
$dumpvars(0, array[0], array[1]);
...
end
endmodule

您可以使用 for 循环自动转储数组中的所有单元格:

module top;
integer idx; // need integer for loop
reg [7:0] array [2:0];
initial begin
for (idx = 0; idx < 2; idx = idx + 1) $dumpvars(0, array[idx]);
...
end
endmodule

来源:http://iverilog.wikia.com/wiki/Verilog_Portability_Notes (转储数组字)

关于verilog - 如何查看内存波形?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8264350/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com