Skip to content

Commit 6683c3a

Browse files
committed
hdl.mem: fix INIT parameter of emitted $mem_v2 cell.
Unspecified memory slots are initialized to zero, not uninitialized.
1 parent c53eee9 commit 6683c3a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

amaranth/hdl/mem.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def __getitem__(self, index):
120120

121121
def elaborate(self, platform):
122122
init = "".join(format(Const(elem, unsigned(self.width)).value, f"0{self.width}b") for elem in reversed(self.init))
123-
init = Const(int(init or "0", 2), len(self.init) * self.width)
123+
init = Const(int(init or "0", 2), self.depth * self.width)
124124
rd_clk = []
125125
rd_clk_enable = 0
126126
rd_transparency_mask = 0

0 commit comments

Comments
 (0)