コード例 #1
0
def filter(pixels: Queue[Array[Uint[8], 3]], coef: Queue[Array[Fixp, 3]], *,
           window_num):

    window_cnt = replicate(when(coef['eot'], window_num), 3 * 3)

    mem_wr_data = czip(qcnt(coef, running=True, w_out=4, init=0),
                       coef) | flatten

    coef_rd = qrange(window_cnt['data']) \
        | flatten \
        | sdp(wr_addr_data=mem_wr_data, depth=16)

    pix_coef = czip(pixels, coef_rd) | reorder

    res = [dot(p) for p in pix_coef]

    return ccat(*res)
コード例 #2
0
def filter(pixels: Queue[Uint[8]], coef: Queue[Fixp], *, window_num):
    coef_t = coef.dtype.data
    accum_t = Fixp[coef_t.integer + 2, coef_t.width + 2]

    window_cnt = replicate(window_num, 3 * 3)

    mem_wr_data = czip(qcnt(coef, running=True, w_out=4, init=0),
                       coef) | flatten

    coef_rd = qrange(window_cnt['data']) \
        | flatten \
        | sdp(wr_addr_data=mem_wr_data, depth=16)

    return czip(pixels, coef_rd) \
        | queuemap(f=mul) \
        | accum(init=accum_t(0.0), cast=saturate) \
        | qround \
        | saturate(t=Uint[8])
コード例 #3
0
from pygears.lib import qcnt, check, drv
from pygears.typing import Uint, Queue

drv(t=Queue[Uint[4]], seq=[[1, 2, 3, 4, 5]]) \
    | qcnt(running=True) \
    | check(ref=[[1, 2, 3, 4, 5]])
コード例 #4
0
def test_lvl_2_cnt_more():
    qcnt(Intf(Queue[Uint[16], 3]), lvl=2, init=1)
コード例 #5
0
def test_lvl_2():
    qcnt(Intf(Queue[Uint[16], 3]), lvl=2)
コード例 #6
0
def test_lvl_1():
    qcnt(Intf(Queue[Uint[16], 3]))
コード例 #7
0
 def decoupled(din, *, lvl=0, init=0, w_out=16):
     return din | qcnt(init=init, lvl=lvl, w_out=w_out) | decouple
コード例 #8
0
def test_synth_yosys():
    qcnt(Intf(Queue[Uint[16], 3]))
コード例 #9
0
def test_synth_vivado():
    qcnt(Intf(Queue[Uint[16], 3]))