Skip to content

Commit

Permalink
[hardware] 🐛 Filter operand queue ready from sldu and addrgen
Browse files Browse the repository at this point in the history
The addrgen-sldu operand queue is common to slide unit and addrgen.
Since it's shared, we should be sure not to sample a
spurious ready from the wrong unit, i.e., when we are
feeding the addrgen, we don't want spurious readies from
the slide unit. The units should be responsible for avoiding
sampling wrong data, but spurious ready signals can happen in
specific corner cases. Fixing this without impacting timing is
hard, so we just mask the ready signals here as well to avoid
bugs.
  • Loading branch information
mp-17 committed Nov 28, 2023
1 parent 130d14c commit 05fda3a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 16 deletions.
42 changes: 29 additions & 13 deletions hardware/src/lane/operand_queues_stage.sv
Original file line number Diff line number Diff line change
Expand Up @@ -208,25 +208,41 @@ module operand_queues_stage import ara_pkg::*; import rvv_pkg::*; import cf_math
* Slide Unit *
****************/

// This operand queue is common to slide unit and addrgen.
// Since it's shared, we should be sure not to sample a
// spurious ready from the wrong unit, i.e., when we are
// feeding the addrgen, we don't want spurious readies from
// the slide unit. The units should be responsible for avoiding
// sampling wrong data, but spurious ready signals can happen in
// specific corner cases. Fixing this without impacting timing is
// hard, so we just mask the ready signals here as well to avoid
// bugs.
logic sldu_operand_ready_filtered;
logic addrgen_operand_ready_filtered;
assign sldu_operand_ready_filtered = sldu_operand_ready_i &
(sldu_addrgen_operand_target_fu_o == ALU_SLDU);
assign addrgen_operand_ready_filtered = addrgen_operand_ready_i &
(sldu_addrgen_operand_target_fu_o == MFPU_ADDRGEN);

operand_queue #(
.CmdBufDepth (VlduInsnQueueDepth),
.DataBufDepth (2 ),
.FPUSupport (FPUSupport ),
.NrLanes (NrLanes )
) i_operand_queue_slide_addrgen_a (
.clk_i (clk_i ),
.rst_ni (rst_ni ),
.lane_id_i (lane_id_i ),
.operand_queue_cmd_i (operand_queue_cmd_i[SlideAddrGenA] ),
.operand_queue_cmd_valid_i(operand_queue_cmd_valid_i[SlideAddrGenA] ),
.operand_i (operand_i[SlideAddrGenA] ),
.operand_valid_i (operand_valid_i[SlideAddrGenA] ),
.operand_issued_i (operand_issued_i[SlideAddrGenA] ),
.operand_queue_ready_o (operand_queue_ready_o[SlideAddrGenA] ),
.operand_o (sldu_addrgen_operand_o ),
.operand_target_fu_o (sldu_addrgen_operand_target_fu_o ),
.operand_valid_o (sldu_addrgen_operand_valid_o ),
.operand_ready_i (addrgen_operand_ready_i | sldu_operand_ready_i)
.clk_i (clk_i ),
.rst_ni (rst_ni ),
.lane_id_i (lane_id_i ),
.operand_queue_cmd_i (operand_queue_cmd_i[SlideAddrGenA] ),
.operand_queue_cmd_valid_i(operand_queue_cmd_valid_i[SlideAddrGenA] ),
.operand_i (operand_i[SlideAddrGenA] ),
.operand_valid_i (operand_valid_i[SlideAddrGenA] ),
.operand_issued_i (operand_issued_i[SlideAddrGenA] ),
.operand_queue_ready_o (operand_queue_ready_o[SlideAddrGenA] ),
.operand_o (sldu_addrgen_operand_o ),
.operand_target_fu_o (sldu_addrgen_operand_target_fu_o ),
.operand_valid_o (sldu_addrgen_operand_valid_o ),
.operand_ready_i (addrgen_operand_ready_filtered | sldu_operand_ready_filtered)
);

/////////////////
Expand Down
7 changes: 4 additions & 3 deletions hardware/src/vlsu/addrgen.sv
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,10 @@ module addrgen import ara_pkg::*; import rvv_pkg::*; #(
// Bump lane pointer
elm_ptr_d = '0;
word_lane_ptr_d += 1;
if (word_lane_ptr_q == NrLanes - 1)
// Ready for the next full word
addrgen_operand_ready_o = 1'b1;
if (word_lane_ptr_q == NrLanes - 1) begin
// Ready for the next full word
addrgen_operand_ready_o = 1'b1;
end
end else begin
// Bump element pointer
elm_ptr_d += 1;
Expand Down

0 comments on commit 05fda3a

Please sign in to comment.