"""
This type stub file was generated by pyright.
"""

from typing import Any, Optional
from ..hdl import *
from .._utils import final
from . import wiring

@final
class Signature(wiring.Signature):
    """Signature of a unidirectional data stream.

    .. note::

        "Minimal streams" as defined in `RFC 61`_ lack support for complex payloads, such as
        multiple lanes or packetization, as well as introspection of the payload. This limitation
        will be lifted in a later release.

        .. _RFC 61: https://amaranth-lang.org/rfcs/0061-minimal-streams.html

    Parameters
    ----------
    payload_shape : :class:`~.hdl.ShapeLike`
        Shape of the payload.
    always_valid : :class:`bool`
        Whether the stream has a payload available each cycle.
    always_ready : :class:`bool`
        Whether the stream has its payload accepted whenever it is available (i.e. whether it lacks
        support for backpressure).

    Members
    -------
    payload : :py:`Out(payload_shape)`
        Payload.
    valid : :py:`Out(1)`
        Whether a payload is available. If the stream is :py:`always_valid`, :py:`Const(1)`.
    ready : :py:`In(1)`
        Whether a payload is accepted. If the stream is :py:`always_ready`, :py:`Const(1)`.
    """
    def __init__(self, payload_shape: ShapeLike, *, payload_init: Any = ..., always_valid: bool=..., always_ready: bool=...) -> None:
        ...
    
    @property
    def always_valid(self) -> bool:
        ...
    
    @property
    def always_ready(self) -> bool:
        ...
    
    def __eq__(self, other) -> bool:
        ...
    
    def create(self, *, path: Optional[tuple[str | int, ...]] = ..., src_loc_at: int = ...) -> Interface:
        ...
    
    def __repr__(self) -> str:
        ...
    


@final
class Interface:
    """A unidirectional data stream.

    Attributes
    ----------
    signature : :class:`Signature`
        Signature of this data stream.
    """
    payload: Any
    valid: Value
    ready: Value
    def __init__(self, signature: Signature, *, path: Optional[tuple[str | int, ...]] = ..., src_loc_at: int =...) -> None:
        ...
    
    @property
    def signature(self) -> Signature:
        ...
    
    @property
    def p(self) -> Any:
        """Shortcut for :py:`self.payload`.

        This shortcut reduces repetition when manipulating the payload, for example:

        .. code::

            m.d.comb += [
                self.o_stream.p.result.eq(self.i_stream.p.first + self.i_stream.p.second),
                self.o_stream.valid.eq(self.i_stream.valid),
                self.i_stream.ready.eq(self.o_stream.ready),
            ]
        """
        ...
    
    def __repr__(self) -> str:
        ...
    


