Add artiq.gateware.rtio.channel

This commit is contained in:
Donald Sebastian Leung 2020-09-25 12:59:23 +08:00
parent f7c1cc23a5
commit 9e81676fd2
2 changed files with 37 additions and 1 deletions

View File

@ -9,7 +9,7 @@ Formally verified implementation of the ARTIQ RTIO core in nMigen
- - [ ] `misoc.interconnect.csr` - - [ ] `misoc.interconnect.csr`
- - [ ] `artiq.gateware.rtio.cri` - - [ ] `artiq.gateware.rtio.cri`
- - [x] `artiq.gateware.rtio.rtlink` - - [x] `artiq.gateware.rtio.rtlink`
- - [ ] `artiq.gateware.rtio.channel` - - [x] `artiq.gateware.rtio.channel`
- - [ ] `artiq.gateware.rtio.sed.core` - - [ ] `artiq.gateware.rtio.sed.core`
- - [ ] `artiq.gateware.rtio.sed.layouts` - - [ ] `artiq.gateware.rtio.sed.layouts`
- - [ ] `artiq.gateware.rtio.sed.lane_distributor` - - [ ] `artiq.gateware.rtio.sed.lane_distributor`

View File

@ -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 = []