Data Memory.v
324 Bytes
module DataMemory(address, writedata, memread, memwrite, readdata);
input[31:0] address, writedata;
input memread, memwrite;
output[31:0] readdata;
reg[31:0] mem[255:0];
assign readdata = memread ? mem[address/4] : writedata;
always @(*) begin
if(memwrite==1'b1) begin
mem[address/4] = writedata;
end
end
endmodule