tools/litex_sim: add ethernet local/remote-ip arguments.

This commit is contained in:
Florent Kermarrec 2020-02-15 14:01:46 +01:00
parent 18a9d4ff2f
commit aebaea7764
1 changed files with 24 additions and 17 deletions

View File

@ -266,6 +266,8 @@ def main():
parser.add_argument("--sdram-verbose-timing", action="store_true", help="Enable SDRAM verbose timing logging")
parser.add_argument("--with-ethernet", action="store_true", help="Enable Ethernet support")
parser.add_argument("--with-etherbone", action="store_true", help="Enable Etherbone support")
parser.add_argument("--local-ip", default="192.168.1.50", help="Local IP address of SoC")
parser.add_argument("--remote-ip", default="192.168.1.100", help="Remote IP address of TFTP server")
parser.add_argument("--with-analyzer", action="store_true", help="Enable Analyzer support")
parser.add_argument("--trace", action="store_true", help="Enable VCD tracing")
parser.add_argument("--trace-start", default=0, help="Cycle to start VCD tracing")
@ -301,7 +303,7 @@ def main():
soc_kwargs["sdram_verbose_timings"] = args.sdram_verbose_timing
if args.with_ethernet or args.with_etherbone:
sim_config.add_module("ethernet", "eth", args={"interface": "tap0", "ip": "192.168.1.100"})
sim_config.add_module("ethernet", "eth", args={"interface": "tap0", "ip": args.remote_ip})
# SoC ------------------------------------------------------------------------------------------
soc = SimSoC(
@ -313,6 +315,11 @@ def main():
**soc_kwargs)
if args.ram_init is not None:
soc.add_constant("ROM_BOOT_ADDRESS", 0x40000000)
if args.with_ethernet:
for i in range(4):
soc.add_constant("LOCALIP{}".format(i+1), int(args.local_ip.split(".")[i]))
for i in range(4):
soc.add_constant("REMOTEIP{}".format(i+1), int(args.remote_ip.split(".")[i]))
# Build/Run ------------------------------------------------------------------------------------
builder_kwargs["csr_csv"] = "csr.csv"