如何查看内存波形?

发布于 2024-12-17 19:33:29 字数 1018 浏览 2 评论 0 原文

我无法使用 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/波形查看器中显示二维数组?

I can't view memory using 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

What can you suggest to view the waveform of memory?

Or how to display two-dimensional array in gtkwave or in any .vcd/waveform viewer?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

残月升风 2024-12-24 19:33:29

我知道这是一个老问题,但最近我不得不在课程期末项目中使用 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(转储数组字)

I know this is an old question, but I recently had to view a simulated memory with Icarus/GTKWave for a course final project and wanted to answer this for anyone reading this question. I was able to find the answer on the Icarus Verilog Portability notes (see source).

With Icarus, you need to dump each array word (memory location) you want to look at explicitly:

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

You can automate dumping all of the cells in an array with a for loop:

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

Source: http://iverilog.wikia.com/wiki/Verilog_Portability_Notes (Dumping array words)

海螺姑娘 2024-12-24 19:33:29

您需要先将内存转储到VCD文件中。我熟悉的 2 个模拟器需要额外的模拟选项才能将内存转储到 VCD 中;也许你的也是如此。

You need to first dump the memory into the VCD file. The 2 simulators I am familiar with require extra simulation options for dumping memories into the VCD; perhaps yours does too.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文