From: Florent Kermarrec Date: Fri, 8 Nov 2019 18:43:01 +0000 (+0100) Subject: cores/code_8b10b/Decoder: add basic invalid symbols detection X-Git-Tag: 24jan2021_ls180~872 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0a030fe17dc55883fcc4d564c63af129334c7c7b;p=litex.git cores/code_8b10b/Decoder: add basic invalid symbols detection Check that we have 4,5 or 6 ones in the symbol. This does not report all invalid symbols but still allow detecting issues with the link. --- diff --git a/litex/soc/cores/code_8b10b.py b/litex/soc/cores/code_8b10b.py index 894449f0..552297c4 100644 --- a/litex/soc/cores/code_8b10b.py +++ b/litex/soc/cores/code_8b10b.py @@ -1,4 +1,5 @@ # This file is Copyright (c) 2016-2017 Sebastien Bourdeauducq +# This file is Copyright (c) 2019 Florent Kermarrec # License: BSD """ @@ -15,6 +16,9 @@ Note: This encoding is *not* used by DVI/HDMI (that uses a *different* 8b/10b scheme called TMDS). """ +from functools import reduce +from operator import add + from migen import * @@ -267,6 +271,7 @@ class Decoder(Module): self.input = Signal(10) self.d = Signal(8) self.k = Signal() + self.invalid = Signal() # # # @@ -304,3 +309,9 @@ class Decoder(Module): ] self.comb += self.d.eq(Cat(code5b, code3b)) + + # Basic invalid symbols detection: check that we have 4,5 or 6 ones in the symbol. This does + # not report all invalid symbols but still allow detecting issues with the link. + ones = Signal(4) + self.sync += ones.eq(reduce(add, [self.input[i] for i in range(10)])) + self.comb += self.invalid.eq((ones != 4) & (ones != 5) & (ones != 6))