From 3cde5052073bf6be24769e21b3055a79c7dc10ff Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 20 Mar 2021 17:44:55 -0500 Subject: [PATCH 1/3] Fix ECP5 BRAM packing --- migen/fhdl/specials.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migen/fhdl/specials.py b/migen/fhdl/specials.py index 93440875..cd2daaa2 100644 --- a/migen/fhdl/specials.py +++ b/migen/fhdl/specials.py @@ -388,7 +388,7 @@ def gn(e): content = "" formatter = "{:0" + str(int(memory.width / 4)) + "X}\n" for d in memory.init: - content += formatter.format(d) + content += formatter.format(d).zfill(int(memory.width / 4)) memory_filename = add_data_file(gn(memory) + ".init", content) r += "initial begin\n" From b30db032ca04398dcb83cb716cb8832d1e689d56 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 7 Jul 2022 14:37:39 -0500 Subject: [PATCH 2/3] Update migen/fhdl/specials.py Co-authored-by: Jacob Lifshay --- migen/fhdl/specials.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migen/fhdl/specials.py b/migen/fhdl/specials.py index cd2daaa2..e6c073e5 100644 --- a/migen/fhdl/specials.py +++ b/migen/fhdl/specials.py @@ -388,7 +388,7 @@ def gn(e): content = "" formatter = "{:0" + str(int(memory.width / 4)) + "X}\n" for d in memory.init: - content += formatter.format(d).zfill(int(memory.width / 4)) + content += formatter.format(d).zfill(-(-memory.width // 4)) memory_filename = add_data_file(gn(memory) + ".init", content) r += "initial begin\n" From 4f4eb3703d1a3755b76546ef19c2345b85ed0507 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 7 Jul 2022 14:53:58 -0500 Subject: [PATCH 3/3] Update migen/fhdl/specials.py --- migen/fhdl/specials.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migen/fhdl/specials.py b/migen/fhdl/specials.py index e6c073e5..c98af04f 100644 --- a/migen/fhdl/specials.py +++ b/migen/fhdl/specials.py @@ -388,7 +388,7 @@ def gn(e): content = "" formatter = "{:0" + str(int(memory.width / 4)) + "X}\n" for d in memory.init: - content += formatter.format(d).zfill(-(-memory.width // 4)) + content += formatter.format(d).zfill(int(-(-memory.width // 4))) memory_filename = add_data_file(gn(memory) + ".init", content) r += "initial begin\n"