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 * 0x00800000. rdata and ready must be driven to zero if the
13 * address is not within the range of this module. There also
14 * exists a shadow up at 0x80000000.
16 wire decode = bus_addr[30:23] == 8'b0;
17 wire [22:0] ramaddr = {bus_addr[22:2], 2'b0}; /* mask off lower two bits
18 * for word alignment */
20 reg [31:0] data [((8*1024*1024) / 4 - 1):0];
22 reg [31:0] temprdata = 0;
23 reg [22:0] lastread = 23'h7FFFFF;
24 assign bus_rdata = (bus_rd && decode) ? temprdata : 32'h0;
26 assign bus_ready = decode &&
27 (bus_wr || (bus_rd && (lastread == ramaddr)));
30 $readmemh("ram.hex", data);
35 data[ramaddr[22:2]] = bus_wdata;
37 /* This is not allowed to be conditional -- stupid Xilinx
39 temprdata <= data[ramaddr[22:2]];