From b15c9f825eb888b97ced6ca8e831a94ab257ad46 Mon Sep 17 00:00:00 2001 From: Matteo Perotti Date: Sat, 7 Sep 2024 19:33:51 +0200 Subject: [PATCH] [hardware] Cut the timing loop in the ring buffer --- hardware/src/ara_ring_buffer.sv | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/hardware/src/ara_ring_buffer.sv b/hardware/src/ara_ring_buffer.sv index da1f1f877..28ce1e0a5 100644 --- a/hardware/src/ara_ring_buffer.sv +++ b/hardware/src/ara_ring_buffer.sv @@ -62,10 +62,8 @@ module ara_ring_buffer #( assign full_o = (usage_q == DEPTH[$clog2(DEPTH):0]); assign empty_o = (usage_q == '0); - - assign valid_o = (mem_q[head_q].rs_valid != '0 || mem_d[head_q].rs_valid != '0) && !(head_q == commit_q && head_q == commit_d) && !(empty_o); // (mem_q[head_q].rs_valid == mem_q[head_q].register_read) - // (mem_q[head_q].rs_valid != '0 && mem_d[head_q].rs_valid != '0) && - + // The entry is valid only if it has been committed already (now or in the previous cycles) + assign valid_o = (|mem_q[head_q].rs_valid == 1'b1) && (head_q != commit_q || commit_i) && !empty_o; // Read and write logic always_comb begin @@ -113,7 +111,7 @@ module ara_ring_buffer #( end // Read - if (valid_o && ~empty_o && ready_i) begin + if (valid_o && !empty_o && ready_i) begin // Pop the head by one head_d = head_q + 1'b1; // Decrease usage @@ -131,7 +129,7 @@ module ara_ring_buffer #( end // Assign output - data_o = mem_d[head_q]; + data_o = mem_q[head_q]; end