add ram
This commit is contained in:
24
ram/ram.v
Normal file
24
ram/ram.v
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
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
|
||||
Reference in New Issue
Block a user