migen
migen copied to clipboard
Fix ECP5 BRAM packing
The ecpbram utility expects the ROM data file to be in a fixed width (i.e. zero-padded) format. migen should be able to adhere more strictly to that format without breaking other users of the ROM data file.
See https://bugs.libre-soc.org/show_bug.cgi?id=855#c45 for an example of the old data format failing when used with ecpbram.
Why is it not already doing it? The formatter string is already designed to do this zero padding (see l. 389).
Why the double - in your patch?
Maybe you want it to emit one more digit when the memory width is not a multiple of 4?
I suggest changing l.389 to (memory.width + 3)//4 in this case.