link: add auto-check on link_tb

This commit is contained in:
Florent Kermarrec 2014-12-06 14:35:18 +01:00
parent 0f50eab880
commit f976b65cf1
1 changed files with 7 additions and 6 deletions

View File

@ -66,14 +66,14 @@ class LinkLogger(Module):
class TB(Module): class TB(Module):
def __init__(self): def __init__(self):
self.submodules.bfm = BFM(phy_debug=False, self.submodules.bfm = BFM(phy_debug=False,
link_random_level=50, transport_debug=True, transport_loopback=True) link_random_level=50, transport_debug=False, transport_loopback=True)
self.submodules.link_layer = SATALinkLayer(self.bfm.phy) self.submodules.link_layer = SATALinkLayer(self.bfm.phy)
self.submodules.streamer = LinkStreamer() self.submodules.streamer = LinkStreamer()
streamer_ack_randomizer = AckRandomizer(link_layout(32), level=50) streamer_ack_randomizer = AckRandomizer(link_layout(32), level=50)
self.submodules += streamer_ack_randomizer self.submodules += streamer_ack_randomizer
self.submodules.logger = LinkLogger() self.submodules.logger = LinkLogger()
logger_ack_randomizer = AckRandomizer(link_layout(32), level=80) logger_ack_randomizer = AckRandomizer(link_layout(32), level=50)
self.submodules += logger_ack_randomizer self.submodules += logger_ack_randomizer
self.comb += [ self.comb += [
Record.connect(self.streamer.source, streamer_ack_randomizer.sink), Record.connect(self.streamer.source, streamer_ack_randomizer.sink),
@ -86,12 +86,13 @@ class TB(Module):
for i in range(24): for i in range(24):
yield yield
for i in range(8): for i in range(8):
streamer_packet = LinkTXPacket([i for i in range(64)])
yield from self.streamer.send(LinkTXPacket([i for i in range(64)])) yield from self.streamer.send(LinkTXPacket([i for i in range(64)]))
yield from self.logger.receive() yield from self.logger.receive()
print("Logger:")
print("-------") # check results
for v in self.logger.packet: s, l, e = check(streamer_packet, self.logger.packet)
print("%08x" %v) print("shift "+ str(s) + " / length " + str(l) + " / errors " + str(e))
if __name__ == "__main__": if __name__ == "__main__":