From 9e81676fd22a190024803b709a6ee7df6d8c4242 Mon Sep 17 00:00:00 2001 From: Donald Sebastian Leung Date: Fri, 25 Sep 2020 12:59:23 +0800 Subject: [PATCH] Add artiq.gateware.rtio.channel --- README.md | 2 +- artiq/gateware/rtio/channel.py | 36 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4680700..17daf20 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Formally verified implementation of the ARTIQ RTIO core in nMigen - - [ ] `misoc.interconnect.csr` - - [ ] `artiq.gateware.rtio.cri` - - [x] `artiq.gateware.rtio.rtlink` -- - [ ] `artiq.gateware.rtio.channel` +- - [x] `artiq.gateware.rtio.channel` - - [ ] `artiq.gateware.rtio.sed.core` - - [ ] `artiq.gateware.rtio.sed.layouts` - - [ ] `artiq.gateware.rtio.sed.lane_distributor` diff --git a/artiq/gateware/rtio/channel.py b/artiq/gateware/rtio/channel.py index e69de29..d7b9a60 100644 --- a/artiq/gateware/rtio/channel.py +++ b/artiq/gateware/rtio/channel.py @@ -0,0 +1,36 @@ +import warnings + +from artiq.gateware.rtio import rtlink + + +class Channel: + def __init__(self, interface, probes=None, overrides=None, + ofifo_depth=None, ififo_depth=64): + if probes is None: + probes = [] + if overrides is None: + overrides = [] + + self.interface = interface + self.probes = probes + self.overrides = overrides + if ofifo_depth is None: + ofifo_depth = 64 + else: + warnings.warn("ofifo_depth is deprecated", FutureWarning) + self.ofifo_depth = ofifo_depth + self.ififo_depth = ififo_depth + + @classmethod + def from_phy(cls, phy, **kwargs): + probes = getattr(phy, "probes", []) + overrides = getattr(phy, "overrides", []) + return cls(phy.rtlink, probes, overrides, **kwargs) + + +class LogChannel: + """A degenerate channel used to log messages into the analyzer.""" + def __init__(self): + self.interface = rtlink.Interface(rtlink.OInterface(32)) + self.probes = [] + self.overrides = []