USTC-RVSoC/RTL/ram.sv

21 lines
411 B
Systemverilog
Raw Normal View History

2022-04-07 17:12:33 +08:00
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;
2022-04-07 17:12:33 +08:00
logic [7:0] ram_cell [1024];
always @ (posedge clk)
2022-04-07 17:12:33 +08:00
o_rdata <= ram_cell[i_raddr];
always @ (posedge clk)
if(i_we)
2022-04-07 17:12:33 +08:00
ram_cell[i_waddr] <= i_wdata;
endmodule