//************************************************************* // This is the data memory for the x370 processor // There are 256 locations of 16-bits each. // This memory is initialized from a file which is given as // a parameter. You can change this parameter by right-clicking // the iram component in the schematic and changing the property // within the Properties menu. //************************************************************* `timescale 1ns / 1ns module dram3 ( CLK, addr, write, data ) ; parameter file = "dram.dat"; // Don't edit this input CLK; input [7:0] addr; input write; inout [15:0] data; // The data memory contains 256 locations of 16 bits each reg [15:0] memory[0:255] ; assign #5 data = (write == 1) ? 16'bz : memory[addr]; initial $readmemb (file, memory) ; // Write happens on the rising edge of the clock always @(posedge CLK) if (write == 1) begin memory[addr] <= data; // Memory-mapped I/O if (addr == 255) $display ("%s", data); end endmodule