back.rtlil: unbreak d47c1f8a.
authorwhitequark <cz@m-labs.hk>
Mon, 24 Dec 2018 19:11:07 +0000 (19:11 +0000)
committerwhitequark <cz@m-labs.hk>
Mon, 24 Dec 2018 19:11:07 +0000 (19:11 +0000)
nmigen/back/rtlil.py

index bc9897576a4d14b195e062889204179a5fc0f5ad..c51b4b9bec97de749bece5f27a047d26f843c539 100644 (file)
@@ -644,7 +644,7 @@ def convert_fragment(builder, fragment, name, top):
                             memories[memory] = module.memory(width=memory.width, size=memory.depth,
                                                              name=memory.name)
                             addr_bits = bits_for(memory.depth)
-                            data_parts = ["{}'".format(memory.width * memory.depth)]
+                            data_parts = []
                             for addr in range(memory.depth):
                                 if addr < len(memory.init):
                                     data = memory.init[addr]
@@ -653,7 +653,8 @@ def convert_fragment(builder, fragment, name, top):
                                 data_parts.append("{:0{}b}".format(data, memory.width))
                             module.cell("$meminit", ports={
                                 "\\ADDR": rhs_compiler(ast.Const(0, addr_bits)),
-                                "\\DATA": "".join(data_parts),
+                                "\\DATA": "{}'".format(memory.width * memory.depth) +
+                                          "".join(reversed(data_parts)),
                             }, params={
                                 "MEMID": memories[memory],
                                 "ABITS": addr_bits,