shaiko
Advanced Member level 5
Hello,
I've seen many synchronous FIFO implementations that evaluate the "read_address = write_address" condition combinatoricly to determine full and empty flags.
This method is somewhat ambiguous as the expression is true for both full and empy conditions. That leads to the need of another variable to evalute the number of times that address warpage occurred.
My question. why not do it in the following way:
----------------------------------------------------------------
-- a full condition can be generated ONLY by a write action
if write_request = '1' and write_en = '1' then
if read_address = (write_addr + 1) mod depth then -- depth is an entity generic
full <= '1';
-- an empty condition can be generated ONLY by a read action
if read_request = '1' and read_en = '1' then
if write_address = (read_addr + 1) mod depth then
empty <= '1';
----------------------------------------------------------------
The above logic takes into consideration the reason to why now read_address = write_address.
This eliminates the ambiguity associated with a combinatorial comparation of read_address = write_address.
What do you think?
Any reason not to use this method instead?
I've seen many synchronous FIFO implementations that evaluate the "read_address = write_address" condition combinatoricly to determine full and empty flags.
This method is somewhat ambiguous as the expression is true for both full and empy conditions. That leads to the need of another variable to evalute the number of times that address warpage occurred.
My question. why not do it in the following way:
----------------------------------------------------------------
-- a full condition can be generated ONLY by a write action
if write_request = '1' and write_en = '1' then
if read_address = (write_addr + 1) mod depth then -- depth is an entity generic
full <= '1';
-- an empty condition can be generated ONLY by a read action
if read_request = '1' and read_en = '1' then
if write_address = (read_addr + 1) mod depth then
empty <= '1';
----------------------------------------------------------------
The above logic takes into consideration the reason to why now read_address = write_address.
This eliminates the ambiguity associated with a combinatorial comparation of read_address = write_address.
What do you think?
Any reason not to use this method instead?