AxiStreamSource¶
Drives data, valid, and bound sidebands. Await initialise() before
sending. Supply a clock with literal 0 and 1 from before initialisation;
the source does not check clock values.
- class coaxi.AxiStreamSource[T = PayloadValue | None](
- bus: AxiStreamBus,
- clock: Signal,
- *,
- payload: Payload[T] | 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 adapter. Default
NoneselectsHandlePayload, or data-less access whendatais absent. A custom adapter requiresdata.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.
Run one send at a time. Adapter exceptions propagate unchanged, including
errors during initialise() or close().
set_pause_generator¶
- AxiStreamSource.set_pause_generator(pattern: Iterable[bool | int] | None = None) None¶
- Parameters:
pattern: Iterable[bool | int] | NoneTrueor1pauses;Falseor0allows a new transfer. 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 – A sequence contains a value other than
True,False,1, or0.
A pause delays the next assertion of valid. An offered transfer stays stable
until accepted, even if the pattern pauses again.
See Simulated backpressure for clock
timing, exhaustion, and iteration errors.
send¶
- async AxiStreamSource.send(
- data: T,
- *,
- last: bool | None = None,
- sidebands: AxiStreamSidebands | None = None,
- Parameters:
data: TPayload for one transfer. With the default adapter,
Nonerequires absentdata. Keep the value unchanged until completion.last: bool | NoneRequired explicit
boolwhenlastis bound; must beNoneotherwise. DefaultNone.sidebands: AxiStreamSidebands | NonePer-transfer metadata overrides. Default
Noneuses the source defaults on bound signals.
- Returns:
None, at the falling-edge cleanup after acceptance.- Raises:
TypeError – The metadata type is invalid.
ValueError –
lastselection or sideband values are invalid.EndpointStateError – The endpoint is unavailable or another operation is active.
ProtocolValueError – Sampled
readyor monitored reset is invalid.TransferReset – Reset, initialisation, or
close()interrupts the operation.
The source drives at a falling edge and keeps an offered beat stable until
acceptance. Without ready, the next rising edge accepts it. See
Handshake timing for consecutive calls.
Invalid last or metadata fails before starting work. Payload failures occur
during the operation and require recovery. Errors and cancellation can occur
after acceptance; check what the peer accepted before retrying.
send_frame¶
- async AxiStreamSource.send_frame(
- data: Sequence[T],
- *,
- sidebands: Sequence[AxiStreamSidebands] | None = None,
- Parameters:
data: Sequence[T]Non-empty sequence of payloads. Keep the sequence and its values unchanged until completion.
sidebands: Sequence[AxiStreamSidebands] | NoneParallel sequence with one metadata object per payload. Default
Noneuses defaults for every transfer. Keep the sequence and its values unchanged until completion.
- Returns:
None, at the final transfer’s falling-edge cleanup.- Raises:
TypeError – An input is not a sequence, or a metadata entry has the wrong type.
ValueError –
lastis absent, input is empty, lengths differ, or per-transfer metadata/identity is invalid.EndpointStateError – The endpoint is unavailable or another operation is active.
ProtocolValueError – Sampled
readyor monitored reset is invalid.TransferReset – Reset, initialisation, or
close()interrupts the frame.
Requires last and asserts it on the final transfer. The effective (id, dest)
stays constant and must be literal binary. Use individual send() calls to
interleave packets.
If the DUT can stall its input until its output is read, run the receive
concurrently. Waiting for send_frame() before starting recv_frame() can
deadlock. See Send and receive concurrently.
Wait for the frame to finish before starting another send. The source checks each beat before driving it; the peer may already have accepted earlier beats when a later one fails. Check the peer’s packet state before resuming traffic.
initialise¶
- async AxiStreamSource.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.
Interrupts active work, clears faults, and clears valid, last, payload,
and bound sidebands. Clearing occurs at the next falling edge without reset
monitoring, or at the first writable opportunity with it. Reset the DUT
separately.
With a reset pin, the first sample follows pending simulator writes. The call can finish while reset is asserted or the clock is stopped. Cancelling setup requires another call before sending.
wait_available¶
- async AxiStreamSource.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 source becomes available automatically
after the release interval. This call
does not check the peer’s ready or wait for a pending send. It reports any
recorded fault. Cancelling the wait leaves the source unchanged.
close¶
- async AxiStreamSource.close() None¶
- Returns:
None, after stopping monitoring and clearing source outputs at a falling edge.- Raises:
EndpointStateError – Initialisation or
close()is already active.
Invalidates pending work and clears local faults. Repeated calls are safe.
The endpoint stays closed after failure or cancellation, though output cleanup
may be incomplete. Explicit initialise() reopens it.