1
0
mirror of synced 2026-01-16 00:33:34 +00:00
Rodrigo Alejandro Melo 43396fae2c Added a test for the Memory Content File inclusion using $readmemb
Signed-off-by: Rodrigo Alejandro Melo <rodrigomelo9@gmail.com>
2020-02-01 17:41:10 -03:00

24 lines
412 B
Verilog

// A memory initialized with an external file
module memory (
input clk_i,
input we_i,
input [5:0] addr_i,
input [31:0] data_i,
output reg [31:0] data_o
);
parameter MEMFILE = "";
reg [31:0] mem [0:63];
initial $readmemb(MEMFILE,mem);
always @(posedge clk_i) begin
if (we_i)
mem[addr_i] <= data_i;
data_o <= mem[addr_i];
end
endmodule