예제 #1
0
파일: czip.py 프로젝트: jesseclin/pygears
async def zip_cat(*din) -> b'zip_type(din)':
    id_max_lvl, max_lvl = max(enumerate(din),
                              key=lambda p: p[1].dtype.lvl
                              if typeof(p[1].dtype, Queue) else 0)

    async with gather(*din) as dout:
        yield (din_data_cat_value(dout), dout[id_max_lvl].eot)
예제 #2
0
파일: verif.py 프로젝트: bogdanvuk/pygears
async def match_timing(*din) -> b'din':
    if any(not d.empty() for d in din):
        all_valid = all(not d.empty() for d in din)
        sim_assert(all_valid, f'not all inputs valid at the same time')

        async with gather(*din) as data:
            yield data

    await clk()
예제 #3
0
async def cart_cat(*din) -> b'cart_type(din)':
    async with gather(*din) as data:
        dout_data = []
        dout_eot = Unit()
        for d in data:
            if isinstance(d, Queue):
                dout_data.append(d.data)
                dout_eot = d.eot @ dout_eot
            else:
                dout_data.append(d)

        yield (dout_data, dout_eot)
예제 #4
0
async def ccat(*din) -> b'Tuple[din]':
    """Short for concatenate, combines multiple interfaces into a single interface
    whose type is a :class:`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]])

    """

    async with gather(*din) as dout:
        yield dout
예제 #5
0
async def cart_cat(*din, order=None) -> b'cart_type(din, order)':
    if order is None:
        order = range(len(din))

    async with gather(*din) as data:
        dout_data = []
        dout_eot = Unit()
        for o in order:
            d = data[o]
            # for d in data:
            if isinstance(d, Queue):
                dout_data.append(d.data)
                dout_eot = dout_eot @ d.eot
            else:
                dout_data.append(d)

        yield (dout_data, dout_eot)
예제 #6
0
 async def fixp_arith(x: Fixpnumber, y: Fixpnumber) -> Ufixp[6, 9]:
     async with gather(x, y) as data:
         yield (data[0] + data[1]) + (data[0] + data[1])
예제 #7
0
 async def add_real_part_module(x: TComplex, y: TComplex) -> b'x[0]':
     res: x.dtype[0] + y.dtype[0]
     async with gather(x, y) as data:
         res = add_real_part_func(data[0], data[1])
         yield code(res, x.dtype[0])