Search code examples
verilogwaveformhdl

how to view memory waveform?


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?


Solution

  • 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.