-
Notifications
You must be signed in to change notification settings - Fork 211
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
Implement almost_full and almost_empty for Synchronous FIFOs #294
base: master
Are you sure you want to change the base?
Conversation
migen/genlib/fifo.py
Outdated
def add_almost_full(self, hi_wm): | ||
self.almost_full = Signal() | ||
if hi_wm.bit_count() == 1: | ||
self.comb += self.almost_full.eq( | ||
reduce(or_, [level_i for level_i in self.level[log2_int(hi_wm):]])) | ||
else: | ||
self.comb += self.almost_full.eq(self.level >= hi_wm) | ||
|
||
def add_almost_empty(self, lo_wm): | ||
self.almost_empty = Signal() | ||
if lo_wm.bit_count() == 1: | ||
self.comb += self.almost_empty.eq( | ||
reduce(and_, [~level_i for level_i in self.level[log2_int(lo_wm):]]) | (self.level == lo_wm)) | ||
else: | ||
self.comb += self.almost_empty.eq(self.level <= lo_wm) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what those functions are supposed to do, in any case FIFOInterface isn't a Module and self.comb cannot be used there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are also definitely incorrect in the case of an asynchronous FIFO.
573e4cc
to
a960a08
Compare
migen/genlib/fifo.py
Outdated
if hi_wm.bit_count() == 1: | ||
self.comb += self.almost_full.eq( | ||
reduce(or_, [level_i for level_i in self.level[log2_int(hi_wm):]])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't Vivado handling this already?
a960a08
to
cadfd24
Compare
cadfd24
to
1694a08
Compare
Description
This PR introduces FIFO watermark configuration.
almost_full
is asserted.almost_empty
is asserted.