0

CompSci クラスの Verilog モジュールを作成していますが、このモジュールは具体的にはデータ メモリ モジュールです。構造的および分析的に、私はそれを調べており、私が持っている他のファイルに基づいて機能するはずですが、なぜこれが具体的に機能してすべての x を与えているのかわかりません. 新鮮な目で見落としたエラーを見つけてくれることを願っています。前もって感謝します。

datamem.v:

module datamem(Ina, Inb, enable, readwrite, dataOut, clk, rst);

input wire [31:0] Ina;
input wire [31:0] Inb;
input wire enable;
input wire readwrite;
input wire clk;
input wire rst;

reg [31:0] memory[0:65535];
output reg [31:0] dataOut;

always @(memory[Ina]) begin
        dataOut = memory[Ina];
    end

always @(posedge clk) begin
    if(1'b1 == readwrite) begin
        memory[Ina] = Inb;
    end
end

endmodule

datamem_tb.v:

module datamem_tb();

reg [31:0] Ina;
reg [31:0] Inb;
reg enable;
reg readwrite;
reg clk;
reg rst;

wire [31:0] dataOut;

datamem DUT (Ina, Inb, enable, readwrite, dataOut, clk, rst);

initial
begin

    Ina <= 32'd0;
    Inb <= 32'd0;
    enable <= 0;
    readwrite <= 0;

    #20 Ina <= 32'd1234;
    #20 Inb <= 32'd1234;
    #20 Ina <= 32'd0517;
    #20 Inb <= 32'd10259;

end

always @(Ina or Inb)
    #1 $display("| Ina = %d | Inb = %d | dataOut = %d |", Ina, Inb, dataOut);

endmodule
4

1 に答える 1