AxiStreamSink¶
Receives transfers and drives ready, when present. Await initialise()
before receiving. Supply a clock with literal 0 and 1 from before
initialisation; the sink does not check clock values.
- class coaxi.AxiStreamSink[T = PayloadValue | None](
- bus: AxiStreamBus,
- clock: Signal,
- *,
- payload: Payload[T] | None = None,
- buffer_capacity: int | None = None,
- reset: Signal | None = None,
- reset_active_high: bool = False,
- Parameters:
bus: AxiStreamBusValidated stream binding.
clock: SignalIndependent child name in the bus’s binding entity, or a one-bit logic handle.
payload: Payload[T] | NoneCustom synchronous snapshot adapter. Default
NoneselectsHandlePayload, or data-less access whendatais absent. A custom adapter requiresdata.buffer_capacity: int | NoneMaximum number of undelivered transfers without
ready. Positive integer, excludingbool; defaultNoneis unlimited. A finite value requires a bus withoutready.reset: Signal | NoneOptional mutable one-bit reset name or handle. Default
Nonedisables monitoring.reset_active_high: boolTruefor active-high,Falsefor active-low. DefaultFalse; must be abool.
- Returns:
None.
A sink with ready asserts it only while recv() or recv_frame() is
pending. If the DUT can stall its input until this sink receives its output,
run the send and receive concurrently.
Without ready, the sink captures transfers as soon as it becomes available,
even when no receive is pending. See Streams without ready
for capacity and overflow.
set_pause_generator¶
- AxiStreamSink.set_pause_generator(pattern: Iterable[bool | int] | None = None) None¶
- Parameters:
pattern: Iterable[bool | int] | NoneTrueor1pauses;Falseor0allows reception. A sequence is copied and repeated. Other iterables are consumed once. An empty sequence orNonedisables pausing.
- Returns:
None.- Raises:
TypeError – The pattern is neither iterable nor
None.ValueError –
readyis absent and the pattern is notNone, or a sequence contains an invalid value.
A pause holds ready low during pending receives. A sink requires ready to
stall the sender. See Simulated backpressure
for clock timing, exhaustion, and iteration errors.
recv¶
- async AxiStreamSink.recv() AxiStreamTransfer[T]¶
- Returns:
The next wire-order transfer snapshot. Absent
data,last, and sidebands areNone.- Raises:
EndpointStateError – The endpoint is unavailable or another operation is active.
ProtocolValueError – Sampled controls, reset, or literal byte-qualifier pairs are invalid.
OverflowError – Capture without
readyexceeds its capacity.TransferReset – Reset, initialisation, or
close()interrupts the receive.
The sink samples at the accepting rising edge and makes the transfer
available at the following falling edge. Without ready, a queued transfer
can return immediately.
recv() discards any unfinished packet for that transfer’s (id, dest).
An unresolved identity discards all unfinished packets. Payload and sideband
meta-values are returned as sampled. The sink samples valid when ready
is high or absent; sampled valid and accepted last must be literal 0 or
1. A capture error is raised before any queued transfer is returned.
recv_frame¶
- async AxiStreamSink.recv_frame(
- *,
- max_transfers: int | None = None,
- Parameters:
max_transfers: int | NonePositive integer limit per packet, including earlier unfinished prefixes;
boolis rejected. DefaultNoneallows any packet length.
- Returns:
A non-empty list of snapshots for the next completed packet, in its transfer order.
- Raises:
TypeError – The limit is not an integer or
None.ValueError –
lastis absent, the limit is not positive, or a packet reaches its limit withoutlast.ProtocolValueError – Controls, reset, qualifiers, or packet identifiers are invalid.
EndpointStateError – The endpoint is unavailable or another operation is active.
OverflowError – Capture without
readyexceeds its capacity.TransferReset – Reset, initialisation, or
close()interrupts assembly.
Requires last and literal binary packet identifiers. An unbound id or
dest counts as zero. recv_frame() returns whichever packet finishes
first and keeps other unfinished packets for later calls. A call that starts
part-way through a packet can return only its remaining transfers.
A packet ending at the configured limit succeeds. Reaching the limit with
last low raises after cleanup. A previously unfinished packet already at the
limit fails before consuming more snapshots. Any number of identities can be incomplete.
Use a simulation-time timeout. A fault or cancellation during reception
discards queued transfers and incomplete packets, stops capture, and requires
initialise(). Argument checks before reception leave queued traffic unchanged.
Adapter exceptions propagate unchanged. See Lifecycle and recovery
for reset and interruption.
initialise¶
- async AxiStreamSink.initialise() None¶
- Returns:
None, after local recovery and, if configured, starting reset monitoring.- Raises:
EndpointStateError – Initialisation or
close()is already active.ProtocolValueError – The monitored reset pin is invalid.
Invalidates pending work, discards queued transfers and incomplete packets,
clears faults, and clears ready. Without a reset pin, waits for a falling
edge. With a reset pin, the first sample follows pending simulator writes,
and the call can finish while reset is asserted or the clock is stopped.
The caller controls DUT reset. Cancelling setup requires another call
before receiving.
wait_available¶
- async AxiStreamSink.wait_available() None¶
- Returns:
None, when local setup and any reset-release interval have finished.- Raises:
EndpointStateError – Initialisation is required, or initialisation or
close()is in progress.ProtocolValueError – The monitored reset pin is invalid.
Call after initialise() and after deasserting reset, or let another task
release reset while this call waits. The sink becomes available automatically
after the release interval, starting
capture if ready is absent. This call does not wait for traffic or for a
pending receive. It reports any recorded fault. Cancelling the wait leaves
the sink unchanged.
close¶
- async AxiStreamSink.close() None¶
- Returns:
None, after capture and monitoring stop andreadyclears at a falling edge. Withoutready, completes immediately.- Raises:
EndpointStateError – Initialisation or
close()is already active.
Invalidates work and discards queued transfers, incomplete packets, and faults.
Repeated calls are safe. Explicit initialise() restarts the endpoint.
Failed or cancelled close() leaves it closed, though ready cleanup may be incomplete.