Skip to content

Commit b5d1fce

Browse files
authored
FPGA: Fix incorrect assignment in the db sample (#2329)
The state variable updates in MergeJoin and DuplicateMergeJoin involve a comparison of values taken from non-blocking pipe reads. These values need to be validated as coming from successful pipe reads before the state is updated.
1 parent 24eef22 commit b5d1fce

File tree

1 file changed

+10
-4
lines changed
  • DirectProgramming/C++SYCL_FPGA/ReferenceDesigns/db/src/db_utils

1 file changed

+10
-4
lines changed

DirectProgramming/C++SYCL_FPGA/ReferenceDesigns/db/src/db_utils/MergeJoin.hpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,11 @@ void MergeJoin() {
137137

138138
//////////////////////////////////////////////////////
139139
//// state variables
140-
move_t1_win =
141-
(t1_win.data.last().PrimaryKey() < t2_win.data.last().PrimaryKey());
140+
// only update if both t1 and t2 windows come from valid pipe reads
141+
if (t1_win_valid && t2_win_valid) {
142+
move_t1_win =
143+
(t1_win.data.last().PrimaryKey() < t2_win.data.last().PrimaryKey());
144+
}
142145

143146
keep_going = !t1_done || !t2_done;
144147
done_comp = t1_done || t2_done;
@@ -272,8 +275,11 @@ void DuplicateMergeJoin() {
272275

273276
//////////////////////////////////////////////////////
274277
//// state variables
275-
move_t1_win =
276-
(t1_win.data.last().PrimaryKey() < t2_win.data.last().PrimaryKey());
278+
// only update if both t1 and t2 windows come from valid pipe reads
279+
if (t1_win_valid && t2_win_valid) {
280+
move_t1_win =
281+
(t1_win.data.last().PrimaryKey() < t2_win.data.last().PrimaryKey());
282+
}
277283

278284
keep_going = !t1_done || !t2_done;
279285
done_comp = t1_done || t2_done;

0 commit comments

Comments
 (0)