common: add id to ports

This commit is contained in:
Florent Kermarrec 2017-06-27 15:06:12 +02:00
parent 9ce2f67bb1
commit 883e97101a
2 changed files with 5 additions and 4 deletions

View File

@ -89,11 +89,12 @@ def rdata_description(dw):
class LiteDRAMPort: class LiteDRAMPort:
def __init__(self, mode, aw, dw, cd="sys"): def __init__(self, mode, aw, dw, cd="sys", id=0):
self.mode = mode self.mode = mode
self.aw = aw self.aw = aw
self.dw = dw self.dw = dw
self.cd = cd self.cd = cd
self.id = id
self.lock = Signal() self.lock = Signal()

View File

@ -33,12 +33,12 @@ class LiteDRAMCrossbar(Module):
dw = self.dw dw = self.dw
# crossbar port # crossbar port
port = LiteDRAMPort(mode, self.rca_bits + self.bank_bits, self.dw, "sys") port = LiteDRAMPort(mode, self.rca_bits + self.bank_bits, self.dw, "sys", len(self.masters))
self.masters.append(port) self.masters.append(port)
# clock domain crossing # clock domain crossing
if cd != "sys": if cd != "sys":
new_port = LiteDRAMPort(mode, port.aw, port.dw, cd) new_port = LiteDRAMPort(mode, port.aw, port.dw, cd, port.id)
self.submodules += LiteDRAMPortCDC(new_port, port) self.submodules += LiteDRAMPortCDC(new_port, port)
port = new_port port = new_port
@ -48,7 +48,7 @@ class LiteDRAMCrossbar(Module):
adr_shift = -log2_int(dw//self.dw) adr_shift = -log2_int(dw//self.dw)
else: 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) new_port = LiteDRAMPort(mode, port.aw + adr_shift, dw, cd, port.id)
self.submodules += ClockDomainsRenamer(cd)(LiteDRAMPortConverter(new_port, port, reverse)) self.submodules += ClockDomainsRenamer(cd)(LiteDRAMPortConverter(new_port, port, reverse))
port = new_port port = new_port