From 5353eea8da327df0bba7a1e6fc6c819e0cc9e2e7 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Tue, 17 Sep 2019 12:31:23 +0200 Subject: [PATCH] sniffer: add visual K28.5 detection --- sniffer/sniffer.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sniffer/sniffer.py b/sniffer/sniffer.py index a294a89..a806166 100755 --- a/sniffer/sniffer.py +++ b/sniffer/sniffer.py @@ -4,6 +4,7 @@ # PCIe Screamer with FT601 TX lanes duplicated to PCIe RX lanes for sniffing FT601 --> Host comm from migen import * +from migen.genlib.misc import WaitTimer from litex.build.generic_platform import * from litex.build.xilinx import XilinxPlatform @@ -143,6 +144,23 @@ class USB3Sniffer(SoCMini): csr_csv="analyzer.csv") self.add_csr("analyzer") + # Led (Set Led0 if continuous K28.5 are detected) ------------------------------------------ + def K(x, y): + return (y << 5) | x + k28_5_timer = WaitTimer(int(250e6*1e-1)) + k28_5_timer = ClockDomainsRenamer("rx")(k28_5_timer) + self.submodules += k28_5_timer + self.comb += [ + k28_5_timer.wait.eq(1), + If(gtp.source.ctrl[0] & (gtp.source.data[:8] == K(28, 5)), + k28_5_timer.wait.eq(0) + ), + If(gtp.source.ctrl[1] & (gtp.source.data[8:] == K(28, 5)), + k28_5_timer.wait.eq(0) + ), + platform.request("user_led", 0).eq(~k28_5_timer.done) + ] + # Build -------------------------------------------------------------------------------------------- def main():