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
Add r_level
and w_level
to AsyncFIFO
#328
Comments
I'm not sure how an async FIFO with water marks works, CDC-wise. Do you have any references? |
As section 5.6 of http://www.sunburst-design.com/papers/CummingsSNUG2002SJ_FIFO1.pdf says, you compare against (ptr+N) instead of (ptr) as you would for empty/full. That section appears to be discussing FIFO style 1, but the same technique should be adaptable to FIFO style 2 with minor modifications. |
That means we have to Gray decode the resynchronized counters, right? Then it seems like we should rather have |
That makes sense, then we can always create a HWM/LWM wrapper as a utility module if we want to and it can work with any |
r_level
and w_level
to AsyncFIFO
In particular I think having a level is strictly more useful than watermarks (even configurable watermarks), if only for debugging. It's true that comparators are cheaper on architectures which have lookahead carry primitives, but I would say that it's the toolchain's job to simplify subtract-then-compare, since that's a fairly simple local transformation. |
I'll be honest, I missed |
Mark both read domain counters as reset-less, then synchronize write domain reset into read domain, On write domain reset, force empty flag and set read counters == write counters.
Mark both read domain counters as reset-less, then synchronize write domain reset into read domain, On write domain reset, force empty flag and set read counters == write counters.
It's often useful to have a "high watermark/low watermark" signal from a FIFO, particularly when processing any kind of fixed-length frames. This could be implemented as a wrapper around
SyncFIFO
pretty easily but probably wants to be more deeply integrated withAsyncFIFO
since there's already a clock-domain-crossing counter to use (which is not currently exposed to consumers).The text was updated successfully, but these errors were encountered: