common_cells icon indicating copy to clipboard operation
common_cells copied to clipboard

Inconsistent grant behavior of rr_arb_tree module between NumIn == 1 and NumIn > 1

Open ckf104 opened this issue 1 year ago • 1 comments

If we set parameter bit AxiVldRdy = 1'b0 with NumIn > 1

            assign gnt_o[l*2]        = gnt_nodes[Idx0] & (AxiVldRdy | req_d[l*2])   & ~sel;
            assign gnt_o[l*2+1]      = gnt_nodes[Idx0] & (AxiVldRdy | req_d[l*2+1]) & sel;

above code shows that if gnt_o would not be asserted if req_i == 0.

But if we set NumIn == 1, the following code shows that gnt_o is just the same value as gnt_i and don't depend on req_i

  // just pass through in this corner case
  if (NumIn == unsigned'(1)) begin : gen_pass_through
    assign req_o    = req_i[0];
    assign gnt_o[0] = gnt_i;
    assign data_o   = data_i[0];
    assign idx_o    = '0;
  // non-degenerate cases
  end

This causes inconsistent grant behavior between NumIn == 1 and NumIn > 1 and subtle bugs on my design which only occurs when NumIn == 1.

Making the following changes in NumIn == 1 maybe makes it better?

  // just pass through in this corner case
  if (NumIn == unsigned'(1)) begin : gen_pass_through
    assign req_o    = req_i[0];
    assign gnt_o[0] = gnt_i & (AxiVldRdy | req_i[0];
    assign data_o   = data_i[0];
    assign idx_o    = '0;
  // non-degenerate cases
  end

ckf104 avatar Nov 10 '24 03:11 ckf104

The inconsistency on the interface is bad and your solutions looks like it would fix it.
I think this needs to be a v2 change since it does change interface behavior.

phsauter avatar Sep 12 '25 17:09 phsauter