diff --git a/litex/tools/litex_sim.py b/litex/tools/litex_sim.py index a83c40111..f78bafd7c 100755 --- a/litex/tools/litex_sim.py +++ b/litex/tools/litex_sim.py @@ -227,8 +227,9 @@ class SimSoC(SoCCore): hw_mac = etherbone_mac_address) # SoftCPU - self.add_memory_region("ethmac", self.mem_map.get("ethmac", None), 0x2000, type="io") - self.add_wb_slave(self.mem_regions["ethmac"].origin, self.ethmac.bus, 0x2000) + ethmac_region_size = (ethmac.rx_slots.constant + ethmac.tx_slots.constant)*ethmac.slot_size.constant + ethmac_region = SoCRegion(origin=self.mem_map.get("ethmac", None), size=ethmac_region_size, cached=False) + self.bus.add_slave(name="ethmac", slave=ethmac.bus, region=ethmac_region) if self.irq.enabled: self.irq.add("ethmac", use_loc_if_exists=True) # HW ethernet @@ -248,9 +249,10 @@ class SimSoC(SoCCore): dw = 64 if ethernet_phy_model == "xgmii" else 32, interface = "wishbone", endianness = self.cpu.endianness) + # Compute Regions size and add it to the SoC. ethmac_region_size = (ethmac.rx_slots.constant + ethmac.tx_slots.constant)*ethmac.slot_size.constant - self.add_memory_region("ethmac", self.mem_map.get("ethmac", None), ethmac_region_size, type="io") - self.add_wb_slave(self.mem_regions["ethmac"].origin, ethmac.bus, ethmac_region_size) + ethmac_region = SoCRegion(origin=self.mem_map.get("ethmac", None), size=ethmac_region_size, cached=False) + self.bus.add_slave(name="ethmac", slave=ethmac.bus, region=ethmac_region) if self.irq.enabled: self.irq.add("ethmac", use_loc_if_exists=True)