# Hello world
MEMORY_SIZE=8192
-RAM_INIT_FILE=hello_world/hello_world.hex
+RAM_INIT_FILE=hello_world/hello_world.bin
SIM_MAIN_BRAM=false
# Micropython
#MEMORY_SIZE=393216
-#RAM_INIT_FILE=micropython/firmware.hex
+#RAM_INIT_FILE=micropython/firmware.bin
# Linux
#MEMORY_SIZE=536870912
-#RAM_INIT_FILE=dtbImage.microwatt.hex
+#RAM_INIT_FILE=dtbImage.microwatt.bin
#SIM_MAIN_BRAM=false
SIM_BRAM_CHAINBOOT=6291456 # 0x600000
endif
ls2.v: src/ls2.py
- python3 src/ls2.py sim
+ python3 src/ls2.py sim $(RAM_INIT_FILE)
# Need to investigate why yosys is hitting verilator warnings,
# and eventually turn on -Wall
# SRAM (but actually a ROM, for firmware), at address 0x0
if fw_addr is not None:
- self.rom = SRAMPeripheral(size=4096, writable=False)
+ sram_width = 32
+ self.bootmem = SRAMPeripheral(size=8192, data_width=sram_width,
+ writable=True)
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
+ words = iter(lambda: f.read(sram_width // 8), b'')
+ bios = [int.from_bytes(w, "little") for w in words]
+ self.bootmem.init = bios
+ self._decoder.add(self.bootmem.bus, addr=fw_addr) # ROM at fw_addr
# SRAM (read-writeable BRAM)
self.ram = SRAMPeripheral(size=4096)
if platform is not None:
m.submodules.sysclk = self.crg
- if hasattr(self, "rom"):
- m.submodules.rom = self.rom
+ if hasattr(self, "bootmem"):
+ m.submodules.bootmem = self.bootmem
m.submodules.ram = self.ram
m.submodules.uart = self.uart
if False: