Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix endianness #176

Merged
merged 2 commits into from
Jul 25, 2019
Merged

Fix endianness #176

merged 2 commits into from
Jul 25, 2019

Conversation

mateusz-holenko
Copy link
Collaborator

This PR fixes two problems with endianness for little endian CPUs (like VexRiscv):

  • liteeth was configured to big endian and it was not possible to netboot in LiteX bios on VexRiscv,
  • uip was configured to big endian and it was not possible to telnet into the firmware on VexRiscv.

@@ -31,7 +31,7 @@ def __init__(self, platform, *args, **kwargs):
platform.request("eth_clocks"),
platform.request("eth"))
self.submodules.ethmac = LiteEthMAC(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite understand why LiteEthMAC needs to understand the cpu endianness? However it looks like that is something from upstream, not something you invented?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MAC converts 32-bit writes/reads to/from 8-bit streams so needs to know the endiannness to know in which order reading/storing the streams.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have detected the problems when testing the firmware on HW. Without setting the proper endianess, data read from liteeth buffers had each 4-byte chunk reverted, causing the software to fail to detect the proper type of packet and drop it in a process.

After realising what was going on, I tested the pure LiteX platform and it worked fine. Diffing them pointed to the endianness property (not set in LiteX-BuildEnv).

@mithro mithro merged commit a5e872a into timvideos:master Jul 25, 2019
@mateusz-holenko mateusz-holenko deleted the fix_endianness branch November 18, 2019 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants