From 731808f6eb632f9ae17be89f4ed1013329ebecbf Mon Sep 17 00:00:00 2001
From: David Gabriel Monk <david.gabriel.monk@cern.ch>
Date: Fri, 5 Nov 2021 15:06:27 +0100
Subject: [PATCH] Update top/firmware/hdl/LinkCombiner.vhd

---
 top/firmware/hdl/LinkCombiner.vhd | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/top/firmware/hdl/LinkCombiner.vhd b/top/firmware/hdl/LinkCombiner.vhd
index cef0881b..32574913 100644
--- a/top/firmware/hdl/LinkCombiner.vhd
+++ b/top/firmware/hdl/LinkCombiner.vhd
@@ -110,7 +110,7 @@ architecture Behavioral of LinkCombiner is
     signal bcid_sr                                                        : tBCIDShiftRegister                                 := (others => (others => '0'));
     signal super_id                                                       : unsigned(32 - 1 downto 0)                          := (others => '0');
 
-    signal packet_stub_count                                              : unsigned(7 downto 0)                               := (others => '0');
+    signal packet_stub_count, packet_stub_count_previous                  : unsigned(7 downto 0)                               := (others => '0');
     signal packet_stub_counter_pointer                                    : integer                                            := 0;
     signal packet_stub_count_done                                         : std_logic                                          := '0';
 
@@ -317,6 +317,7 @@ begin
             
             if reset = '1' then
                 packet_stub_count <= (others => '0');
+                packet_stub_count_previous <= packet_stub_count;
                 packet_stub_counter_pointer <= 0;
                 packet_stub_count_done <= '0';
             else
@@ -335,7 +336,7 @@ begin
                 output_din_array_buf(0)(31 downto 0)  <= std_logic_vector(super_id);
             elsif counter = 2 then
                 output_din_array_buf(0) <= (others => '0');
-                output_din_array_buf(0)(63 downto 56) <= std_logic_vector(packet_stub_count);
+                output_din_array_buf(0)(63 downto 56) <= std_logic_vector(packet_stub_count_previous);
                 output_wr_en_array_buf(0) <= '1';
                 if cNumberOfFEModules < 4 then
                     output_din_array_buf(0)(cNumberOfFEModules * cNumberOfCICs * 9 - 1 downto 0) <= status_sr(status_sr'high);
-- 
GitLab