From 9411b793cec967b77b62b71ac3fcd595b6ed5cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Mon, 16 Sep 2024 10:41:10 +0200 Subject: [PATCH 1/2] tests: mmap: simplify wishbone operations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit simplify wishbone operations. Signed-off-by: Fin Maaß --- test/test_spi_mmap.py | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/test/test_spi_mmap.py b/test/test_spi_mmap.py index b575fc8..75c82dd 100644 --- a/test/test_spi_mmap.py +++ b/test/test_spi_mmap.py @@ -44,15 +44,7 @@ def wb_gen(dut, addr, data, offset): dut.done = 0 yield dut.offset.eq(offset) - yield dut.bus.adr.eq(addr + offset) - print((yield dut.bus.adr)) - yield dut.bus.we.eq(1) - yield dut.bus.cyc.eq(1) - yield dut.bus.stb.eq(1) - yield dut.bus.dat_w.eq(data) - - while (yield dut.bus.ack) == 0: - yield + yield from dut.bus.write(addr + offset, data) dut.done = 1 @@ -116,15 +108,9 @@ def test_spi_mmap_read_test(self): def wb_gen(dut, addr, data): dut.data_ok = 0 - yield dut.bus.adr.eq(addr) - yield dut.bus.we.eq(0) - yield dut.bus.cyc.eq(1) - yield dut.bus.stb.eq(1) + dat = yield from dut.bus.read(addr) - while (yield dut.bus.ack) == 0: - yield - print((yield dut.bus.dat_r)) - if (yield dut.bus.dat_r) == data: + if dat == data: dut.data_ok = 1 def phy_gen(dut, addr, data): From 1be6e1d9bd5a44f8d4d77147ed5594a0e9714d33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Mon, 16 Sep 2024 10:41:58 +0200 Subject: [PATCH 2/2] tests: fix being stuck in test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix being stuck in test. Signed-off-by: Fin Maaß --- test/test_spi_mmap.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/test_spi_mmap.py b/test/test_spi_mmap.py index 75c82dd..7ec8856 100644 --- a/test/test_spi_mmap.py +++ b/test/test_spi_mmap.py @@ -87,9 +87,6 @@ def phy_gen(dut, addr, data): yield yield dut.sink.valid.eq(1) - while (yield dut.source.valid) == 0: - yield - yield dut.sink.valid.eq(0) yield addr = 0xcafe data = 0xdeadbeef