verilog-apple-one/rtl/ram.v

23 lines
391 B
Coq
Raw Normal View History

2018-01-26 13:21:05 +00:00
module ram(
input clk,
input [12:0] address,
input w_en,
input [7:0] din,
output reg [7:0] dout
);
/* synthesis syn_ramstyle = rw_check */
reg [7:0] ram[0:8191];
initial
2018-01-26 22:32:31 +00:00
$readmemh("../roms/ram.hex", ram, 0, 8191);
2018-01-26 13:21:05 +00:00
always @(posedge clk)
begin
dout <= ram[address];
if (w_en) ram[address] <= din;
end
endmodule