lib.fifo: round up AsyncFIFO{,Buffered} depth to lowest valid value.
authorwhitequark <cz@m-labs.hk>
Mon, 23 Sep 2019 10:57:30 +0000 (10:57 +0000)
committerwhitequark <cz@m-labs.hk>
Mon, 23 Sep 2019 10:58:20 +0000 (10:58 +0000)
commit0452c2e3ecd32ee6d9c7dada179c86f02a0585be
treee7fed6fb78d7f8fffff310d6574c99b5b075d03e
parent8157b28da4fc1a74f8b0e3491625f5efa8e87b44
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