gateware/ad9858: use WaitTimer from Migen

This commit is contained in:
Sebastien Bourdeauducq 2015-05-14 00:16:15 +08:00
parent fb8ccbd2a3
commit cbb5027343
1 changed files with 1 additions and 15 deletions

View File

@ -1,25 +1,11 @@
from migen.fhdl.std import * from migen.fhdl.std import *
from migen.genlib.fsm import * from migen.genlib.fsm import *
from migen.genlib.misc import WaitTimer
from migen.bus import wishbone from migen.bus import wishbone
from migen.bus.transactions import * from migen.bus.transactions import *
from migen.sim.generic import run_simulation from migen.sim.generic import run_simulation
class WaitTimer(Module):
def __init__(self, t):
self.wait = Signal()
self.done = Signal()
# # #
count = Signal(bits_for(t), reset=t)
self.comb += self.done.eq(count == 0)
self.sync += \
If(self.wait,
If(~self.done, count.eq(count - 1))
).Else(count.eq(count.reset))
class AD9858(Module): class AD9858(Module):
"""Wishbone interface to the AD9858 DDS chip. """Wishbone interface to the AD9858 DDS chip.