From 00da54eb2b5155795be87fc1a2e279b56b2ef404 Mon Sep 17 00:00:00 2001
From: mriggire <marco.riggirello@cern.ch>
Date: Mon, 4 Sep 2023 17:40:58 +0200
Subject: [PATCH] More robust threshold condition in LinkAggregatorCore

---
 common/firmware/hdl/LinkAggregatorCore.vhd | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/firmware/hdl/LinkAggregatorCore.vhd b/common/firmware/hdl/LinkAggregatorCore.vhd
index 0d51e7d2..495ec9e4 100644
--- a/common/firmware/hdl/LinkAggregatorCore.vhd
+++ b/common/firmware/hdl/LinkAggregatorCore.vhd
@@ -231,7 +231,7 @@ begin
             begin
                 if rising_edge(clk_p) then
                     if packet_start_buffered = '1' then
-                        if unsigned(count_cache) >= thresholds_l(i) and (unsigned(count_cache) <= thresholds_u(i) or to_integer(unsigned(thresholds_u(i))) = 0) then
+                        if unsigned(count_cache) >= thresholds_l(i) and (unsigned(count_cache) <= thresholds_u(i) or thresholds_u(i) < thresholds_l(i)) then
                             bx_valid_array(N_LINKS*j + i) <= '1';
                         else
                             bx_valid_array(N_LINKS*j + i) <= '0';
-- 
GitLab