Skip to content

Wrong MAC address byte ordering #1

Description

@GeoffreyBultot

MAC addres byte ordering is wrong in the EEPROM_MAC module under device/eeprom.py.
Here is my observations: https://github.com/railnova/Litex-DataDiode/pull/13
And here is my fix: railnova@cd58d7c
The testbench could be updated according.

To simplify understanding, here is a diff with my changes:

diff --git a/regmap/devices/eeprom.py b/regmap/devices/eeprom.py
index 1e9ef89..b83a46a 100644
--- a/regmap/devices/eeprom.py
+++ b/regmap/devices/eeprom.py
@@ -105,7 +105,7 @@ class EEPROM_MAC(EEPROM_24):
                 NextValue(bytes_read, bytes_read + 1),
                 If(bytes_read != 0,
                     Case(bytes_read, {
-                        i + 1: [NextValue(eui.eui[i * 8 : i * 8 + 8], i2c_sink.data)]
+                        i + 1: [NextValue(eui.eui[(5-i) * 8 : (5-i) * 8 + 8], i2c_sink.data)]
                         for i in range(6)}),
                     NextState("READ_SETUP"),
                 ),

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions