soc/integration/soc_core: fix get_mem_data for json files
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Thu, 25 Apr 2019 16:36:47 +0000 (18:36 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Thu, 25 Apr 2019 16:36:47 +0000 (18:36 +0200)
litex/soc/integration/soc_core.py

index cd8eb6de3dbac062eb5b8d640c8fda4aa5d18bfe..fba5ada2cc2796e74afe424655e0beee045fc301 100644 (file)
@@ -70,9 +70,9 @@ def get_mem_data(filename, endianness="big", mem_size=None):
                     for i in range(len(w), 4):
                         w += b'\x00'
                 if endianness == "little":
-                    data[i] = struct.unpack("<I", w)[0]
+                    data[int(base, 16)//4 + i] = struct.unpack("<I", w)[0]
                 else:
-                    data[i] = struct.unpack(">I", w)[0]
+                    data[int(base, 16)//4 + i] = struct.unpack(">I", w)[0]
                 i += 1
     return data