Address coding in asynchronous FIFO
The physical size of the RAM used inside the FIFO must be a power of 2 for the gray code scheme to work. The maximum depth of the FIFO as seen by external logic can still be limited to something less than 2N, but the actual read and write address counters will run through the full range of 0 through 2N - 1.