4 output wire [31:0] bus_rdata,
5 input [31:0] bus_wdata,
11 /* This module is mapped in physical memory from 0x00000000 to
12 * 0x00004000. rdata and ready must be driven to zero if the
13 * address is not within the range of this module.
15 wire decode = bus_addr[31:14] == 18'b0;
16 wire [13:0] ramaddr = {bus_addr[13:2], 2'b0}; /* mask off lower two bits
17 * for word alignment */
19 reg [31:0] data [(16384 / 4 - 1):0];
21 reg [31:0] temprdata = 0;
22 reg [13:0] lastread = 14'h3FFF;
23 assign bus_rdata = (bus_rd && decode) ? temprdata : 32'h0;
25 assign bus_ready = decode &&
26 (bus_wr || (bus_rd && (lastread == ramaddr)));
29 $readmemh("ram.hex", data);
34 data[ramaddr[13:2]] <= bus_wdata;
36 /* This is not allowed to be conditional -- stupid Xilinx
38 temprdata <= data[ramaddr[13:2]];