From: Florent Kermarrec Date: Sat, 13 Jul 2019 11:10:24 +0000 (+0200) Subject: cores/spi: fix/simplify loopback X-Git-Tag: 24jan2021_ls180~1101 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d3aaaf5e6cb2f6a8cd8a7760979e6bddcc4edea1;p=litex.git cores/spi: fix/simplify loopback --- 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()