15
15
from cocotbext .ofm .ver .generators import random_packets
16
16
from cocotb_bus .drivers import BitDriver
17
17
from cocotb_bus .scoreboard import Scoreboard
18
+ from cocotbext .ofm .utils .throughput_probe import ThroughputProbe , ThroughputProbeMfbInterface
18
19
19
20
20
21
class testbench ():
@@ -32,6 +33,11 @@ def __init__(self, dut):
32
33
self .backpressure = BitDriver (dut .TX_DST_RDY , dut .CLK )
33
34
self .TX_MFB = MFBMonitor (dut , "TX" , dut .CLK , mfb_params = mfb_params )
34
35
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
+
35
41
# Create a scoreboard on the TX_MFB bus
36
42
self .expected_output = []
37
43
self .scoreboard = Scoreboard (dut )
@@ -74,4 +80,8 @@ async def run_test(dut, pkt_count=10000, frame_size_min=60, frame_size_max=512):
74
80
# print("RX: %d/%d" % (tb.RX_MFB.frame_cnt, pkt_count))
75
81
# print("TX: %d/%d" % (tb.TX_MFB.frame_cnt, pkt_count))
76
82
83
+ # logging values measured by throughput probe
84
+ tb .throughput_probe .log_max_throughput ()
85
+ tb .throughput_probe .log_average_throughput ()
86
+
77
87
raise tb .scoreboard .result
0 commit comments