+endmodule
+
+module MiniRAM(
+ input [15:0] address,
+ inout [7:0] data,
+ input clk,
+ input wr, rd);
+
+ reg [7:0] ram [127:0];
+
+ wire decode = (address >= 16'hFF80) && (address <= 16'hFFFE);
+ reg [7:0] odata;
+ assign data = (rd && decode) ? odata : 8'bzzzzzzzz;
+
+ always @(posedge clk)
+ begin
+ if (decode) // This has to go this way. The only way XST knows how to do
+ begin // block ram is chip select, write enable, and always
+ if (wr) // reading. "else if rd" does not cut it ...
+ ram[address[6:0]] <= data;
+ odata <= ram[address[6:0]];
+ end
+ end