diff --git a/test/model/etherbone.py b/test/model/etherbone.py index af1f2c4..499a079 100644 --- a/test/model/etherbone.py +++ b/test/model/etherbone.py @@ -34,8 +34,8 @@ class Etherbone(Module): print_etherbone(">>>>>>>>") print_etherbone(packet) udp_packet = udp.UDPPacket(packet) - udp_packet.src_port = 0x1234 # XXX - udp_packet.dst_port = 20000 # XXX + udp_packet.src_port = 0x1234 # FIXME + udp_packet.dst_port = 0x1234 # FIXME udp_packet.length = len(packet) udp_packet.checksum = 0 self.udp.send(udp_packet) diff --git a/test/model/udp.py b/test/model/udp.py index 8ca6fc5..9057d1b 100644 --- a/test/model/udp.py +++ b/test/model/udp.py @@ -80,7 +80,7 @@ class UDP(Module): ip_packet.fragment_offset = 0 ip_packet.ttl = 0x80 ip_packet.sender_ip = self.ip_address - ip_packet.target_ip = 0x12345678 # XXX + ip_packet.target_ip = 0x12345678 # FIXME ip_packet.checksum = 0 ip_packet.protocol = udp_protocol self.ip.send(ip_packet) @@ -97,6 +97,6 @@ class UDP(Module): self.process(packet) def process(self, packet): - if packet.dst_port == 20000: + if packet.dst_port == 0x1234: # FIXME if self.etherbone_callback is not None: self.etherbone_callback(packet) diff --git a/test/test_etherbone.py b/test/test_etherbone.py index 2166b11..67787b4 100644 --- a/test/test_etherbone.py +++ b/test/test_etherbone.py @@ -14,6 +14,8 @@ from liteeth.frontend.etherbone import LiteEthEtherbone from test.model import phy, mac, arp, ip, udp, etherbone +from litex.gen.sim import * + ip_address = 0x12345678 mac_address = 0x12345678abcd @@ -28,16 +30,16 @@ class DUT(Module): self.submodules.etherbone_model = etherbone.Etherbone(self.udp_model, debug=False) self.submodules.core = LiteEthUDPIPCore(self.phy_model, mac_address, ip_address, 100000) - self.submodules.etherbone = LiteEthEtherbone(self.core.udp, 1234) + self.submodules.etherbone = LiteEthEtherbone(self.core.udp, 0x1234) self.submodules.sram = wishbone.SRAM(1024) - self.submodules.interconnect = wishbone.InterconnectPointToPoint(self.etherbone.master.bus, self.sram.bus) + self.submodules.interconnect = wishbone.InterconnectPointToPoint(self.etherbone.wishbone.bus, self.sram.bus) def main_generator(dut): - test_probe = True + test_probe = True test_writes = True - test_reads = True + test_reads = True # test probe if test_probe: @@ -47,24 +49,23 @@ def main_generator(dut): yield from dut.etherbone_model.receive() print("probe: " + str(bool(dut.etherbone_model.rx_packet.pr))) - for i in range(8): + for i in range(2): # test writes if test_writes: - writes_datas = [j for j in range(16)] - writes = etherbone.EtherboneWrites(base_addr=0x1000, - datas=writes_datas) + writes_datas = [j for j in range(4)] + writes = etherbone.EtherboneWrites(base_addr=0x1000, datas=writes_datas) record = etherbone.EtherboneRecord() - record.writes = writes - record.reads = None - record.bca = 0 - record.rca = 0 - record.rff = 0 - record.cyc = 0 - record.wca = 0 - record.wff = 0 + record.writes = writes + record.reads = None + record.bca = 0 + record.rca = 0 + record.rff = 0 + record.cyc = 0 + record.wca = 0 + record.wff = 0 record.byte_enable = 0xf - record.wcount = len(writes_datas) - record.rcount = 0 + record.wcount = len(writes_datas) + record.rcount = 0 packet = etherbone.EtherbonePacket() packet.records = [record] @@ -74,21 +75,20 @@ def main_generator(dut): # test reads if test_reads: - reads_addrs = [0x1000 + 4*j for j in range(16)] - reads = etherbone.EtherboneReads(base_ret_addr=0x1000, - addrs=reads_addrs) + reads_addrs = [0x1000 + 4*j for j in range(4)] + reads = etherbone.EtherboneReads(base_ret_addr=0x1000, addrs=reads_addrs) record = etherbone.EtherboneRecord() - record.writes = None - record.reads = reads - record.bca = 0 - record.rca = 0 - record.rff = 0 - record.cyc = 0 - record.wca = 0 - record.wff = 0 + record.writes = None + record.reads = reads + record.bca = 0 + record.rca = 0 + record.rff = 0 + record.cyc = 0 + record.wca = 0 + record.wff = 0 record.byte_enable = 0xf - record.wcount = 0 - record.rcount = len(reads_addrs) + record.wcount = 0 + record.rcount = len(reads_addrs) packet = etherbone.EtherbonePacket() packet.records = [record] @@ -103,7 +103,7 @@ def main_generator(dut): class TestEtherbone(unittest.TestCase): - def _test(self): # FIXME + def test_etherbone(self): dut = DUT() generators = { "sys" : [main_generator(dut)], diff --git a/test/test_icmp.py b/test/test_icmp.py index bdcb92a..ce867f0 100644 --- a/test/test_icmp.py +++ b/test/test_icmp.py @@ -17,6 +17,8 @@ from test.model.ip import * from test.model.icmp import * from test.model import phy, mac, arp, ip, icmp +from litex.gen.sim import * + ip_address = 0x12345678 mac_address = 0x12345678abcd diff --git a/test/test_ip.py b/test/test_ip.py index 744bb74..4b66371 100644 --- a/test/test_ip.py +++ b/test/test_ip.py @@ -13,6 +13,8 @@ from liteeth.core import LiteEthIPCore from test.model import phy, mac, arp, ip +from litex.gen.sim import * + ip_address = 0x12345678 mac_address = 0x12345678abcd diff --git a/test/test_mac_core.py b/test/test_mac_core.py index 46828ea..a7a8e89 100644 --- a/test/test_mac_core.py +++ b/test/test_mac_core.py @@ -13,6 +13,8 @@ from liteeth.mac.core import LiteEthMACCore from test.model import phy, mac +from litex.gen.sim import * + class DUT(Module): def __init__(self): diff --git a/test/test_mac_wishbone.py b/test/test_mac_wishbone.py index d5e08e1..65a542a 100644 --- a/test/test_mac_wishbone.py +++ b/test/test_mac_wishbone.py @@ -13,6 +13,8 @@ from liteeth.mac import LiteEthMAC from test.model import phy, mac +from litex.gen.sim import * + class WishboneMaster: def __init__(self, obj): diff --git a/test/test_model.py b/test/test_model.py index 39c672c..f1ece38 100644 --- a/test/test_model.py +++ b/test/test_model.py @@ -14,6 +14,7 @@ from test.model.udp import UDPPacket from litex.tools.remote.etherbone import * from test.model.etherbone import Etherbone +from litex.gen.sim import * class TestModel(unittest.TestCase): def test_mac(self): diff --git a/test/test_udp.py b/test/test_udp.py index 8272cf2..e83273b 100644 --- a/test/test_udp.py +++ b/test/test_udp.py @@ -13,6 +13,8 @@ from liteeth.core import LiteEthUDPIPCore from test.model import phy, mac, arp, ip, udp +from litex.gen.sim import * + ip_address = 0x12345678 mac_address = 0x12345678abcd