forked from M-Labs/artiq
1
0
Fork 0

drtio: use BlindTransfer for error reporting

This commit is contained in:
Sebastien Bourdeauducq 2017-04-03 00:18:07 +08:00
parent 8c414cebc7
commit db3118b916
3 changed files with 14 additions and 12 deletions

View File

@ -1,9 +1,10 @@
"""Protocol error reporting for satellites."""
from migen import *
from migen.genlib.cdc import PulseSynchronizer
from misoc.interconnect.csr import *
from artiq.gateware.rtio.cdc import BlindTransfer
class RTErrorsSatellite(Module, AutoCSR):
def __init__(self, rt_packet, ios):
@ -13,12 +14,12 @@ class RTErrorsSatellite(Module, AutoCSR):
def error_csr(csr, *sources):
for n, source in enumerate(sources):
pending = Signal(related=source)
ps = PulseSynchronizer("rtio", "sys")
self.submodules += ps
self.comb += ps.i.eq(source)
xfer = BlindTransfer(odomain="sys")
self.submodules += xfer
self.comb += xfer.i.eq(source)
self.sync += [
If(csr.re & csr.r[n], pending.eq(0)),
If(ps.o, pending.eq(1))
If(xfer.o, pending.eq(1))
]
self.comb += csr.w[n].eq(pending)

View File

@ -5,7 +5,7 @@ from migen.genlib.fsm import *
from migen.genlib.fifo import AsyncFIFO
from migen.genlib.cdc import PulseSynchronizer
from artiq.gateware.rtio.cdc import GrayCodeTransfer
from artiq.gateware.rtio.cdc import GrayCodeTransfer, BlindTransfer
from artiq.gateware.drtio.rt_serializer import *
@ -252,8 +252,8 @@ class RTPacketMaster(Module):
read_timestamp.eq(rx_dp.packet_as["read_reply"].timestamp)
]
err_unknown_packet_type = PulseSynchronizer("rtio_rx", "sys")
err_packet_truncated = PulseSynchronizer("rtio_rx", "sys")
err_unknown_packet_type = BlindTransfer("rtio_rx", "sys")
err_packet_truncated = BlindTransfer("rtio_rx", "sys")
self.submodules += err_unknown_packet_type, err_packet_truncated
self.comb += [
self.err_unknown_packet_type.eq(err_unknown_packet_type.o),

View File

@ -47,15 +47,16 @@ class RTIOCounter(Module):
class BlindTransfer(Module):
def __init__(self):
def __init__(self, idomain="rio", odomain="rsys"):
self.i = Signal()
self.o = Signal()
ps = PulseSynchronizer("rio", "rsys")
ps_ack = PulseSynchronizer("rsys", "rio")
ps = PulseSynchronizer(idomain, odomain)
ps_ack = PulseSynchronizer(odomain, idomain)
self.submodules += ps, ps_ack
blind = Signal()
self.sync.rio += [
isync = getattr(self.sync, idomain)
isync += [
If(self.i, blind.eq(1)),
If(ps_ack.o, blind.eq(0))
]