lib/ECP5_RAM: fix wiring of address bits

When using more than 1 bit data words, you have to use a subset of the
14 address bits that the primitive offers. I was feeding addresses into
the lower N bits of the primitive (e.g. lower 12 bits for a 4-bit memory),
but it turns out you're supposed to use the _upper_ N address bits.
This commit is contained in:
David Anderson 2024-09-15 00:04:32 -07:00
parent 76a1a36006
commit eb2bb40fd3
1 changed files with 8 additions and 2 deletions

View File

@ -457,7 +457,10 @@ module mkEBRCore#(EBRPortConfig cfgA,
if (!rcfgA.enabled)
noAction;
else
vEBR.portA.put(chip_select, write, zeroExtend(pack(address)), zeroExtend(pack(datain)));
vEBR.portA.put(chip_select,
write,
zeroExtend(pack(address)) << valueOf(addr_a_pad),
zeroExtend(pack(datain)));
endmethod
method data_a read();
if (!rcfgA.enabled)
@ -472,7 +475,10 @@ module mkEBRCore#(EBRPortConfig cfgA,
if (!rcfgB.enabled)
noAction;
else
vEBR.portB.put(chip_select, write, zeroExtend(pack(address)), zeroExtend(pack(datain)));
vEBR.portB.put(chip_select,
write,
zeroExtend(pack(address)) << valueOf(addr_b_pad),
zeroExtend(pack(datain)));
endmethod
method data_b read();
if (!rcfgB.enabled)