migen icon indicating copy to clipboard operation
migen copied to clipboard

Fix ECP5 BRAM packing

Open madscientist159 opened this issue 2 years ago • 2 comments

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.

madscientist159 avatar Jul 07 '22 19:07 madscientist159

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?

sbourdeauducq avatar Jul 09 '22 03:07 sbourdeauducq

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.

sbourdeauducq avatar Jul 09 '22 03:07 sbourdeauducq