Skip to content

Commit

Permalink
boards: digilent_nexys4ddr, kosagi_netv2, sipeed_tang_primer_20k: add…
Browse files Browse the repository at this point in the history
…ed eth_ip/remote_ip arg
  • Loading branch information
trabucayre committed Sep 13, 2024
1 parent 4604379 commit 3050716
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 16 deletions.
26 changes: 16 additions & 10 deletions litex_boards/targets/digilent_nexys4ddr.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ class BaseSoC(SoCCore):
def __init__(self, sys_clk_freq=75e6,
with_ethernet = False,
with_etherbone = False,
eth_ip = "192.168.1.50",
remote_ip = None,
with_led_chaser = True,
with_video_terminal = False,
with_video_framebuffer = False,
Expand Down Expand Up @@ -85,10 +87,10 @@ def __init__(self, sys_clk_freq=75e6,
self.ethphy = LiteEthPHYRMII(
clock_pads = self.platform.request("eth_clocks"),
pads = self.platform.request("eth"))
if with_ethernet:
self.add_ethernet(phy=self.ethphy)
if with_etherbone:
self.add_etherbone(phy=self.ethphy)
self.add_etherbone(phy=self.ethphy, ip_address=eth_ip, with_ethmac=with_ethernet)
elif with_ethernet:
self.add_ethernet(phy=self.ethphy, local_ip=eth_ip, remote_ip=remote_ip)

# Video ------------------------------------------------------------------------------------
if with_video_terminal or with_video_framebuffer:
Expand All @@ -109,22 +111,26 @@ def __init__(self, sys_clk_freq=75e6,
def main():
from litex.build.parser import LiteXArgumentParser
parser = LiteXArgumentParser(platform=digilent_nexys4ddr.Platform, description="LiteX SoC on Nexys4DDR.")
parser.add_target_argument("--sys-clk-freq", default=75e6, type=float, help="System clock frequency.")
parser.add_target_argument("--sys-clk-freq", default=75e6, type=float, help="System clock frequency.")
ethopts = parser.target_group.add_mutually_exclusive_group()
ethopts.add_argument("--with-ethernet", action="store_true", help="Enable Ethernet support.")
ethopts.add_argument("--with-etherbone", action="store_true", help="Enable Etherbone support.")
ethopts.add_argument("--with-ethernet", action="store_true", help="Enable Ethernet support.")
ethopts.add_argument("--with-etherbone", action="store_true", help="Enable Etherbone support.")
parser.add_target_argument("--eth-ip", default="192.168.1.50", help="Ethernet/Etherbone IP address.")
parser.add_target_argument("--remote-ip", default="192.168.1.100", help="Remote IP address of TFTP server.")
sdopts = parser.target_group.add_mutually_exclusive_group()
sdopts.add_argument("--with-spi-sdcard", action="store_true", help="Enable SPI-mode SDCard support.")
sdopts.add_argument("--with-sdcard", action="store_true", help="Enable SDCard support.")
sdopts.add_argument("--with-spi-sdcard", action="store_true", help="Enable SPI-mode SDCard support.")
sdopts.add_argument("--with-sdcard", action="store_true", help="Enable SDCard support.")
viopts = parser.target_group.add_mutually_exclusive_group()
viopts.add_argument("--with-video-terminal", action="store_true", help="Enable Video Terminal (VGA).")
viopts.add_argument("--with-video-framebuffer", action="store_true", help="Enable Video Framebuffer (VGA).")
viopts.add_argument("--with-video-terminal", action="store_true", help="Enable Video Terminal (VGA).")
viopts.add_argument("--with-video-framebuffer", action="store_true", help="Enable Video Framebuffer (VGA).")
args = parser.parse_args()

soc = BaseSoC(
sys_clk_freq = args.sys_clk_freq,
with_ethernet = args.with_ethernet,
with_etherbone = args.with_etherbone,
eth_ip = args.eth_ip,
remote_ip = args.remote_ip,
with_video_terminal = args.with_video_terminal,
with_video_framebuffer = args.with_video_framebuffer,
**parser.soc_argdict
Expand Down
8 changes: 7 additions & 1 deletion litex_boards/targets/kosagi_netv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class BaseSoC(SoCCore):
def __init__(self, variant="a7-35", sys_clk_freq=100e6,
with_pcie = False,
with_ethernet = False,
eth_ip = "192.168.1.50",
remote_ip = None,
with_led_chaser = True,
**kwargs):
platform = kosagi_netv2.Platform(variant=variant)
Expand Down Expand Up @@ -91,7 +93,7 @@ def __init__(self, variant="a7-35", sys_clk_freq=100e6,
self.ethphy = LiteEthPHYRMII(
clock_pads = self.platform.request("eth_clocks"),
pads = self.platform.request("eth"))
self.add_ethernet(phy=self.ethphy)
self.add_ethernet(phy=self.ethphy, local_ip=eth_ip, remote_ip=remote_ip)

# PCIe -------------------------------------------------------------------------------------
if with_pcie:
Expand All @@ -114,6 +116,8 @@ def main():
parser.add_target_argument("--variant", default="a7-35", help="Board variant (a7-35 or a7-100).")
parser.add_target_argument("--sys-clk-freq", default=100e6, type=float, help="System clock frequency.")
parser.add_target_argument("--with-ethernet", action="store_true", help="Enable Ethernet support.")
parser.add_target_argument("--eth-ip", default="192.168.1.50", help="Ethernet/Etherbone IP address.")
parser.add_target_argument("--remote-ip", default="192.168.1.100", help="Remote IP address of TFTP server.")
parser.add_target_argument("--with-pcie", action="store_true", help="Enable PCIe support.")
parser.add_target_argument("--driver", action="store_true", help="Generate PCIe driver.")
sdopts = parser.target_group.add_mutually_exclusive_group()
Expand All @@ -125,6 +129,8 @@ def main():
variant = args.variant,
sys_clk_freq = args.sys_clk_freq,
with_ethernet = args.with_ethernet,
eth_ip = args.eth_ip,
remote_ip = args.remote_ip,
with_pcie = args.with_pcie,
**parser.soc_argdict
)
Expand Down
18 changes: 13 additions & 5 deletions litex_boards/targets/sipeed_tang_primer_20k.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def __init__(self, toolchain="gowin", sys_clk_freq=48e6,
with_ethernet = False,
with_etherbone = False,
eth_ip = "192.168.1.50",
remote_ip = None,
eth_dynamic_ip = False,
dock = "standard",
**kwargs):
Expand Down Expand Up @@ -159,7 +160,12 @@ def __init__(self, toolchain="gowin", sys_clk_freq=48e6,
refclk_cd = None
)
if with_ethernet:
self.add_ethernet(phy=self.ethphy, dynamic_ip=eth_dynamic_ip, with_timing_constraints=False)
self.add_ethernet(phy=self.ethphy,
dynamic_ip = eth_dynamic_ip,
local_ip = eth_ip,
remote_ip = remote_ip,
with_timing_constraints = False
)
if with_etherbone:
self.add_etherbone(phy=self.ethphy, ip_address=eth_ip, with_timing_constraints=False)

Expand Down Expand Up @@ -209,10 +215,11 @@ def main():
parser.add_target_argument("--with-spi-flash", action="store_true", help="Enable SPI Flash (MMAPed).")
parser.add_target_argument("--with-video-terminal", action="store_true", help="Enable Video Terminal (HDMI).")
ethopts = parser.target_group.add_mutually_exclusive_group()
ethopts.add_argument("--with-ethernet", action="store_true", help="Add Ethernet.")
ethopts.add_argument("--with-etherbone", action="store_true", help="Add EtherBone.")
parser.add_target_argument("--eth-ip", default="192.168.1.50", help="Etherbone IP address.")
parser.add_target_argument("--eth-dynamic-ip", action="store_true", help="Enable dynamic Ethernet IP addresses setting.")
ethopts.add_argument("--with-ethernet", action="store_true", help="Add Ethernet.")
ethopts.add_argument("--with-etherbone", action="store_true", help="Add EtherBone.")
parser.add_target_argument("--eth-ip", default="192.168.1.50", help="Etherbone IP address.")
parser.add_target_argument("--remote-ip", default="192.168.1.100", help="Remote IP address of TFTP server.")
parser.add_target_argument("--eth-dynamic-ip", action="store_true", help="Enable dynamic Ethernet IP addresses setting.")
args = parser.parse_args()

soc = BaseSoC(
Expand All @@ -223,6 +230,7 @@ def main():
with_ethernet = args.with_ethernet,
with_etherbone = args.with_etherbone,
eth_ip = args.eth_ip,
remote_ip = args.remote_ip,
eth_dynamic_ip = args.eth_dynamic_ip,
dock = args.dock,
**parser.soc_argdict
Expand Down

0 comments on commit 3050716

Please sign in to comment.