24 lines
513 B
Coq
24 lines
513 B
Coq
|
|
/*
|
||
|
|
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
|