From 101f8af015b0218479b63017f60682911ca7a00b Mon Sep 17 00:00:00 2001
From: Reinier van der Walle <walle@astron.nl>
Date: Wed, 9 Jun 2021 16:00:11 +0200
Subject: [PATCH] fixed IP checksum calculation

---
 libraries/io/eth/src/vhdl/eth_checksum.vhd | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libraries/io/eth/src/vhdl/eth_checksum.vhd b/libraries/io/eth/src/vhdl/eth_checksum.vhd
index bfe6208f70..aead4db3f1 100644
--- a/libraries/io/eth/src/vhdl/eth_checksum.vhd
+++ b/libraries/io/eth/src/vhdl/eth_checksum.vhd
@@ -150,7 +150,7 @@ BEGIN
                   sum;
   
   -- Accumulate the last carry
-  last_dat    <= sum(c_halfword_w-1 DOWNTO 0) + sum_cin;
+  last_dat    <= sum(c_halfword_w-1 DOWNTO 0) + sum_cin + word_sum_cin; -- Also add word_sum_cin in the case that the last word has a carry.
                     
   -- Checksum is 1-complement of the sum
   nxt_checksum     <= NOT(STD_LOGIC_VECTOR(last_dat)) WHEN prev_in_eop_dly='1' ELSE i_checksum;           
-- 
GitLab