Block-based Processing

class tiliqua.dsp.block.Block(shape)

data.StructLayout representing a ‘Block’ of samples.

shapeShape

Shape of the sample payload of elements in this block.

This is normally used in combination with stream.Signature, where valid, ready and payload.first are used to delineate samples inside. Blocks are transferred one sample at a time - a practical example with blocks of length 8:

                 |-- block 1 --| |-- block 2 --| |---
payload.sample:  0 1 2 3 4 5 6 7 8 A B C D E F G H I ...
payload.first:   -_______________-_______________-__
valid:           -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
ready:           (all ones)

Most cores here are assuming they are working with blocks of some predefined size - that is, each producer/consumer must expect the same size of Block.

Members:
  • first (unsigned(1)) – Strobe asserted for first sample in a block, deasserted otherwise.

  • sample (shape) – Payload of this sample in the block.

class tiliqua.dsp.block.WrapCore(*args, src_loc_at=0, **kwargs)

Wrap a streaming component with simple i, o streams such that it takes/emits Block streams (where payload.first is tracked).

This only supports simple cores that have:

  • An input stream i of type stream.Signature(shape)

  • An output stream o of type stream.Signature(shape)

A FIFO of size max_latency is used to track and propagate payload.first from the input to the output of the wrapped core. The wrapped core must never store more than max_latency elements in flight for this to work correctly.

Members:
  • i (In(stream.Signature(Block(self.shape_i)))) – Incoming blocks, where shape of block payload is inherited from the wrapped core.

  • o (In(stream.Signature(Block(self.shape_o)))) – Outgoing blocks, where shape of block payload is inherited from the wrapped core.

__init__(core, max_latency=16)
corewiring.Component

DSP core to be wrapped. shape_i and shape_o come from i.payload.shape() and o.payload.shape().

max_latencyint

Maximum amount of elements that may be in-flight inside the wrapped core.