From 520aade8fe09a3b90a3290905350a6ee449045e9 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Tue, 15 May 2018 14:43:22 +0200 Subject: [PATCH] serwb/scrambler: cleanup/fix potential bug --- artiq/gateware/serwb/scrambler.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/artiq/gateware/serwb/scrambler.py b/artiq/gateware/serwb/scrambler.py index e1e8ac17e..d5149dfac 100644 --- a/artiq/gateware/serwb/scrambler.py +++ b/artiq/gateware/serwb/scrambler.py @@ -98,16 +98,17 @@ class Descrambler(Module): NextState("SYNC_DATA") ) fsm.act("SYNC_DATA", - If((sink.k[0] == 1) & - (sink.d[:8] == K(29,7)), - sink.ack.eq(1), - descrambler.reset.eq(1) - ).Else( - sink.ack.eq(source.ack), - source.stb.eq(sink.stb), - source.data.eq(descrambler.o), - If(source.stb & source.ack, - descrambler.ce.eq(1) + If(sink.stb, + If((sink.k == 1) & (sink.d == K(29,7)), + sink.ack.eq(1), + descrambler.reset.eq(1) + ).Else( + source.stb.eq(1), + source.data.eq(descrambler.o), + If(source.ack, + sink.ack.eq(1), + descrambler.ce.eq(1) + ) ) ) )