frontend/crossbar: fix sign on adr_shift

This commit is contained in:
Florent Kermarrec 2016-06-20 21:40:32 +02:00
parent ad8ca86e13
commit 2ed7212701
1 changed files with 2 additions and 2 deletions

View File

@ -45,9 +45,9 @@ class LiteDRAMCrossbar(Module):
# data width convertion
if dw != self.dw:
if dw > self.dw:
adr_shift = log2_int(dw//self.dw)
adr_shift = -log2_int(dw//self.dw)
else:
adr_shift = -log2_int(self.dw//dw)
adr_shift = log2_int(self.dw//dw)
new_port = LiteDRAMPort(mode, port.aw + adr_shift, dw, cd=cd)
self.submodules += ClockDomainsRenamer(cd)(LiteDRAMPortConverter(new_port, port))
port = new_port