litex_sim: simplify a bit ethernet+etherbone.
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Sat, 20 Jun 2020 07:15:56 +0000 (09:15 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Sat, 20 Jun 2020 07:15:56 +0000 (09:15 +0200)
litex/tools/litex_sim.py

index c1d9866336d534cf3894b25ccc484dba735d293d..bd8c53674319291ae304fef4b125937e1236f60d 100755 (executable)
@@ -226,13 +226,12 @@ class SimSoC(SoCCore):
         #assert not (with_ethernet and with_etherbone)
 
         if with_ethernet and with_etherbone:
-            dw = 8
             etherbone_ip_address = convert_ip(etherbone_ip_address)
             # Ethernet PHY
             self.submodules.ethphy = LiteEthPHYModel(self.platform.request("eth", 0))
             self.add_csr("ethphy")
             # Ethernet MAC
-            self.submodules.ethmac = LiteEthMAC(phy=self.ethphy, dw=dw,
+            self.submodules.ethmac = LiteEthMAC(phy=self.ethphy, dw=8,
                 interface  = "hybrid",
                 endianness = self.cpu.endianness,
                 hw_mac     = etherbone_mac_address)
@@ -243,10 +242,10 @@ class SimSoC(SoCCore):
             self.add_csr("ethmac")
             self.add_interrupt("ethmac")
             # HW ethernet
-            self.submodules.arp = LiteEthARP(self.ethmac, etherbone_mac_address, etherbone_ip_address, sys_clk_freq, dw=dw)
-            self.submodules.ip = LiteEthIP(self.ethmac, etherbone_mac_address, etherbone_ip_address, self.arp.table, dw=dw)
-            self.submodules.icmp = LiteEthICMP(self.ip, etherbone_ip_address, dw=dw)
-            self.submodules.udp = LiteEthUDP(self.ip, etherbone_ip_address, dw=dw)
+            self.submodules.arp  = LiteEthARP(self.ethmac, etherbone_mac_address, etherbone_ip_address, sys_clk_freq, dw=8)
+            self.submodules.ip   = LiteEthIP(self.ethmac, etherbone_mac_address, etherbone_ip_address, self.arp.table, dw=8)
+            self.submodules.icmp = LiteEthICMP(self.ip, etherbone_ip_address, dw=8)
+            self.submodules.udp  = LiteEthUDP(self.ip, etherbone_ip_address, dw=8)
             # Etherbone
             self.submodules.etherbone = LiteEthEtherbone(self.udp, 1234, mode="master")
             self.add_wb_master(self.etherbone.wishbone.bus)