1
0
mirror of synced 2026-04-26 03:56:58 +00:00
Files
lisper.cpus-pdp8/rtl/ram_256x12.v
2010-06-02 13:24:36 +00:00

48 lines
814 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;
`ifdef debug
integer ram_debug;
`endif
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
if (ram_debug)
$display("rf: buffer ram write [%o] <- %o", a, din);
`endif
ram[a] = din;
end
`ifdef debug
if (ram_debug && we == 0 && ce == 1)
$display("rf: buffer ram read [%o] -> %o", a, ram[a]);
`endif
end
assign dout = ram[a];
endmodule