soc/interconnect/axi: propagate response errors in AXILiteDownConverter
This commit is contained in:
parent
93bcc94b53
commit
229da572ff
|
@ -696,6 +696,7 @@ class AXILiteDownConverter(Module):
|
||||||
last_was_read = Signal()
|
last_was_read = Signal()
|
||||||
aw_ready = Signal()
|
aw_ready = Signal()
|
||||||
w_ready = Signal()
|
w_ready = Signal()
|
||||||
|
resp = Signal.like(master.b.resp)
|
||||||
|
|
||||||
# Slave address counter
|
# Slave address counter
|
||||||
master_align = log2_int(master.data_width//8)
|
master_align = log2_int(master.data_width//8)
|
||||||
|
@ -708,7 +709,7 @@ class AXILiteDownConverter(Module):
|
||||||
slave.aw.addr.eq(Cat(addr_counter, master.aw.addr[master_align:])),
|
slave.aw.addr.eq(Cat(addr_counter, master.aw.addr[master_align:])),
|
||||||
Case(counter, {i: slave.w.data.eq(master.w.data[i*dw_to:]) for i in range(ratio)}),
|
Case(counter, {i: slave.w.data.eq(master.w.data[i*dw_to:]) for i in range(ratio)}),
|
||||||
Case(counter, {i: slave.w.strb.eq(master.w.strb[i*dw_to//8:]) for i in range(ratio)}),
|
Case(counter, {i: slave.w.strb.eq(master.w.strb[i*dw_to//8:]) for i in range(ratio)}),
|
||||||
master.b.resp.eq(RESP_OKAY), # FIXME: error handling?
|
master.b.resp.eq(resp),
|
||||||
]
|
]
|
||||||
|
|
||||||
# Read path
|
# Read path
|
||||||
|
@ -719,7 +720,7 @@ class AXILiteDownConverter(Module):
|
||||||
# address, resp
|
# address, resp
|
||||||
self.comb += [
|
self.comb += [
|
||||||
slave.ar.addr.eq(Cat(addr_counter, master.ar.addr[master_align:])),
|
slave.ar.addr.eq(Cat(addr_counter, master.ar.addr[master_align:])),
|
||||||
master.r.resp.eq(RESP_OKAY), # FIXME: error handling?
|
master.r.resp.eq(resp),
|
||||||
]
|
]
|
||||||
|
|
||||||
# Control Path
|
# Control Path
|
||||||
|
@ -730,6 +731,7 @@ class AXILiteDownConverter(Module):
|
||||||
|
|
||||||
fsm.act("IDLE",
|
fsm.act("IDLE",
|
||||||
NextValue(counter, 0),
|
NextValue(counter, 0),
|
||||||
|
NextValue(resp, RESP_OKAY),
|
||||||
# If the last access was a read, do a write, and vice versa
|
# If the last access was a read, do a write, and vice versa
|
||||||
If(master.aw.valid & master.ar.valid,
|
If(master.aw.valid & master.ar.valid,
|
||||||
do_write.eq(last_was_read),
|
do_write.eq(last_was_read),
|
||||||
|
@ -778,6 +780,10 @@ class AXILiteDownConverter(Module):
|
||||||
NextValue(w_ready, 0),
|
NextValue(w_ready, 0),
|
||||||
If(slave.b.valid,
|
If(slave.b.valid,
|
||||||
slave.b.ready.eq(1),
|
slave.b.ready.eq(1),
|
||||||
|
# Any errors is sticky, so the first one is always sent
|
||||||
|
If((resp == RESP_OKAY) & (slave.b.resp != RESP_OKAY),
|
||||||
|
NextValue(resp, slave.b.resp)
|
||||||
|
),
|
||||||
If(counter == (ratio - 1),
|
If(counter == (ratio - 1),
|
||||||
master.aw.ready.eq(1),
|
master.aw.ready.eq(1),
|
||||||
master.w.ready.eq(1),
|
master.w.ready.eq(1),
|
||||||
|
@ -806,6 +812,10 @@ class AXILiteDownConverter(Module):
|
||||||
)
|
)
|
||||||
fsm.act("READ-RESPONSE-SLAVE",
|
fsm.act("READ-RESPONSE-SLAVE",
|
||||||
If(slave.r.valid,
|
If(slave.r.valid,
|
||||||
|
# Any errors is sticky, so the first one is always sent
|
||||||
|
If((resp == RESP_OKAY) & (slave.b.resp != RESP_OKAY),
|
||||||
|
NextValue(resp, slave.b.resp)
|
||||||
|
),
|
||||||
# On last word acknowledge ar and hold slave.r.valid until we get master.r.ready
|
# On last word acknowledge ar and hold slave.r.valid until we get master.r.ready
|
||||||
If(counter == (ratio - 1),
|
If(counter == (ratio - 1),
|
||||||
master.ar.ready.eq(1),
|
master.ar.ready.eq(1),
|
||||||
|
@ -837,10 +847,8 @@ class AXILiteConverter(Module):
|
||||||
dw_from = len(master.r.data)
|
dw_from = len(master.r.data)
|
||||||
dw_to = len(slave.r.data)
|
dw_to = len(slave.r.data)
|
||||||
if dw_from > dw_to:
|
if dw_from > dw_to:
|
||||||
print("AXILiteConverter (Down): {} -> {}".format(master.data_width, slave.data_width))
|
|
||||||
self.submodules += AXILiteDownConverter(master, slave)
|
self.submodules += AXILiteDownConverter(master, slave)
|
||||||
elif dw_from < dw_to:
|
elif dw_from < dw_to:
|
||||||
print("AXILiteConverter (Up): {} -> {}".format(master.data_width, slave.data_width))
|
raise NotImplementedError("AXILiteUpConverter")
|
||||||
raise NotImplementedError
|
|
||||||
else:
|
else:
|
||||||
self.comb += master.connect(slave)
|
self.comb += master.connect(slave)
|
||||||
|
|
Loading…
Reference in New Issue