Files
hdl-projects/ram/ram.v
Jose Luis Montañes Ojados b3d11de769 add ram
2026-03-01 03:29:11 +01:00

24 lines
513 B
Verilog

/*
Ram Sincrona
*/
module ram #(
parameter DEPTH = 256, // posiciones
parameter W = 16 // bits por posicion
) (
input clk,
input wr_en,
input [$clog2(DEPTH)-1:0] addr,
input [W-1:0] wr_data,
output reg [W-1:0] rd_data
);
reg [W-1:0] mem [0:DEPTH-1];
always @(posedge clk) begin
if (wr_en)
mem[addr] <= wr_data;
else
rd_data <= mem[addr];
end
endmodule