From: Florent Kermarrec Date: Thu, 12 Feb 2015 10:10:05 +0000 (+0100) Subject: cosmetic: define params before payload X-Git-Tag: 24jan2021_ls180~2604^2~24 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f03212a30d9f3ed86c7cbbc6fd5d7b9baaada4c9;p=litex.git cosmetic: define params before payload --- diff --git a/liteeth/common.py b/liteeth/common.py index cea70727..eff3b01b 100644 --- a/liteeth/common.py +++ b/liteeth/common.py @@ -157,11 +157,11 @@ def eth_mac_description(dw): return EndpointDescription(payload_layout, packetized=True) def eth_arp_description(dw): + param_layout = _layout_from_header(arp_header) payload_layout = [ ("data", dw), ("error", dw//8) ] - param_layout = _layout_from_header(arp_header) return EndpointDescription(payload_layout, param_layout, packetized=True) arp_table_request_layout = [ @@ -174,23 +174,23 @@ arp_table_response_layout = [ ] def eth_ipv4_description(dw): + param_layout = _layout_from_header(ipv4_header) payload_layout = [ ("data", dw), ("error", dw//8) ] - param_layout = _layout_from_header(ipv4_header) return EndpointDescription(payload_layout, param_layout, packetized=True) def eth_ipv4_user_description(dw): - payload_layout = [ - ("data", dw), - ("error", dw//8) - ] param_layout = [ ("length", 16), ("protocol", 8), ("ip_address", 32) ] + payload_layout = [ + ("data", dw), + ("error", dw//8) + ] return EndpointDescription(payload_layout, param_layout, packetized=True) def convert_ip(s): @@ -201,80 +201,80 @@ def convert_ip(s): return ip def eth_icmp_description(dw): + param_layout = _layout_from_header(icmp_header) payload_layout = [ ("data", dw), ("error", dw//8) ] - param_layout = _layout_from_header(icmp_header) return EndpointDescription(payload_layout, param_layout, packetized=True) def eth_icmp_user_description(dw): - payload_layout = [ - ("data", dw), - ("error", dw//8) - ] param_layout = _layout_from_header(icmp_header) + [ ("ip_address", 32), ("length", 16) ] - return EndpointDescription(payload_layout, param_layout, packetized=True) - -def eth_udp_description(dw): payload_layout = [ ("data", dw), ("error", dw//8) ] - param_layout = _layout_from_header(udp_header) return EndpointDescription(payload_layout, param_layout, packetized=True) -def eth_udp_user_description(dw): +def eth_udp_description(dw): + param_layout = _layout_from_header(udp_header) payload_layout = [ ("data", dw), ("error", dw//8) ] + return EndpointDescription(payload_layout, param_layout, packetized=True) + +def eth_udp_user_description(dw): param_layout = [ ("src_port", 16), ("dst_port", 16), ("ip_address", 32), ("length", 16) ] + payload_layout = [ + ("data", dw), + ("error", dw//8) + ] return EndpointDescription(payload_layout, param_layout, packetized=True) def eth_etherbone_packet_description(dw): + param_layout = _layout_from_header(etherbone_packet_header) payload_layout = [ ("data", dw), ("error", dw//8) ] - param_layout = _layout_from_header(etherbone_packet_header) return EndpointDescription(payload_layout, param_layout, packetized=True) def eth_etherbone_packet_user_description(dw): + param_layout = _layout_from_header(etherbone_packet_header) + param_layout = _remove_from_layout(param_layout, "magic", "portsize", "addrsize", "version") + param_layout += eth_udp_user_description(dw).param_layout payload_layout = [ ("data", dw), ("error", dw//8) ] - param_layout = _layout_from_header(etherbone_packet_header) - param_layout = _remove_from_layout(param_layout, "magic", "portsize", "addrsize", "version") - param_layout += eth_udp_user_description(dw).param_layout return EndpointDescription(payload_layout, param_layout, packetized=True) def eth_etherbone_record_description(dw): + param_layout = _layout_from_header(etherbone_record_header) payload_layout = [ ("data", dw), ("error", dw//8) ] - param_layout = _layout_from_header(etherbone_record_header) return EndpointDescription(payload_layout, param_layout, packetized=True) def eth_etherbone_mmap_description(dw): - payload_layout = [ - ("addr", 32), - ("data", dw) - ] param_layout = [ ("we", 1), ("count", 8), ("base_addr", 32), ("be", dw//8) ] + payload_layout = [ + ("addr", 32), + ("data", dw) + ] return EndpointDescription(payload_layout, param_layout, packetized=True)