Skip to content

Commit 5d761f0

Browse files
committed
rr_distributor: add StrictRR parameter, clarify distribution
1 parent 6da5556 commit 5d761f0

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/rr_distributor.sv

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,16 @@ module rr_distributor # (
1919
/// Data width of the payload in bits. Not needed if `data_t` is overwritten.
2020
parameter int unsigned Width = 1,
2121
/// Data type of the payload, can be overwritten with a custom type. Only use of `Width`.
22-
parameter type data_t = logic [Width-1:0],
22+
parameter type data_t = logic [Width-1:0],
23+
/// Setting StrictRR enforces a strict round-robin distribution
24+
/// If set to 1'b1, the rr_distributor will distribute the requests to the next output
25+
/// in line, irrespective if this output is ready or not, irrespective if another
26+
/// output could accept the request. The transaction will wait until the next one in
27+
/// line accepts the handshake.
28+
/// If set to 1'b0, the rr_distributor will step through the outputs if one is ready
29+
/// but the current one is not. This can reduce wait time for the input.
30+
/// **THIS IS NOT COMPLIANT AS IT MAY DE-ASSERT VALID WITHOUT A PROPER HANDSHAKE**
31+
parameter bit StrictRR = 1'b0,
2332
/// Dependent parameter, do **not** overwrite.
2433
/// Width of the selected index
2534
parameter int unsigned IdxWidth = cf_math_pkg::idx_width(NumOut),
@@ -51,7 +60,7 @@ module rr_distributor # (
5160

5261
always_comb begin : rr_next
5362
rr_d = rr_q;
54-
if (valid_i && one_ready) begin
63+
if (valid_i && ( ready_i[rr_q] || (one_ready && !StrictRR))) begin
5564
if (rr_q == idx_t'(NumOut - 1)) begin
5665
rr_d = '0;
5766
end else begin
@@ -64,12 +73,9 @@ module rr_distributor # (
6473

6574
always_comb begin : proc_arbitration
6675
valid_o = '0;
67-
ready_o = 1'b0;
68-
if (ready_i[rr_q]) begin
69-
valid_o[rr_q] = valid_i;
70-
ready_o = 1'b1;
71-
end
76+
valid_o[rr_q] = valid_i;
7277
end
78+
assign ready_o = ready_i[rr_q];
7379

7480
always_ff @(posedge clk_i or negedge rst_ni) begin : proc_prio_regs
7581
if(~rst_ni) begin

0 commit comments

Comments
 (0)