Intuity / forastero

Making cocotb testbenches that bit easier
http://forastero.intuity.io/
Apache License 2.0
24 stars 1 forks source link

Adding support for scoreboard filtering functions #20

Closed Intuity closed 5 months ago

Intuity commented 5 months ago

When you register a monitor, you can now provide a scoreboard_filter argument in order to transform/drop a transaction:

from copy import copy

class Testbench:
    def __init__(self, dut):
        ...
        self.register(
            "x_mon",
            StreamMonitor(...),
            scoreboard_filter=self.filter_x_mon
        )

    def filter_x_mon(self, component, event, transaction):
        masked = copy(transaction)
        masked.data &= 0x0000_FFFF
        return masked

You can also entirely drop a transaction by returning None from the filter function.

This PR also fixes an issue where if no channels of a filter funnel exist but all contain values, the scoreboard did not detect the early failure and just timed out.