Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class FrequencyMeasurement(Module, AutoCSR):
- def __init__(self, pulse):
- self._period = CSRStatus(32)
- # # #
- # compute period (unit = sys_clk ticks)
- self.submodules.counter = counter = Counter(32)
- self.comb += [
- counter.ce.eq(1),
- counter.reset.eq(pulse)
- ]
- self.sync += [
- If(counter.reset,
- self._period.status.eq(counter.value)
- )
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement