frontend/axi: fix write response implementation

This commit is contained in:
Florent Kermarrec 2018-09-18 15:24:41 +02:00
parent d23dbf6e57
commit b145b0c338
2 changed files with 10 additions and 6 deletions

View File

@ -10,7 +10,6 @@ Features:
- ID support (configurable width). - ID support (configurable width).
Limitations: Limitations:
- Write response always supposed to be ready.
- Response always okay. - Response always okay.
- No reordering. - No reordering.
""" """
@ -164,14 +163,18 @@ class LiteDRAMAXI2NativeW(Module):
# Write ID Buffer & Response # Write ID Buffer & Response
id_buffer = stream.SyncFIFO([("id", axi.id_width)], buffer_depth) id_buffer = stream.SyncFIFO([("id", axi.id_width)], buffer_depth)
self.submodules += id_buffer resp_buffer = stream.SyncFIFO([("id", axi.id_width), ("resp", 2)], buffer_depth)
self.submodules += id_buffer, resp_buffer
self.comb += [ self.comb += [
id_buffer.sink.valid.eq(aw.valid & aw.ready), id_buffer.sink.valid.eq(aw.valid & aw.ready),
id_buffer.sink.id.eq(aw.id), id_buffer.sink.id.eq(aw.id),
axi.b.valid.eq(axi.w.valid & axi.w.ready), # Note: Write response always supposed to be ready. If(axi.w.valid & axi.w.last & axi.w.ready,
axi.b.resp.eq(resp_types["okay"]), resp_buffer.sink.valid.eq(1),
axi.b.id.eq(id_buffer.source.id), resp_buffer.sink.resp.eq(resp_types["okay"]),
id_buffer.source.ready.eq(axi.b.valid & axi.b.ready) resp_buffer.sink.id.eq(id_buffer.source.id),
id_buffer.source.ready.eq(1)
),
resp_buffer.source.connect(axi.b)
] ]
# Command # Command

View File

@ -38,6 +38,7 @@ class TestAXI(unittest.TestCase):
yield yield
# send data # send data
yield axi_port.w.valid.eq(1) yield axi_port.w.valid.eq(1)
yield axi_port.w.last.eq(1)
yield axi_port.w.data.eq(write.data) yield axi_port.w.data.eq(write.data)
yield yield
while (yield axi_port.w.ready) == 0: while (yield axi_port.w.ready) == 0: