2013-04-24 13:13:36 -04:00
|
|
|
from random import Random
|
|
|
|
|
2015-09-12 07:34:07 -04:00
|
|
|
from migen import *
|
2013-04-24 13:13:36 -04:00
|
|
|
from migen.genlib.cdc import GrayCounter
|
|
|
|
|
2015-04-13 14:45:35 -04:00
|
|
|
|
2015-09-12 03:14:21 -04:00
|
|
|
def tb(dut):
|
|
|
|
prng = Random(7345)
|
|
|
|
for i in range(35):
|
|
|
|
print("{0:0{1}b} CE={2} bin={3}".format((yield dut.q),
|
|
|
|
flen(dut.q), (yield dut.ce), (yield dut.q_binary)))
|
|
|
|
yield dut.ce, prng.getrandbits(1)
|
|
|
|
yield
|
2013-04-24 13:13:36 -04:00
|
|
|
|
|
|
|
|
2014-01-26 16:19:43 -05:00
|
|
|
if __name__ == "__main__":
|
2015-09-12 03:14:21 -04:00
|
|
|
dut = GrayCounter(3)
|
|
|
|
Simulator(dut, tb(dut)).run()
|