configurable data_width and frequency.
"""
pads_layout = [("clk", 1), ("cs_n", 1), ("mosi", 1), ("miso", 1)]
- def __init__(self, pads, data_width, sys_clk_freq, spi_clk_freq, with_control=True):
+ def __init__(self, pads, data_width, sys_clk_freq, spi_clk_freq, with_csr=True):
if pads is None:
pads = Record(self.pads_layout)
if not hasattr(pads, "cs_n"):
self.cs = Signal(len(pads.cs_n), reset=1)
self.loopback = Signal()
- if with_control:
- self.add_control()
+ if with_csr:
+ self.add_csr()
# # #
)
)
- def add_control(self):
+ def add_csr(self):
self._control = CSRStorage(16)
self._status = CSRStatus()
self._mosi = CSRStorage(self.data_width)
yield
self.assertEqual((yield dut.miso), 0xdeadbeef)
- dut = SPIMaster(pads=None, data_width=32, sys_clk_freq=100e6, spi_clk_freq=5e6, with_control=False)
+ dut = SPIMaster(pads=None, data_width=32, sys_clk_freq=100e6, spi_clk_freq=5e6, with_csr=False)
run_simulation(dut, generator(dut))