1
0
mirror of https://github.com/myhdl/myhdl.git synced 2025-01-24 21:52:56 +08:00
myhdl/scripts/benchmark/test_randgen.py

38 lines
797 B
Python
Raw Normal View History

2016-03-10 20:27:07 +01:00
import myhdl
2011-05-17 15:53:02 +02:00
from myhdl import *
from random_generator import random_generator
def test_randgen():
random_word = Signal(intbv(0)[31:])
enable = Signal(bool())
clock = Signal(bool())
reset = Signal(bool())
dut = random_generator(random_word, enable, clock, reset)
@instance
def stimulus():
enable.next = 0
clock.next = 0
reset.next = 0
yield delay(10)
reset.next = 1
yield delay(10)
reset.next = 0
enable.next = 1
for i in range(2**20):
yield delay(10)
clock.next = 1
yield delay(10)
clock.next = 0
2014-04-11 15:02:50 +02:00
print random_word
2011-05-17 15:53:02 +02:00
return dut, stimulus
if __name__ == '__main__':
tb = Simulation(test_randgen())
tb.run()