Skip to content

Commit

Permalink
core: move elastic buffers between links and phys
Browse files Browse the repository at this point in the history
  • Loading branch information
enjoy-digital committed Jun 5, 2018
1 parent 96247e6 commit 25fd79d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
15 changes: 9 additions & 6 deletions jesd204b/core.py
Expand Up @@ -52,31 +52,34 @@ def __init__(self, phys, jesd_settings, converter_data_width):
)

links = []
link_reset = Signal()
self.comb += link_reset.eq(~reduce(and_, [phy.transmitter.init.done for phy in phys]))
for n, (phy, lane) in enumerate(zip(phys, transport.source.flatten())):
phy_name = "phy{}".format(n)
phy_cd = phy_name + "_tx"

# claim the phy
setattr(self.submodules, phy_name, phy)

ebuf = ElasticBuffer(len(phy.data), 4, "sys", phy_cd)
ebuf = ElasticBuffer(len(phy.data) + len(phy.ctrl), 4, "sys", phy_cd)
setattr(self.submodules, "ebuf{}".format(n), ebuf)

link = JESD204BLinkTX(len(phy.data), jesd_settings, n)
link = ClockDomainsRenamer(phy_cd)(link)
links.append(link)
self.comb += [
link.reset.eq(link_reset),
link.jsync.eq(self.jsync),
link.jref.eq(self.jref)
]
self.submodules += link

# connect data
self.comb += [
ebuf.din.eq(lane),
link.sink.data.eq(ebuf.dout),
phy.data.eq(link.source.data),
phy.ctrl.eq(link.source.ctrl)
link.sink.data.eq(lane),
ebuf.din[:len(phy.data)].eq(link.source.data),
ebuf.din[len(phy.data):].eq(link.source.ctrl),
phy.data.eq(ebuf.dout[:len(phy.data)]),
phy.ctrl.eq(ebuf.dout[len(phy.data):])
]

# connect control
Expand Down
1 change: 1 addition & 0 deletions jesd204b/link.py
Expand Up @@ -230,6 +230,7 @@ def __init__(self, data_width,
)


@ResetInserter()
class JESD204BLinkTX(Module):
"""Link TX layer
"""
Expand Down

0 comments on commit 25fd79d

Please sign in to comment.