예제 #1
0
def test_random_constrained():
    skip_ifndef('SIM_SOCKET_TEST', 'RANDOM_TEST')

    cnt = 5

    # cons.append(randomize(T_CFG, 'cfg', cons=['cfg == 2']))

    stim = []
    stim.append(drv(t=T_DIN_SEP, seq=randomize(T_DIN_SEP, 'din', cnt=cnt)))
    stim.append(
        drv(t=T_CFG, seq=randomize(T_CFG, 'cfg', cons=['cfg < 20', 'cfg > 0'], cnt=cnt)))

    verif(*stim, f=clip, ref=clip(name='ref_model'))

    cosim('/clip', 'xsim', run=False)
    sim()
예제 #2
0
def drvrnd(*, t, cnt=None, cons=None, params=None):
    return drv(t=t,
               seq=randomize(t,
                             module().basename,
                             cnt=cnt,
                             cons=cons,
                             params=params))
예제 #3
0
def test_socket_rand_cons():
    skip_ifndef('SIM_SOCKET_TEST', 'RANDOM_TEST')

    cnt = 5

    cons = []
    cons.append(randomize(t_din, 'din', eot_cons=['data_size == 20']))
    cons.append(randomize(t_cfg, 'cfg', cons=['cfg < 20', 'cfg > 0']))

    stim = []

    stim.append(drv(t=t_din, seq=rand_seq('din', cnt)))
    stim.append(drv(t=t_cfg, seq=rand_seq('cfg', cnt)))

    verif(*stim,
          f=chop(sim_cls=partial(SimSocket, run=True)),
          ref=chop(name='ref_model'))

    sim(extens=[partial(SVRandSocket, cons=cons)])
예제 #4
0
def test_socket_rand_cons():
    skip_ifndef('SIM_SOCKET_TEST', 'RANDOM_TEST')

    cons = []
    cons.append(
        randomize(T_DIN,
                  'din',
                  eot_cons=['data_size == 50', 'trans_lvl1[0] == 4']))

    verif(drv(t=T_DIN, seq=rand_seq('din', 30)),
          f=qcnt(sim_cls=partial(SimSocket, run=True)),
          ref=qcnt(name='ref_model'))

    sim(extens=[partial(SVRandSocket, cons=cons)])
예제 #5
0
def test_socket_cosim_rand():
    skip_ifndef('SIM_SOCKET_TEST', 'RANDOM_TEST')

    din_num = 3

    cons = []
    for i in range(din_num):
        cons.append(randomize(T_DIN, f'din{i}', eot_cons=['data_size == 10']))

    stim = []
    for i in range(din_num):
        stim.append(drv(t=T_DIN, seq=rand_seq(f'din{i}', 30)))

    verif(*stim,
          f=qinterlace(sim_cls=partial(SimSocket, run=True)),
          ref=qinterlace(name='ref_model'))

    sim(extens=[partial(SVRandSocket, cons=cons)])
예제 #6
0
def test_open_rand_cons():
    skip_ifndef('VERILATOR_ROOT', 'SCV_HOME', 'RANDOM_TEST')

    cnt = 5

    cons = []
    # TODO : queue constraints not yet supported in SCVRand
    # cons.append(randomize(t_din, 'din', eot_cons=['data_size == 20']))
    cons.append(randomize(t_cfg, 'cfg', cons=['cfg < 20', 'cfg > 0']))

    stim = []

    din_seq = []
    for i in range(cnt):
        din_seq.append(list(range(random.randint(1, 10))))
    stim.append(drv(t=t_din, seq=din_seq))
    # stim.append(drv(t=t_din, seq=rand_seq('din', cnt)))
    stim.append(drv(t=t_cfg, seq=rand_seq('cfg', cnt)))

    verif(*stim, f=chop(sim_cls=SimVerilated), ref=chop(name='ref_model'))

    sim(extens=[partial(SCVRand, cons=cons)])