1
0
mirror of https://github.com/corundum/corundum.git synced 2025-01-30 08:32:52 +08:00

merged changes in eth

This commit is contained in:
Alex Forencich 2019-07-29 18:56:36 -07:00
commit f1024f72cb
5 changed files with 29 additions and 7 deletions

View File

@ -129,7 +129,6 @@ eth_phy_10g_rx_if_inst (
.serdes_rx_hdr(serdes_rx_hdr), .serdes_rx_hdr(serdes_rx_hdr),
.serdes_rx_bitslip(serdes_rx_bitslip), .serdes_rx_bitslip(serdes_rx_bitslip),
.rx_error_count(rx_error_count), .rx_error_count(rx_error_count),
.rx_bad_block(rx_bad_block),
.rx_block_lock(rx_block_lock), .rx_block_lock(rx_block_lock),
.rx_high_ber(rx_high_ber), .rx_high_ber(rx_high_ber),
.rx_prbs31_enable(rx_prbs31_enable) .rx_prbs31_enable(rx_prbs31_enable)

View File

@ -112,7 +112,6 @@ eth_phy_10g_rx_if_inst (
.serdes_rx_hdr(serdes_rx_hdr), .serdes_rx_hdr(serdes_rx_hdr),
.serdes_rx_bitslip(serdes_rx_bitslip), .serdes_rx_bitslip(serdes_rx_bitslip),
.rx_error_count(rx_error_count), .rx_error_count(rx_error_count),
.rx_bad_block(rx_bad_block),
.rx_block_lock(rx_block_lock), .rx_block_lock(rx_block_lock),
.rx_high_ber(rx_high_ber), .rx_high_ber(rx_high_ber),
.rx_prbs31_enable(rx_prbs31_enable) .rx_prbs31_enable(rx_prbs31_enable)

View File

@ -61,7 +61,6 @@ module eth_phy_10g_rx_if #
* Status * Status
*/ */
output wire [6:0] rx_error_count, output wire [6:0] rx_error_count,
output wire rx_bad_block,
output wire rx_block_lock, output wire rx_block_lock,
output wire rx_high_ber, output wire rx_high_ber,

View File

@ -135,6 +135,9 @@ class IPFrame(object):
def update_checksum(self): def update_checksum(self):
self.ip_header_checksum = self.calc_checksum() self.ip_header_checksum = self.calc_checksum()
def verify_checksum(self):
return self.ip_header_checksum == self.calc_checksum()
def build(self): def build(self):
if self.ip_length is None: if self.ip_length is None:
self.update_length() self.update_length()

View File

@ -156,13 +156,30 @@ class UDPFrame(object):
cksum = (cksum & 0xffff) + (cksum >> 16) cksum = (cksum & 0xffff) + (cksum >> 16)
return ~cksum & 0xffff return ~cksum & 0xffff
def calc_udp_checksum(self): def update_ip_checksum(self):
self.ip_header_checksum = self.calc_ip_checksum()
def verify_ip_checksum(self):
return self.ip_header_checksum == self.calc_ip_checksum()
def calc_udp_pseudo_header_checksum(self):
cksum = self.ip_source_ip & 0xffff cksum = self.ip_source_ip & 0xffff
cksum += (self.ip_source_ip >> 16) & 0xffff cksum += (self.ip_source_ip >> 16) & 0xffff
cksum += self.ip_dest_ip & 0xffff cksum += self.ip_dest_ip & 0xffff
cksum += (self.ip_dest_ip >> 16) & 0xffff cksum += (self.ip_dest_ip >> 16) & 0xffff
cksum += self.ip_protocol cksum += self.ip_protocol
cksum += self.udp_length cksum += self.udp_length
cksum = (cksum & 0xffff) + (cksum >> 16)
cksum = (cksum & 0xffff) + (cksum >> 16)
return cksum
def set_udp_pseudo_header_checksum(self):
if self.udp_length is None:
self.update_udp_length()
self.udp_checksum = self.calc_udp_pseudo_header_checksum()
def calc_udp_checksum(self):
cksum = self.calc_udp_pseudo_header_checksum()
cksum += self.udp_source_port cksum += self.udp_source_port
cksum += self.udp_dest_port cksum += self.udp_dest_port
cksum += self.udp_length cksum += self.udp_length
@ -177,16 +194,21 @@ class UDPFrame(object):
cksum = (cksum & 0xffff) + (cksum >> 16) cksum = (cksum & 0xffff) + (cksum >> 16)
return ~cksum & 0xffff return ~cksum & 0xffff
def update_ip_checksum(self):
self.ip_header_checksum = self.calc_ip_checksum()
def update_udp_checksum(self): def update_udp_checksum(self):
if self.udp_length is None:
self.update_udp_length()
self.udp_checksum = self.calc_udp_checksum() self.udp_checksum = self.calc_udp_checksum()
def verify_udp_checksum(self):
return self.udp_checksum == self.calc_udp_checksum()
def update_checksum(self): def update_checksum(self):
self.update_udp_checksum() self.update_udp_checksum()
self.update_ip_checksum() self.update_ip_checksum()
def verify_checksums(self):
return self.verify_ip_checksum() and self.verify_udp_checksum()
def build(self): def build(self):
if self.udp_length is None: if self.udp_length is None:
self.update_udp_length() self.update_udp_length()