Skip to content

Commit 6e8d6c9

Browse files
author
Ondrej Schwarz
committed
feat(cocotb - mfb_tools): add throughput probe to mfb pipe test
1 parent 1c854c4 commit 6e8d6c9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

comp/mfb_tools/flow/pipe/cocotb/cocotb_test.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from cocotbext.ofm.ver.generators import random_packets
1616
from cocotb_bus.drivers import BitDriver
1717
from cocotb_bus.scoreboard import Scoreboard
18+
from cocotbext.ofm.utils.throughput_probe import ThroughputProbe, ThroughputProbeMfbInterface
1819

1920

2021
class testbench():
@@ -32,6 +33,11 @@ def __init__(self, dut):
3233
self.backpressure = BitDriver(dut.TX_DST_RDY, dut.CLK)
3334
self.TX_MFB = MFBMonitor(dut, "TX", dut.CLK, mfb_params=mfb_params)
3435

36+
# setting up the probe measuring throughput
37+
self.throughput_probe = ThroughputProbe(ThroughputProbeMfbInterface(self.TX_MFB), throughput_units="bits")
38+
self.throughput_probe.add_log_interval(0, None)
39+
self.throughput_probe.set_log_period(10)
40+
3541
# Create a scoreboard on the TX_MFB bus
3642
self.expected_output = []
3743
self.scoreboard = Scoreboard(dut)
@@ -74,4 +80,8 @@ async def run_test(dut, pkt_count=10000, frame_size_min=60, frame_size_max=512):
7480
# print("RX: %d/%d" % (tb.RX_MFB.frame_cnt, pkt_count))
7581
# print("TX: %d/%d" % (tb.TX_MFB.frame_cnt, pkt_count))
7682

83+
# logging values measured by throughput probe
84+
tb.throughput_probe.log_max_throughput()
85+
tb.throughput_probe.log_average_throughput()
86+
7787
raise tb.scoreboard.result

0 commit comments

Comments
 (0)