-
Notifications
You must be signed in to change notification settings - Fork 589
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
Etherbone hybrid ip mac #1886
Etherbone hybrid ip mac #1886
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @trabucayre, this looks good. Can you just take into account the few comments? Can you also do a test with litex_sim --with-ethernet --with-etherbone
to ensure this is working and updated? (and update if not).
litex/soc/integration/soc.py
Outdated
@@ -41,6 +41,17 @@ def build_time(with_time=True): | |||
fmt = "%Y-%m-%d %H:%M:%S" if with_time else "%Y-%m-%d" | |||
return datetime.datetime.fromtimestamp(time.time()).strftime(fmt) | |||
|
|||
def add_ip_constants(soc, name, ip): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with add_mac_address_constants
, maybe rename to add_ip_address_constants
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
assert int(_ip[n]) < 256 | ||
soc.add_constant(f"{name}{n+1}", int(_ip[n])) | ||
|
||
def add_mac_address_constants(soc, name, mac_address): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a minimal check as for IP address to ensure mac address is < 2**48.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
litex/soc/integration/soc.py
Outdated
@@ -1803,6 +1808,9 @@ def add_ip_constants(name, ip): | |||
def add_etherbone(self, name="etherbone", phy=None, phy_cd="eth", data_width=8, | |||
mac_address = 0x10e2d5000000, | |||
ip_address = "192.168.1.50", | |||
ethernet_mac_address = 0x10e2d5000000, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid conflicting addresses as default value: 0x10e2d5000001
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
litex/soc/integration/soc.py
Outdated
@@ -1803,6 +1808,9 @@ def add_ip_constants(name, ip): | |||
def add_etherbone(self, name="etherbone", phy=None, phy_cd="eth", data_width=8, | |||
mac_address = 0x10e2d5000000, | |||
ip_address = "192.168.1.50", | |||
ethernet_mac_address = 0x10e2d5000000, | |||
ethernet_local_ip = "192.168.1.50", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid conflicting addresses as default value: 192.168.1.51
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
litex/soc/integration/soc.py
Outdated
@@ -1814,6 +1822,12 @@ def add_etherbone(self, name="etherbone", phy=None, phy_cd="eth", data_width=8, | |||
from liteeth.frontend.etherbone import LiteEthEtherbone | |||
from liteeth.phy.model import LiteEthPHYModel | |||
|
|||
# Parameters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably move these checks directly to the with_ethmac
section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
…to add_ip_address_constants, adding function to add MACADDRx constant
…/remote ip as parameters, sanity check when hybrid mode and adding ip/mac constants
11dad10
to
7f21104
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @trabucayre!
As mentionned in #1882 when
add_etherbone
is used in hybrid mode etherbone and ethernet must have 2 distinct MACsThis PR contains 3 commits:
add_ip_constant
is moved as an helper (to be used byadd_ethernet
andadd_etherbone
) and a new helper is added to defineMACADDRx
constantadd_etherbone
signature is updated to allows user to specify local/remote IP and mac address. 2 assert are used to check if etherbone and ethernet IPs/MACs are different. This commits also add constants for ethernet configuration