From d3aaaf5e6cb2f6a8cd8a7760979e6bddcc4edea1 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Sat, 13 Jul 2019 13:10:24 +0200 Subject: [PATCH] cores/spi: fix/simplify loopback --- litex/soc/cores/spi.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/litex/soc/cores/spi.py b/litex/soc/cores/spi.py index 75d8ac12..6fb1e468 100755 --- a/litex/soc/cores/spi.py +++ b/litex/soc/cores/spi.py @@ -117,15 +117,16 @@ class SPIMaster(Module, AutoCSR): self.sync += \ If(shift, If(clk_rise, - miso.eq(pads.miso), + If(self.loopback, + miso.eq(pads.mosi) + ).Else( + miso.eq(pads.miso) + ) ).Elif(clk_fall, miso_data.eq(Cat(miso, miso_data[:-1])) ) ) - # Loopback --------------------------------------------------------------------------------- - self.comb += If(self.loopback, pads.miso.eq(pads.mosi)) - def add_control(self): self._control = CSRStorage(16) self._status = CSRStatus() -- 2.30.2