From 091ee650f3a81acc9b3262c82314945836df3e61 Mon Sep 17 00:00:00 2001 From: Tim Fischer Date: Tue, 10 Sep 2024 15:07:28 +0200 Subject: [PATCH] hw(rob): Use per-ID offset counter --- hw/floo_rob.sv | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/hw/floo_rob.sv b/hw/floo_rob.sv index e99f65f1..1041de18 100644 --- a/hw/floo_rob.sv +++ b/hw/floo_rob.sv @@ -174,8 +174,10 @@ module floo_rob #( // In the ID table, only the pointer to the first entry of a specific response // is stored. From there an offset is used to calculate the exact index in the // reorder buffer. - rob_idx_t rob_idx_offset_q, rob_idx_offset_d; - `FF(rob_idx_offset_q, rob_idx_offset_d, '0) + rob_idx_t [NumIds-1:0] read_rob_idx_offset_q, read_rob_idx_offset_d; + rob_idx_t [NumIds-1:0] write_rob_idx_offset_q, write_rob_idx_offset_d; + `FF(read_rob_idx_offset_q, read_rob_idx_offset_d, '0) + `FF(write_rob_idx_offset_q, write_rob_idx_offset_d, '0) // `is_last_rsp_in_rob` denotes if it is the last beat in a burst. // For B responses, this is always true @@ -218,7 +220,8 @@ module floo_rob #( rob_addr = '0; rob_wen = 1'b0; - rob_idx_offset_d = rob_idx_offset_q; + read_rob_idx_offset_d = read_rob_idx_offset_q; + write_rob_idx_offset_d = write_rob_idx_offset_q; ax_valid_o = 1'b0; ax_ready_o = 1'b0; @@ -240,7 +243,7 @@ module floo_rob #( rsp_valid_o = 1'b0; rob_req = 1'b1; rob_wen = 1'b0; - rob_addr = st_peek_rob_idx + rob_idx_offset_q; + rob_addr = st_peek_rob_idx + read_rob_idx_offset_q[st_rsp_out_id]; // If the peek ID is valid and there is a valid item in the RoB // for the current response, then we can release the response @@ -253,12 +256,12 @@ module floo_rob #( rob_alloc_d[rob_addr] = 1'b0; rob_addr++; // increment the offset counter - rob_idx_offset_d++; + read_rob_idx_offset_d[st_rsp_out_id]++; // If this was the last beat for this ID, increment the rsp_counter if (is_last_rsp_in_rob) begin st_rsp_pop = 1'b1; rsp_out_valid_d = 1'b0; - rob_idx_offset_d = '0; + read_rob_idx_offset_d[st_rsp_out_id] = '0; end end // If the peeked entry is invalid or the ROB is empty, we can't release @@ -270,11 +273,11 @@ module floo_rob #( RoBWrite: begin - rob_addr = rsp_rob_idx_i + rob_idx_offset_q; + rob_addr = rsp_rob_idx_i + write_rob_idx_offset_q[st_rsp_out_id]; // If the peeked ID has a valid entry and there is data in the RoB, // we can release the response from the RoB to make place for new requests - if (st_peek_valid && rob_valid_q[st_peek_rob_idx]) begin + if (st_peek_valid && rob_valid_q[st_peek_rob_idx + read_rob_idx_offset_q[st_rob_peek_id_q]]) begin rob_state_d = RoBRead; // Don't forward the current response, since we are releasing one from the RoB rsp_valid_o = 1'b0; @@ -299,14 +302,14 @@ module floo_rob #( if (rsp_ready_i) begin // Unset the allocated bit rob_alloc_d[rob_addr] = 1'b0; - rob_idx_offset_d++; + write_rob_idx_offset_d[st_rsp_out_id]++; // If this was the last beat of a response for this ID, increment the // response counter and clear the entry in the ID status table if // this was the very last response if (rsp_last_i) begin // Pop the transaction st_rsp_pop = 1'b1; - rob_idx_offset_d = '0; + write_rob_idx_offset_d[st_rsp_out_id] = '0; end end // Otherwise, the response is out of order and has to be stored in the @@ -319,7 +322,7 @@ module floo_rob #( rsp_ready_o = 1'b1; rob_valid_d[rob_addr] = 1'b1; rob_meta_d[rob_addr] = rob_meta; - rob_idx_offset_d = (rsp_last_i)? '0 : rob_idx_offset_q + 1; + write_rob_idx_offset_d[st_rsp_out_id] = (rsp_last_i)? '0 : write_rob_idx_offset_q[st_rsp_out_id] + 1; end end end