Ejemplo n.º 1
0
async def serialize(din: Tuple[{
        'data': Any,
        'active': Uint
}]) -> Queue['din["data"][0]']:
    async with din as (data, active):
        for i, last in qrange(active):
            yield data[i], last
Ejemplo n.º 2
0
async def parallelize(din, *, t) -> b't':
    data = t()

    for i, last in qrange(len(t)):
        async with din as val:
            data[i] = val

    await clk()
    yield data
Ejemplo n.º 3
0
async def replicate(din: Tuple[{
        'length': Uint,
        'val': Any
}]) -> Queue['din["val"]']:
    """Replicates the input data. The ``length`` field of the :class:`Tuple`
    input type specifies the number of times the ``value`` field needs to be
    reproduced.

    Returns:
        A :class:`Queue` type where each element is equal to the ``value``
           input field and the `eot` signalizes the last replicated element.
    """
    async with din as (length, value):
        for i, last in qrange(length):
            yield (value, last)
Ejemplo n.º 4
0
 async def test() -> Queue[Uint[3]]:
     for i, last in qrange(4):
         yield i, last
Ejemplo n.º 5
0
async def serialize_plain(din) -> Queue['din[0]']:
    i = Uint[bitw(len(din.dtype) - 1)](0)

    async with din as val:
        for i, last in qrange(len(din.dtype)):
            yield val[i], last