From bce8fa3ec50edee238d7ac03a2a8221bf502f915 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 2 May 2018 10:58:18 +0800 Subject: [PATCH] rtio/sed: add replace unittest at the top level (#978) --- artiq/gateware/test/rtio/test_sed_top.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/artiq/gateware/test/rtio/test_sed_top.py b/artiq/gateware/test/rtio/test_sed_top.py index d5de88979..d0f14b32e 100644 --- a/artiq/gateware/test/rtio/test_sed_top.py +++ b/artiq/gateware/test/rtio/test_sed_top.py @@ -73,7 +73,7 @@ def simulate(input_events): run_simulation(dut, {"sys": [ gen(), monitor(), - (None for _ in range(45)) + (None for _ in range(max(ts for ts, _ in input_events) + 15)) ]}, {"sys": 5, "rio": 5, "rio_phy": 5}) return ttl_changes, access_results @@ -86,3 +86,16 @@ class TestSED(unittest.TestCase): ttl_changes, access_results = simulate(input_events) self.assertEqual(ttl_changes, [e[0] + latency for e in input_events]) self.assertEqual(access_results, [("ok", 0)]*len(input_events)) + + def test_replace(self): + input_events = [] + now = 19 + for i in range(5): + now += 10 + input_events += [(now, 1)] + now += 10 + input_events += [(now, 1), (now, 0)] + + ttl_changes, access_results = simulate(input_events) + self.assertEqual(ttl_changes, list(range(40, 140, 10))) + self.assertEqual(access_results, [("ok", 0)]*len(input_events))