From c71c4c89e0230900c0dd4d8e64cce80c76b95144 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 21 Oct 2016 22:44:47 +0800 Subject: [PATCH] drtio: change data direction in _CrossDomainRequest --- artiq/gateware/drtio/rt_packets.py | 9 +++++---- artiq/test/gateware/drtio/test_rt_packets.py | 11 +++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/artiq/gateware/drtio/rt_packets.py b/artiq/gateware/drtio/rt_packets.py index b243f4065..05a8ae1cf 100644 --- a/artiq/gateware/drtio/rt_packets.py +++ b/artiq/gateware/drtio/rt_packets.py @@ -333,14 +333,15 @@ class _CrossDomainRequest(Module): If(req_ack, ongoing.eq(0)) ] if req_data is not None: - srv_data_r = Signal.like(srv_data) - dsync += If(srv_stb & srv_ack, srv_data_r.eq(srv_data)) - self.specials += NoRetiming(srv_data_r) - self.sync += If(reply.o, req_data.eq(srv_data_r)) + req_data_r = Signal.like(req_data) + self.specials += NoRetiming(req_data_r) + self.sync += If(req_stb, req_data_r.eq(req_data)) dsync += [ If(request.o, srv_stb.eq(1)), If(srv_ack, srv_stb.eq(0)) ] + if req_data is not None: + dsync += If(request.o, srv_data.eq(req_data_r)) self.comb += reply.i.eq(srv_stb & srv_ack) diff --git a/artiq/test/gateware/drtio/test_rt_packets.py b/artiq/test/gateware/drtio/test_rt_packets.py index b1168d424..693176392 100644 --- a/artiq/test/gateware/drtio/test_rt_packets.py +++ b/artiq/test/gateware/drtio/test_rt_packets.py @@ -125,10 +125,9 @@ class TestSatellite(unittest.TestCase): class TestCrossDomainRequest(unittest.TestCase): def test_cross_domain_request(self): + prng = random.Random(1) for sys_freq in 3, 6, 11: for srv_freq in 3, 6, 11: - prng = random.Random(1) - req_stb = Signal() req_ack = Signal() req_data = Signal(8) @@ -139,23 +138,23 @@ class TestCrossDomainRequest(unittest.TestCase): received_seq = [] def requester(): - for i in range(len(test_seq)): + for data in test_seq: + yield req_data.eq(data) yield req_stb.eq(1) yield while not (yield req_ack): yield - received_seq.append((yield req_data)) yield req_stb.eq(0) for j in range(prng.randrange(0, 10)): yield def server(): - for data in test_seq: + for i in range(len(test_seq)): while not (yield srv_stb): yield + received_seq.append((yield srv_data)) for j in range(prng.randrange(0, 10)): yield - yield srv_data.eq(data) yield srv_ack.eq(1) yield yield srv_ack.eq(0)