Network byte order problem in FPGA for network communication

Source: Internet
Author: User

Send character ABCD on PC software
Grab the bag on the shark

Receiving PIN analysis from FPGA network using Logic Analyzer

Data is received and stored in RAM with a bit width of 8bit
Read 32bitUDP data from RAM for

64636261

According to the above phenomenon,
Before there was an understanding deviation,
The so-called big-endian small end is a reading order different,
For UDP data segments, the data composition format is determined by both parties,
Only the head of the protocol, etc., is organized according to the big end, in order to communicate in different CPU systems,
For example, the above is the ABCD, then the UDP data segment is sent according to ABCD,
Data into the FPGA
stored in 8bit width of RAM (address small to large)
0x61
0x62
0x63
0x64
Nios Soft core CPU is also small end, so
When these 4 bytes are read to a 32bit unsigned variable
Like alt_u31 buff.
buff=0x64636261;
High address data placed at high level
If the buff is cast to (ALT_U8) Buff output
The output is 0x61, which is also a way to prove that Nios is a small end.

So overall, the network data is not really what the size of the end, the size of the end is only relative to the hardware CPU or network equipment,
That is, how the transmitted data is represented,

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Network byte order problem in FPGA for network communication

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.