2023-10-23 05:15:21 +00:00
|
|
|
module memory (input clock, reset,
|
|
|
|
input we,
|
|
|
|
input [31:0] address,
|
|
|
|
input [31:0] data_in,
|
|
|
|
output [31:0] data_out);
|
2023-10-20 09:48:18 +00:00
|
|
|
|
|
|
|
reg [63:0] memory [31:0];
|
|
|
|
|
2023-10-22 13:41:39 +00:00
|
|
|
always @(posedge clock, posedge reset) begin
|
2023-10-20 09:48:18 +00:00
|
|
|
if (reset == 1)
|
|
|
|
memory[0] <= 32'b0;
|
|
|
|
else if (we == 1)
|
|
|
|
memory[address] <= data_in;
|
|
|
|
end
|
|
|
|
|
|
|
|
assign data_out = memory[address];
|
|
|
|
|
|
|
|
endmodule
|