FPGA study notes _FPGA implementation of Gigabit Ethernet _ network layer (IP protocol)

FPGA study notes

1. FPGA implementation of Gigabit Ethernet_Network layer (IP protocol)

Network layer (IP protocol)

The IP protocol is the core protocol in the TCP/IP protocol. All TCP, UDP, ICMP, and IGMP data are transmitted in the format of IP datagrams. If an error occurs, the IP will lose the data, and then send the ICMP message to the source. IP datagrams can be received out of the order in which they were sent.

  • IP datagram format

Insert picture description here

  • IP datagram header

Insert picture description here

  • Calculation method of header checksum
  1. Set the checksum field to 0
  2. Divide the IP header into multiple units according to 16 bits. If the length is not a multiple of 16 bits, fill it with 0 bits to a multiple of 16 bits.
  3. Use one's complement addition operation for each unit (that is, the high overflow bit will be added to the low bit, and the high bit of one place is directly lost in the usual complement operation), and the one's complement of the obtained sum is filled into the checksum field
  • example:

Insert picture description here

  1. Checksum = 0x0000
  2. 0x4500+0x0032+0x0000+0x0000+0x4011+0xf965+0xc0a8+0x0002+0xc0a8+0x0003=0x2698
  3. 0x0002+0x0698=0x069a
    bit inverted: header checksum=~0x069a=0xf965

---- The content comes from the summary of Xiaomei Ge FPGA self-study notes^^

[Note]: Personal study notes, if there are any mistakes, please feel free to enlighten me. This is polite~~~


Guess you like

Origin blog.csdn.net/weixin_50722839/article/details/109904914