示例#1
0
def rand_seq(name, cnt=None):
    randomizer = reg['sim/config/randomizer']
    dtype = randomizer.get_dtype_by_name(name)

    if typeof(dtype, Queue):
        yield from get_rand(name, cnt, perpetum(queue_rand_seq, dtype, name))
    else:
        yield from get_rand(name, cnt)
示例#2
0
def get_rand(name, cnt=None, rand_func=None):
    if rand_func is None:
        randomizer = reg['sim/config/randomizer']
        rand_func = perpetum(randomizer.get_rand, name)

    if cnt is not None:
        yield from islice(rand_func, cnt)
    else:
        yield from rand_func
示例#3
0
def delay_rng(start, stop):
    """Delays each input data for a random number of clock cycles which is chosen
    from a (start, stop) range.
    """
    return delay_gen(f=perpetum(random.randint, start, stop))
示例#4
0
def delay(cycles):
    return delay_gen(f=perpetum(lambda x: x, cycles))