Files
hdl-projects/ram/ram.v

24 lines
513 B
Coq
Raw Normal View History

2026-03-01 03:29:11 +01:00
/*
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