def __init__(self, *,
uart_pins, ddr_pins,
ddrphy_addr, dramcore_addr,
- ddr_addr,
+ ddr_addr, fw_addr=0x0000_0000,
firmware=None,
- clk_freq=10e6):
+ clk_freq=40e6):
# set up wishbone bus arbiter and decoder. arbiter routes,
# decoder maps local-relative addressed satellites to global addresses
if firmware is None:
firmware = "firmware/main.bin"
- # set up clock request generator, CPU, and interrupt interface
+ # set up clock request generator
self.crg = ECPIX5CRG()
- self.cpu = MinervaCPU(reset_address=0)
- self._arbiter.add(self.cpu.ibus) # I-Cache Master
- self._arbiter.add(self.cpu.dbus) # D-Cache Master. TODO JTAG master
- self.intc = GenericInterruptController(width=len(self.cpu.ip))
+
+ if False:
+ # set up CPU, and interrupt interface
+ self.cpu = MinervaCPU(reset_address=0)
+ self._arbiter.add(self.cpu.ibus) # I-Cache Master
+ self._arbiter.add(self.cpu.dbus) # D-Cache Master. TODO JTAG master
+ self.intc = GenericInterruptController(width=len(self.cpu.ip))
# SRAM (but actually a ROM, for firmware), at address 0x0
- self.rom = SRAMPeripheral(size=4096, writable=False)
- with open(, "rb") as f:
- words = iter(lambda: f.read(self.cpu.data_width // 8), b'')
- bios = [int.from_bytes(w, self.cpu.byteorder) for w in words]
- self.rom.init = bios
- self._decoder.add(self.rom.bus, addr=0) # ROM is at 0x0000_0000
+ if fw_addr is not None:
+ self.rom = SRAMPeripheral(size=4096, writable=False)
+ with open(firmware, "rb") as f:
+ words = iter(lambda: f.read(self.cpu.data_width // 8), b'')
+ bios = [int.from_bytes(w, self.cpu.byteorder) for w in words]
+ self.rom.init = bios
+ self._decoder.add(self.rom.bus, addr=fw_addr) # ROM at fw_addr
# SRAM (read-writeable BRAM)
self.ram = SRAMPeripheral(size=4096)
# add the peripherals and clock-reset-generator
m.submodules.sysclk = self.crg
- m.submodules.rom = self.rom
+ if hasattr(self, "rom"):
+ m.submodules.rom = self.rom
m.submodules.ram = self.ram
m.submodules.uart = self.uart
- m.submodules.intc = self.intc
- m.submodules.cpu = self.cpu
+ if False:
+ m.submodules.intc = self.intc
+ m.submodules.cpu = self.cpu
m.submodules.arbiter = self._arbiter
m.submodules.decoder = self._decoder
m.submodules.ddrphy = self.ddrphy
# to the decoder (addressing wishbone slaves)
comb += self._arbiter.bus.connect(self._decoder.bus)
- # wire up the CPU interrupts
- comb += self.cpu.ip.eq(self.intc.ip)
+ if False:
+ # wire up the CPU interrupts
+ comb += self.cpu.ip.eq(self.intc.ip)
return m
uart_pins = platform.request("uart", 0)
soc = DDR3SoC(ddrphy_addr=0xff000000, # DRAM firmware init base
- dramcore_addr=0x40000000,
+ dramcore_addr=0x80000000,
ddr_addr=0x10000000,
ddr_pins=ddr_pins,
- uart_pins=uart_pins)
+ uart_pins=uart_pins,
+ fw_addr=None)
platform.build(soc, do_program=True)