Repository navigation
en guides protocols
Generic Drivers, Monitors, and Agents do not require ready/valid. Use these helpers only for interfaces that implement that protocol; other interfaces define acceptance in their own components.
from toffee import Bundle, ReadyValid, Role
producer = ReadyValid(
clock=dut.clock,
valid=dut.valid,
ready=dut.ready,
bits=Bundle(data=dut.data),
role=Role.PRODUCER,
name="request",
)Roles are from the testbench's perspective:
- PRODUCER drives valid/bits and observes ready.
- CONSUMER drives ready and observes valid/bits.
- MONITOR only observes.
ReadyValid.fire is a compiled Trigger sampled at DriveStable and supports persistent subscriptions.
ReadyValidMonitor captures an immutable payload at a fire candidate and delivers Transfer after confirmation at the corresponding rising edge. Its decoder receives a snapshot, not live pins. This differs from SamplingMonitor's direct capture at its supplied Trigger. See Monitor for lifecycle, delivery policy, and errors. Use drive_ready_valid inside a project SyncDriver or AsyncDriver subclass:
async def _drive_one(self, request):
return await drive_ready_valid(
self.port.clock, self.port.valid, self.port.ready,
lambda: self.port.bits.drive(request),
bits=self.port.bits,
)The subclass still declares its driven signals. The helper drives payload/valid at falling-stable,
waits for ready at DriveStable after same-phase writes settle, and deasserts valid after acceptance.
The drive callback must synchronously return None. bits= commits Picker Rise-mode payload before sampling,
including when ready depends on that payload. The helper also commits/deasserts Rise-mode valid.
There is no built-in ReadyValidDriver and no implicit ready/valid timing in generic Drivers.
Optional admit=lambda: bool(...) runs in the actual drive slot before encoding.
False performs no encoding or payload/valid write and retries next slot.
True is followed immediately by drive without an intervening await.
The callback must synchronously return bool; errors propagate to the send task.
Admission controls starting a request, not ready: once started, payload stays held until protocol acceptance.
The caller owns wait budgets and cancellation.
Decoupled aliases ReadyValid. flipped() creates an opposite-role view without copying or reconnecting signals. A role/direction mismatch fails during binding or acquisition of drive ownership.
内容由 CI 自动同步;请编辑主仓库文档。 Automatically synced by CI; edit the source documentation.
- 首页
- 教程
- 操作指南
- 参考
- 原理说明
- Home
-
Tutorials
- Learning path
- 0. Prepare your environment
- 1. Your first PASS and FAIL
- 2. Inputs and clocks
- 3. More cases and boundaries
- 4. Extract a Driver
- 5. Delayed output and a Monitor
- 6. Assemble an Agent
- 7. Models and the test environment
- 8. Pipelines, batches, and cancellation
- 9. Understand failures
- 10. Functional coverage
- Optional: out-of-order responses
- Optional: native clocks and project DUTs
-
How-to guides
- Find your task
- Simulation and events
- Verification components
- Coverage and regressions
- Migration and maintenance
- Runnable examples
- Reference
- Explanation