forked from M-Labs/artiq
rtio: clean up error-prone rtlink.get_or_zero()
This commit is contained in:
parent
53860868f4
commit
65baca8c57
|
@ -190,8 +190,10 @@ class Core(Module, AutoCSR):
|
|||
self.specials += AsyncResetSynchronizer(self.cd_rio_phy, cmd_reset_phy)
|
||||
|
||||
# TSC
|
||||
fine_ts_width = max(rtlink.get_fine_ts_width(channel.interface)
|
||||
for channel in channels)
|
||||
fine_ts_width = max(max(rtlink.get_fine_ts_width(channel.interface.o)
|
||||
for channel in channels),
|
||||
max(rtlink.get_fine_ts_width(channel.interface.i)
|
||||
for channel in channels))
|
||||
coarse_ts = Signal(64-fine_ts_width)
|
||||
self.sync.rtio += coarse_ts.eq(coarse_ts + 1)
|
||||
coarse_ts_cdc = GrayCodeTransfer(len(coarse_ts))
|
||||
|
|
|
@ -69,10 +69,9 @@ class Interface:
|
|||
|
||||
|
||||
def _get_or_zero(interface, attr):
|
||||
if isinstance(interface, Interface):
|
||||
return max(_get_or_zero(interface.i, attr),
|
||||
_get_or_zero(interface.o, attr))
|
||||
else:
|
||||
if interface is None:
|
||||
return 0
|
||||
assert isinstance(interface, (OInterface, IInterface))
|
||||
if hasattr(interface, attr):
|
||||
return len(getattr(interface, attr))
|
||||
else:
|
||||
|
|
|
@ -27,7 +27,7 @@ class SED(Module):
|
|||
else:
|
||||
raise ValueError
|
||||
|
||||
fine_ts_width = max(rtlink.get_fine_ts_width(c.interface)
|
||||
fine_ts_width = max(rtlink.get_fine_ts_width(c.interface.o)
|
||||
for c in channels)
|
||||
seqn_width = layouts.seqn_width(lane_count, fifo_depth)
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ from artiq.gateware.rtio import rtlink
|
|||
|
||||
|
||||
def fifo_payload(channels):
|
||||
address_width = max(rtlink.get_address_width(channel.interface)
|
||||
address_width = max(rtlink.get_address_width(channel.interface.o)
|
||||
for channel in channels)
|
||||
data_width = max(rtlink.get_data_width(channel.interface)
|
||||
data_width = max(rtlink.get_data_width(channel.interface.o)
|
||||
for channel in channels)
|
||||
|
||||
layout = [
|
||||
|
@ -46,11 +46,11 @@ def fifo_egress(seqn_width, layout_payload):
|
|||
|
||||
|
||||
def output_network_payload(channels):
|
||||
fine_ts_width = max(rtlink.get_fine_ts_width(channel.interface)
|
||||
fine_ts_width = max(rtlink.get_fine_ts_width(channel.interface.o)
|
||||
for channel in channels)
|
||||
address_width = max(rtlink.get_address_width(channel.interface)
|
||||
address_width = max(rtlink.get_address_width(channel.interface.o)
|
||||
for channel in channels)
|
||||
data_width = max(rtlink.get_data_width(channel.interface)
|
||||
data_width = max(rtlink.get_data_width(channel.interface.o)
|
||||
for channel in channels)
|
||||
|
||||
layout = [("channel", bits_for(len(channels)-1))]
|
||||
|
|
Loading…
Reference in New Issue