1
0
mirror of synced 2026-04-25 19:51:20 +00:00
Files
lisper.cpus-pdp8/rtl/ram_256x12.v
2010-04-13 17:13:52 +00:00

44 lines
742 B
Verilog

/* 256x12 static ram */
module ram_256x12(clk, reset, a, din, dout, ce, we);
input clk;
input reset;
input [7:0] a;
input [11:0] din;
input ce, we;
output [11:0] dout;
reg [11:0] ram [0:255];
// synthesis translate_off
integer i;
initial
begin
for (i = 0; i < 256; i=i+1)
ram[i] = 12'b0;
end
// synthesis translate_on
always @(posedge clk)
begin
if (we && ce)
begin
`ifdef debug_ram
$display("rf: buffer ram write [%o] <- %o", a, din);
`endif
ram[a] = din;
end
`ifdef debug_ram
if (we == 0 && ce == 1)
$display("rf: buffer ram read [%o] -> %o", a, ram[a]);
`endif
end
assign dout = ram[a];
endmodule