Common

Implemented in pygears.common

sieve(din, *, key) → b'din[key]'

Outputs a slice of the din input interface. Can be instantiated with the slicing statement: din[key].

Parameters

key – A single key or a sequence of keys with which to slice the input interface.

Returns

A sliced interface

Which keys are exactly supported depends on the type of the din input interface, so checkout the __getitem__ method of the specific type. If for an example we have an interface of the type Uint[8]

din = Intf(Uint[8])

we could slice it using Python index operator to obtain a high nibble:

>>> din[4:]
Intf(Uint[4])

which outputs an interface of the type Uint[4]. The same would be achieved if the sieve gear were instantiated explicitly:

>>> sieve(din, key=slice(4, None, None))
Intf(Uint[4])
ccat(*din) → b'Tuple[din]'

Short for concat, combines multiple interfaces into a single interface whose type is a Tuple of the input interface types. One output data is formed by combining one data from each of the inputs:

din0 = Intf(Uint[8])
din1 = Intf(Uint[16])
>>> ccat(din0, din1)
Intf(Tuple[Uint[8], Uint[16]])