3 ms·
The queue length isn’t maintained by the queue counter. For a start, there are two queue counters - the write counter and the read counter, each of which is a t
by jameshart 3y ago
The queue length isn’t maintained by the queue counter. For a start, there are two queue counters - the write counter and the read counter, each of which is a two bit counter. Each points to one of the four positions in the queue.
The queue itself though can be in one of five states - its length can be 0, 1, 2, 3, or 4.
The difference between the position of the read and write counters (which is always available through the hardcoded XOR subtraction circuit detailed in the article) is either 0, 1, 2, or 3.
The flag allows you to tell whether the 0 result of that subtraction is a zero length queue or a full queue.