Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gen/genlib/misc: Add CE option to WaitTimer #1775

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rowanG077
Copy link
Contributor

@rowanG077 rowanG077 commented Sep 13, 2023

One nice thing this allows is pipelining and combining of multiple timers. For example imagine you need to have multiple timers that are relatively long. One option now is to create a base timer and then on every base timer done use that as the CE of the other timers.

This is now possible:

self.timer1 = timer1 = WaitTimer(10)
self.timer2 = timer2 = WaitTimer(5, has_ce=True)
self.timer3 = timer3 = WaitTimer(3, has_ce=True)

self.comb += [
    self.timer1.wait.eq(~self.timer1.done),
    self.timer2.wait.eq(~self.timer2.done),
    self.timer3.wait.eq(~self.timer3.done),
]

self.sync += [
    self.timer2.ce.eq(self.timer1.done),
    self.timer3.ce.eq(self.timer1.done),
]

timer2 will now done every 5*10 cycles and timer3 is now done every 3*10 cycles

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant