USTC-RVSoC/RTL/ram.sv
WangXuan95 7b3af4c460 update
2022-04-07 17:12:33 +08:00

21 lines
411 B
Systemverilog

module ram( // 1024B
input logic clk,
input logic i_we,
input logic [ 9:0] i_waddr, i_raddr,
input logic [ 7:0] i_wdata,
output logic [ 7:0] o_rdata
);
initial o_rdata = 8'h0;
logic [7:0] ram_cell [1024];
always @ (posedge clk)
o_rdata <= ram_cell[i_raddr];
always @ (posedge clk)
if(i_we)
ram_cell[i_waddr] <= i_wdata;
endmodule