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()
|
|
|
|
|