Skip to content

Commit

Permalink
frontend/axi: add base_address parameter to LiteDRAMAXI2Native
Browse files Browse the repository at this point in the history
  • Loading branch information
enjoy-digital committed Oct 17, 2019
1 parent 5d1a984 commit 1d037d2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions litedram/frontend/axi.py
Expand Up @@ -30,7 +30,7 @@ class LiteDRAMAXIPort(AXIInterface):


class LiteDRAMAXI2NativeW(Module):
def __init__(self, axi, port, buffer_depth):
def __init__(self, axi, port, buffer_depth, base_address):
self.cmd_request = Signal()
self.cmd_grant = Signal()

Expand Down Expand Up @@ -78,7 +78,7 @@ def __init__(self, axi, port, buffer_depth):
If(self.cmd_request & self.cmd_grant,
port.cmd.valid.eq(1),
port.cmd.we.eq(1),
port.cmd.addr.eq(aw.addr >> ashift),
port.cmd.addr.eq((aw.addr - base_address) >> ashift),
aw.ready.eq(port.cmd.ready),
axi.w.connect(w_buffer.sink, omit={"valid", "ready"}),
If(port.cmd.ready,
Expand All @@ -96,7 +96,7 @@ def __init__(self, axi, port, buffer_depth):


class LiteDRAMAXI2NativeR(Module):
def __init__(self, axi, port, buffer_depth):
def __init__(self, axi, port, buffer_depth, base_address):
self.cmd_request = Signal()
self.cmd_grant = Signal()

Expand Down Expand Up @@ -156,7 +156,7 @@ def __init__(self, axi, port, buffer_depth):
port.cmd.valid.eq(ar.valid & can_read),
ar.ready.eq(port.cmd.ready & can_read),
port.cmd.we.eq(0),
port.cmd.addr.eq(ar.addr >> ashift)
port.cmd.addr.eq((ar.addr - base_address) >> ashift)
)
]

Expand All @@ -169,15 +169,15 @@ def __init__(self, axi, port, buffer_depth):


class LiteDRAMAXI2Native(Module):
def __init__(self, axi, port, w_buffer_depth=16, r_buffer_depth=16):
def __init__(self, axi, port, w_buffer_depth=16, r_buffer_depth=16, base_address=0x00000000):

# # #

# Write path
self.submodules.write = LiteDRAMAXI2NativeW(axi, port, w_buffer_depth)
self.submodules.write = LiteDRAMAXI2NativeW(axi, port, w_buffer_depth, base_address)

# Read path
self.submodules.read = LiteDRAMAXI2NativeR(axi, port, r_buffer_depth)
self.submodules.read = LiteDRAMAXI2NativeR(axi, port, r_buffer_depth, base_address)

# Write / Read arbitration
arbiter = RoundRobin(2, SP_CE)
Expand Down

0 comments on commit 1d037d2

Please sign in to comment.