Commit 32271a5b authored by Hejing Li's avatar Hejing Li
Browse files

eth.py: nic constructor generates eth interface

parent 8a5e54cb
...@@ -44,7 +44,7 @@ class EthSimpleNIC(base.Component): ...@@ -44,7 +44,7 @@ class EthSimpleNIC(base.Component):
def __init__(self, s: base.System) -> None: def __init__(self, s: base.System) -> None:
super().__init__(s) super().__init__(s)
self._ip = None self._ip = None
self._eth_if: EthInterface | None = None self._eth_if = EthInterface(self)
def add_ipv4(self, ip: str) -> None: def add_ipv4(self, ip: str) -> None:
assert self._ip is None assert self._ip is None
......
...@@ -30,7 +30,7 @@ class SimplePCIeNIC(pcie.PCIeSimpleDevice, eth.EthSimpleNIC): ...@@ -30,7 +30,7 @@ class SimplePCIeNIC(pcie.PCIeSimpleDevice, eth.EthSimpleNIC):
super().__init__(s) super().__init__(s)
def interfaces(self) -> list[base.Interface]: def interfaces(self) -> list[base.Interface]:
return [self.pci_if, self.eth_if] return [self._pci_if, self._eth_if]
def add_if(self, interface: eth.EthInterface | pcie.PCIeDeviceInterface) -> None: def add_if(self, interface: eth.EthInterface | pcie.PCIeDeviceInterface) -> None:
match interface: match interface:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment