lib.fifo: round up AsyncFIFO{,Buffered} depth to lowest valid value.
authorwhitequark <whitequark@whitequark.org>
Mon, 23 Sep 2019 10:57:30 +0000 (10:57 +0000)
committerwhitequark <whitequark@whitequark.org>
Mon, 23 Sep 2019 10:58:20 +0000 (10:58 +0000)
commitca6b1f2f1c750bbd8e450ca85c406fca3e5d3b72
treee7fed6fb78d7f8fffff310d6574c99b5b075d03e
parenta57b76fb5d854917c8015a95e3a015bc36bbae37
lib.fifo: round up AsyncFIFO{,Buffered} depth to lowest valid value.

Unless exact_depth=True is specified.

The logic introduced in this commit is idempotent: that is, if one
uses the depth of one AsyncFIFOBuffered in the constructor of another
AsyncFIFOBuffered, they will end up with the same depth. More naive
logic would result in an unbounded, quadratic growth with each such
step.

Fixes #219.
nmigen/lib/fifo.py
nmigen/test/test_lib_fifo.py