frontend/wishbone: add base_address param. to LiteDRAMWishbone2Native
This commit is contained in:
parent
24203cfc7b
commit
7356d3b15d
|
@ -7,11 +7,13 @@ from migen import *
|
||||||
|
|
||||||
|
|
||||||
class LiteDRAMWishbone2Native(Module):
|
class LiteDRAMWishbone2Native(Module):
|
||||||
def __init__(self, wishbone, port):
|
def __init__(self, wishbone, port, base_address=0x00000000):
|
||||||
assert len(wishbone.dat_w) == len(port.wdata.data)
|
assert len(wishbone.dat_w) == len(port.wdata.data)
|
||||||
|
|
||||||
# # #
|
# # #
|
||||||
|
|
||||||
|
adr_offset = base_address >> log2_int(port.data_width//8)
|
||||||
|
|
||||||
# Control
|
# Control
|
||||||
self.submodules.fsm = fsm = FSM(reset_state="CMD")
|
self.submodules.fsm = fsm = FSM(reset_state="CMD")
|
||||||
fsm.act("CMD",
|
fsm.act("CMD",
|
||||||
|
@ -43,7 +45,7 @@ class LiteDRAMWishbone2Native(Module):
|
||||||
# Datapath
|
# Datapath
|
||||||
self.comb += [
|
self.comb += [
|
||||||
# cmd
|
# cmd
|
||||||
port.cmd.addr.eq(wishbone.adr),
|
port.cmd.addr.eq(wishbone.adr - adr_offset),
|
||||||
# write
|
# write
|
||||||
port.wdata.we.eq(wishbone.sel),
|
port.wdata.we.eq(wishbone.sel),
|
||||||
port.wdata.data.eq(wishbone.dat_w),
|
port.wdata.data.eq(wishbone.dat_w),
|
||||||
|
|
Loading…
Reference in New Issue