Incorrect arbitration in case of waits on a higher prior AHB
The arbitration fails if higher priority src interface overrules a lower priority src interface in two consecutive accesses.
If the higher priority src interface has a single access, the old code is working fine. The issue occurs if the higher prior src interface introduces at least one wait.
I solved it by preventing a re-arbitration.
diff --git a/rtl/libfpga/ahbl_arbiter.v b/rtl/libfpga/ahbl_arbiter.v
index b3dbfd9..3f4b9dc 100644
--- a/rtl/libfpga/ahbl_arbiter.v
+++ b/rtl/libfpga/ahbl_arbiter.v
@@ -208,7 +208,7 @@ always @ (posedge clk or negedge rst_n) begin
buf_valid <= buf_valid & ~mast_gnt_a;
end
for (i = 0; i < N_PORTS; i = i + 1) begin
- if (buf_wen[i]) begin
+ if (buf_wen[i] && !buf_valid[i]) begin
buf_valid [i] <= 1'b1;
buf_htrans [i] <= src_htrans [i * 2 +: 2];
buf_haddr [i] <= src_haddr [i * W_ADDR +: W_ADDR];
Thanks. It might take me a while to reproduce this because I'll need to clean up the tests a bit to use a sane simulator.
For your convivence I added two waveforms showing the issue.
The signals src_htrans[3] to src_hready_resp[0] in figure relates to the upper/lower part of the combined signals on src interface. Only split to keep the numbers short for reading.