frontend/adapter: simplify LiteDRAMNativePortCDC using stream.ClockDomainCrossing.
This commit is contained in:
parent
16fd46bf35
commit
ce4e7f9ad0
|
@ -22,37 +22,34 @@ class LiteDRAMNativePortCDC(Module):
|
||||||
address_width = port_from.address_width
|
address_width = port_from.address_width
|
||||||
data_width = port_from.data_width
|
data_width = port_from.data_width
|
||||||
mode = port_from.mode
|
mode = port_from.mode
|
||||||
clock_domain_from = port_from.clock_domain
|
|
||||||
clock_domain_to = port_to.clock_domain
|
|
||||||
|
|
||||||
# # #
|
# # #
|
||||||
|
|
||||||
cmd_fifo = stream.AsyncFIFO([("we", 1), ("addr", address_width)], cmd_depth)
|
cmd_cdc = stream.ClockDomainCrossing(
|
||||||
cmd_fifo = ClockDomainsRenamer(
|
layout = [("we", 1), ("addr", address_width)],
|
||||||
{"write": clock_domain_from,
|
cd_from = port_from.clock_domain,
|
||||||
"read": clock_domain_to})(cmd_fifo)
|
cd_to = port_to.clock_domain,
|
||||||
self.submodules += cmd_fifo
|
depth = cmd_depth)
|
||||||
self.submodules += stream.Pipeline(
|
self.submodules += cmd_cdc
|
||||||
port_from.cmd, cmd_fifo, port_to.cmd)
|
self.submodules += stream.Pipeline(port_from.cmd, cmd_cdc, port_to.cmd)
|
||||||
|
|
||||||
if mode == "write" or mode == "both":
|
if mode in ["write", "both"]:
|
||||||
wdata_fifo = stream.AsyncFIFO(
|
wdata_cdc = stream.ClockDomainCrossing(
|
||||||
[("data", data_width), ("we", data_width//8)], wdata_depth)
|
layout = [("data", data_width), ("we", data_width//8)],
|
||||||
wdata_fifo = ClockDomainsRenamer(
|
cd_from = port_from.clock_domain,
|
||||||
{"write": clock_domain_from,
|
cd_to = port_to.clock_domain,
|
||||||
"read": clock_domain_to})(wdata_fifo)
|
depth = wdata_depth)
|
||||||
self.submodules += wdata_fifo
|
self.submodules += wdata_cdc
|
||||||
self.submodules += stream.Pipeline(
|
self.submodules += stream.Pipeline(port_from.wdata, wdata_cdc, port_to.wdata)
|
||||||
port_from.wdata, wdata_fifo, port_to.wdata)
|
|
||||||
|
|
||||||
if mode == "read" or mode == "both":
|
if mode in ["read", "both"]:
|
||||||
rdata_fifo = stream.AsyncFIFO([("data", data_width)], rdata_depth)
|
rdata_cdc = stream.ClockDomainCrossing(
|
||||||
rdata_fifo = ClockDomainsRenamer(
|
layout = [("data", data_width)],
|
||||||
{"write": clock_domain_to,
|
cd_from = port_to.clock_domain,
|
||||||
"read": clock_domain_from})(rdata_fifo)
|
cd_to = port_from.clock_domain,
|
||||||
self.submodules += rdata_fifo
|
depth = rdata_depth)
|
||||||
self.submodules += stream.Pipeline(
|
self.submodules += rdata_cdc
|
||||||
port_to.rdata, rdata_fifo, port_from.rdata)
|
self.submodules += stream.Pipeline(port_to.rdata, rdata_cdc, port_from.rdata)
|
||||||
|
|
||||||
# LiteDRAMNativePortDownConverter ------------------------------------------------------------------
|
# LiteDRAMNativePortDownConverter ------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue