test: finish etherbone_tb (simulator limitation removed)

This commit is contained in:
Florent Kermarrec 2016-03-23 09:48:02 +01:00
parent 87924c84e6
commit b7f3b3ef42
1 changed files with 14 additions and 14 deletions

View File

@ -16,12 +16,12 @@ mac_address = 0x12345678abcd
class TB(Module): class TB(Module):
def __init__(self): def __init__(self):
self.submodules.phy_model = phy.PHY(8, debug=True) self.submodules.phy_model = phy.PHY(8, debug=False)
self.submodules.mac_model = mac.MAC(self.phy_model, debug=True, loopback=False) self.submodules.mac_model = mac.MAC(self.phy_model, debug=False, loopback=False)
self.submodules.arp_model = arp.ARP(self.mac_model, mac_address, ip_address, debug=True) self.submodules.arp_model = arp.ARP(self.mac_model, mac_address, ip_address, debug=False)
self.submodules.ip_model = ip.IP(self.mac_model, mac_address, ip_address, debug=True, loopback=False) self.submodules.ip_model = ip.IP(self.mac_model, mac_address, ip_address, debug=False, loopback=False)
self.submodules.udp_model = udp.UDP(self.ip_model, ip_address, debug=True, loopback=False) self.submodules.udp_model = udp.UDP(self.ip_model, ip_address, debug=False, loopback=False)
self.submodules.etherbone_model = etherbone.Etherbone(self.udp_model, debug=True) 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.core = LiteEthUDPIPCore(self.phy_model, mac_address, ip_address, 100000)
self.submodules.etherbone = LiteEthEtherbone(self.core.udp, 20000) self.submodules.etherbone = LiteEthEtherbone(self.core.udp, 20000)
@ -32,16 +32,16 @@ class TB(Module):
def main_generator(dut): def main_generator(dut):
test_probe = True test_probe = True
test_writes = False test_writes = True
test_reads = False test_reads = True
# test probe # test probe
if test_probe: if test_probe:
packet = etherbone.EtherbonePacket() packet = etherbone.EtherbonePacket()
packet.pf = 1 packet.pf = 1
dut.etherbone_model.send(packet) dut.etherbone_model.send(packet)
yield from self.etherbone_model.receive() yield from dut.etherbone_model.receive()
print("probe: " + str(bool(self.etherbone_model.rx_packet.pr))) print("probe: " + str(bool(dut.etherbone_model.rx_packet.pr)))
for i in range(8): for i in range(8):
# test writes # test writes
@ -64,7 +64,7 @@ def main_generator(dut):
packet = etherbone.EtherbonePacket() packet = etherbone.EtherbonePacket()
packet.records = [record] packet.records = [record]
self.etherbone_model.send(packet) dut.etherbone_model.send(packet)
for i in range(256): for i in range(256):
yield yield
@ -88,10 +88,10 @@ def main_generator(dut):
packet = etherbone.EtherbonePacket() packet = etherbone.EtherbonePacket()
packet.records = [record] packet.records = [record]
self.etherbone_model.send(packet) dut.etherbone_model.send(packet)
yield from self.etherbone_model.receive() yield from dut.etherbone_model.receive()
loopback_writes_datas = [] loopback_writes_datas = []
loopback_writes_datas = self.etherbone_model.rx_packet.records.pop().writes.get_datas() loopback_writes_datas = dut.etherbone_model.rx_packet.records.pop().writes.get_datas()
# check resultss # check resultss
s, l, e = check(writes_datas, loopback_writes_datas) s, l, e = check(writes_datas, loopback_writes_datas)