Generators

class torii.lib.stream.simple.generator.ConstantStreamGenerator(data: bytes | bytearray | ~collections.abc.Sequence[int], data_width: int | None = None, max_length_width: int | None = None, endianness: ~typing.Literal['big', 'little'] = 'little', stream_type: type[~torii.lib.stream.simple.generator.T] = <class 'torii.lib.stream.simple.StreamInterface'>, domain: str = 'sync') None

A simple stream generator that constantly outputs fixed data into a receiving stream.

Parameters:
  • data (ConstData) – The constant data to be emitted from the stream.

  • data_width (int | None = None) – The width in bits of data. If not provided it will be taken from the ``StreamInterface``s width. (default: None)

  • max_length_width (int | None) – If provided, a max_length_width signal will be present that can limit the total length transmitted. (default: None)

  • endianness (Literal['big', 'little']) – If data is a bytes-like object, and data_width is more than 8 bits. (default: ‘little’)

  • stream_type (type) – The type of stream to create, must be either StreamInterface or a subtype there of. (default: torii.lib.stream.StreamInterface)

  • domain (str) – The clock domain in which the stream generator should be clocked. (default: ‘sync’)

Attributes:
  • start (Signal, in) – Input strobe to start the stream

  • done (Signal, out) – Output strobe indicating the transmission is completed

  • start_pos (Signal(range(len(data))), in) – The starting position within data. Latched when start is strobed.

  • max_length (Signal(max_length_width), in) – The maximum length of data to be sent in bytes. Must be >= len(data). By default this value is the length of data.

  • out_length (Signal(max_length_width), out) – Indicates the the total amount of data that has streamed out. Will always be less than max_len.

  • stream (stream_type, out) – The output data stream.

elaborate(platform: Platform | None) Module
Return type:

Module

Todo

Document Me

class torii.lib.stream.simple.generator.StreamSerializer(data_length: int, domain: str = 'sync', data_width: int = 8, stream_type: type[~torii.lib.stream.simple.generator.T] = <class 'torii.lib.stream.simple.StreamInterface'>, max_length_width: int | None = None) None

Serialize a small chunk of data into the given stream.

Parameters:
  • data_length (int) – The length of the data to be serialized and transmitted.

  • domain (str) – The clock domain this generator operates on.

  • data_width (int) – The width of the constant payload.

  • stream_type (type[T]) – The type of stream used, must be a SimpleStream or subclass thereof.

  • max_len_width (int | None) – If provided, the width of the max_len signal.

Attributes:
  • start (Signal) – An active high strobe that indicates when the stream should be started.

  • done (Signal) – An active high strobe that is generated when the transmission is completed.

  • data (Array) – The data that is to be sent out.

  • stream (T) – The stream interface being used to send the data.

  • max_len (Signal | Int) – The max length to be sent. Only settable if max_len_width is set, Otherwise is read-only.

elaborate(platform: Platform | None) Module
Return type:

Module

Todo

Document Me