From 6d4430e2f533b2bcc3a44b5bb2565961d1ca8491 Mon Sep 17 00:00:00 2001
From: Frans Schreuder <fransschreuder@gmail.com>
Date: Mon, 20 Dec 2021 13:33:01 +0100
Subject: [PATCH] truncate/end data immediately when link is not enabled or not
 aligned. Also clear FrontEnd busy signal when this occurs

---
 sources/decoding/FullToAxis.vhd | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/sources/decoding/FullToAxis.vhd b/sources/decoding/FullToAxis.vhd
index 8950b8ec1..1484ae6db 100644
--- a/sources/decoding/FullToAxis.vhd
+++ b/sources/decoding/FullToAxis.vhd
@@ -179,7 +179,7 @@ begin
     if aresetn_240 = '0' then
       busy_240 <= '0';
     else
-      if LinkAligned_240 = '1' then
+      if LinkAligned_240 = '1' and PathEnable_240 = '1' then
         if FMdin(32) = '1' then
           if FMdin(7 downto 0) = Kchar_sob then
             busy_240 <= '1';
@@ -191,6 +191,8 @@ begin
             busy_240 <= FMdin(28); --Contains the busy state of the elink
           end if;
         end if;
+      else
+        busy_240 <= '0';
       end if;
     end if;
   end if;
@@ -216,8 +218,10 @@ begin
             cunk_contains_data := '0';
         end if;
     end if;
+    if LinkAligned_240 = '0' or PathEnable_240 = '0' then
+        invalidate_data <= cunk_contains_data;
+    end if;
     if LinkAligned_240 = '0' and chunk_busy = '1' then
-      invalidate_data <= cunk_contains_data;
       chunk_busy <= '0';
     end if;
     if LinkAligned_240 = '0' then
@@ -247,7 +251,7 @@ begin
       sop_error := '0';
       eop_error := '0';
     end if;
-    if s_axis_p2.tlast = '1' then
+    if s_axis_fifo.tlast = '1' then
       chunk_error_240 <= '0';
     end if;
   end if;
-- 
GitLab