diff options
| author | Alejandro Soto <alejandro@34project.org> | 2024-05-18 09:13:11 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2024-05-24 05:58:41 -0600 |
| commit | 4cf5ed94a8767efd13265abcc20a5082acc02824 (patch) | |
| tree | 0a98aaac24245a8daf76d25e8161cd3c03acd2fb /tb/gfx_shader_bind/testbench/monitors.py | |
| parent | a3559d9e53100cd2d9c1e481ec81eeb90ca0ba5b (diff) | |
tb/gfx_shader_bind: initial commit
Diffstat (limited to 'tb/gfx_shader_bind/testbench/monitors.py')
| -rw-r--r-- | tb/gfx_shader_bind/testbench/monitors.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tb/gfx_shader_bind/testbench/monitors.py b/tb/gfx_shader_bind/testbench/monitors.py new file mode 100644 index 0000000..6ecea0f --- /dev/null +++ b/tb/gfx_shader_bind/testbench/monitors.py @@ -0,0 +1,30 @@ +import cocotb +from cocotb.triggers import ReadOnly, RisingEdge + +from cocotb_bus.monitors import BusMonitor + +from .data import FrontWave + +class FrontWaveMonitor(BusMonitor): + _signals = ['insn', 'group', 'retry', 'valid'] + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + async def _monitor_recv(self): + pkt_receiving = False + received_data = [] + + while True: + await RisingEdge(self.clock) + await ReadOnly() + + if not self.bus.valid.value: + continue + + wave = FrontWave( + group=self.bus.group.value.integer, + insn=(self.bus.insn.value.integer if not self.bus.retry.value else None), + ) + + self._recv(wave) |
