add icmp_tb
[litex.git] / liteeth / test / model / mac.py
index f35288359376abd59de355dfd6802b2b15f73215..f18f499062f793a3d13f6157e30281520820013f 100644 (file)
@@ -88,13 +88,13 @@ class MAC(Module):
                self.phy = phy
                self.debug = debug
                self.loopback = loopback
-               self.tx_packets = []
-               self.tx_packet = MACPacket()
                self.rx_packet = MACPacket()
 
                self.ip_callback = None
                self.arp_callback = None
 
+               phy.set_mac_callback(self.callback)
+
        def set_ip_callback(self, callback):
                self.ip_callback = callback
 
@@ -106,7 +106,7 @@ class MAC(Module):
                        print_mac(">>>>>>>>")
                        print_mac(packet)
                packet.encode()
-               self.tx_packets.append(packet)
+               self.phy.send(packet)
 
        def callback(self, datas):
                packet = MACPacket(datas)
@@ -126,16 +126,6 @@ class MAC(Module):
                        else:
                                raise ValueError # XXX handle this properly
 
-       def gen_simulation(self, selfp):
-               self.tx_packet.done = True
-               while True:
-                       yield from self.phy.receive()
-                       self.callback(self.phy.packet)
-                       # XXX add full duplex
-                       if len(self.tx_packets) != 0:
-                               tx_packet = self.tx_packets.pop(0)
-                               yield from self.phy.send(tx_packet)
-
 if __name__ == "__main__":
        from liteeth.test.model.dumps import *
        errors = 0