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)
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
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))
def delay(cycles): return delay_gen(f=perpetum(lambda x: x, cycles))