From d6c51bfc3222dec0840b38fb8deeaf606ee467a6 Mon Sep 17 00:00:00 2001
From: Michael Boehmer <mboehmer@ph.tum.de>
Date: Wed, 8 Jun 2022 15:14:54 +0200
Subject: [PATCH] GbE bug on SCTRL fixed, causing the last word of last packet
 to get lost sometimes

---
 gbe_trb/protocols/trb_net16_gbe_response_constructor_SCTRL.vhd | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gbe_trb/protocols/trb_net16_gbe_response_constructor_SCTRL.vhd b/gbe_trb/protocols/trb_net16_gbe_response_constructor_SCTRL.vhd
index 667d141..467ceaf 100644
--- a/gbe_trb/protocols/trb_net16_gbe_response_constructor_SCTRL.vhd
+++ b/gbe_trb/protocols/trb_net16_gbe_response_constructor_SCTRL.vhd
@@ -554,7 +554,8 @@ begin
 		
 		when LOAD_TO_HUB =>
 			state <= x"4";
-			if (rx_fifo_q(17) = '1') then
+--			if (rx_fifo_q(17) = '1') then
+			if ((rx_fifo_q(17) = '1') and (GSC_INIT_READ_IN = '1')) then
 				if (reset_detected = '1') then
 					dissect_next_state <= CLEANUP;
 				else
-- 
2.43.0