The invention will now be described, by way of example only, by referring to the enclosed representations, wherein:
In order to improve comprehensibility of the figures, the same numbers will be maintained for the same functional blocks in subsequent figures.
The arrangement described herein is based on the usage of a Gray-code, which includes 2*N symbols for a FIFO memory having either an odd or an even number of FIFO memory lines N. Preferably, this Gray-code is obtained by a standard full Gray-code of log2(2*N) bits as can be seen in
In a preferred embodiment, the full Gray-coded symbols are obtained from the immediately preceding Gray-coded symbols (i.e. having N−1 bits) mirroring all values at a “Mirror line” (100) and then adding a column of zeros on the left for the original set of symbols and a column of ones for the mirrored symbols.
In
For a certain number of FIFO memory lines not necessarily all available Gray-coded symbols will be required. For instance, for the encoding of N=3 FIFO memory lines only 6 (2*N) Gray-Coded symbols are necessary, while 8 (23) Gray-coded symbols are available. In order to guarantee that only a single bit value changes in the case of “wrapping” from the last to the first Gray-coded symbol the central 2*N Gray coded symbols are selected. In that respect,
Those of skill in the art will appreciate that other methods for obtaining such Gray-code symbols can be used to provide 2N symbols with correct “wrapping” from the last to first element while respecting the rule of having only one single bit change.
In that respect, throughout this description (and, more to the point, in the claims that follow) reference will be repeatedly made to counts/counters being reset to the value 0 when the count/counter “reaches the value 2*N”. Those of skill in the art will promptly appreciate that the count/counter “reaching” the value 2*N will typically involve the count/counter switching directly from ((2*N)−1)) to 0, without the count/counter properly taking on the value 2*N.
A Gray-code counter, which provides the desired wrapping on these 2N symbols and that can be reset to an initial specific symbol is implemented and used in several instances of the FIFO memory control. It will be appreciated that Gray-code counters per se are well known in the art, which makes it unnecessary to provide a more detailed description herein, since any implementation of Gray-code counters will be generally satisfactory for the purposes of the arrangement described herein.
As indicated, the arrangement described herein has the primary aim of detecting the “FULL” and “EMPTY” conditions of FIFO memories by using a set of such Gray-code counters.
Instead of using N values to encode the current FIFO memory status, a total of 2*N values are used. In this way, the symbol at position J and the symbol at position (J+N) will represent the same memory location, but will be different symbols. This is important for detecting the FULL condition as will be explained in the following.
Generally, two Gray-code counters are used to initially hold the same value of one of the 2*N Gray-coded symbols. The first read Gray-code counter increments on each read operation, the second write Gray-code counter increments on each write operation.
The “EMPTY” condition can be obtained when the distance between the read counter and the write counter is equal to zero, in other words when the two counters hold the same value.
The “FULL” condition is obtained when the distance between the write counter and the read counter is equal to N (i.e. the FIFO memory contains N elements). In a preferred embodiment, in order to calculate the distance between the two wrapping Gray-code counters a comparison is performed between the value of one of the two counters respect to the value of the other counter increased by N. In this way, the fact that the two values are equal implies that the distance between the write and read counters was actually N and therefore the FIFO memory has to be considered as “FULL”.
In one embodiment the value is encoded with a third Gray-code counter initialized to symbols at position (J+N) and incremented either on a read or a write operation.
In another embodiment the value can be derived from 1-hot encoding the Gray-coded symbols and then using a shift of N bit to derive from the 1-hot encoded value of the symbol at position J the 1-hot encoded value of the symbol at position (J+N). Those of skill in the art will appreciate that other methods, not described explicitly herein, will permit to derive the value of the symbol at distance N providing the same effect.
In the embodiment of
A dual port FIFO memory 10 is used to synchronize a data flow. To that end, incoming data on a data-in bus DI will be recorded in a FIFO memory location pointed by a write-address counter 204 when a write-enable signal WE is active on a write clock W_CLK rising edge. Out-coming data on a data-out bus DO will reflect the value of the FIFO memory location pointed by the read-address counter 404.
Three counters are present in the write clock domain 20.
The write-address counter 204 is a simple binary counter, which counts from 0 to N−1 and then wraps again to zero each time the write-enable signal WE is active on a write clock W_CLK rising edge.
The second counter is a write Gray-code counter 202 and the last counter is a shifted write Gray-code counter 208. The write Gray-code counter 202 is initialized to the first Gray-coded symbol selected as Gray-code starting point (i.e. J), while the shifted write Gray-code counter 208 is initialized to the symbol at distance N (i.e. symbol at position J+N).
Both counters 202 and 208 are incremented each time a new value is written, i.e. each time the write-enable signal WE is active on a write clock W_CLK rising edge.
In the read clock domain 40 two counters are present. The read address counter 404 is a simple binary counter, which counts from 0 to N−1 and then wraps again to zero each time the read-enable signal RE is active on a read-clock R_CLK rising edge.
The second counter is a read Gray-code counter 402 initialized to the first Gray-coded symbol selected as Gray-code starting point (i.e. symbol J). The counter will be incremented each time a new value is read, i.e. each time the read-enable signal RE is active on a read clock R_CLK rising edge.
In order to generate the “EMPTY” flag the write Gray-code counter 202 is synchronized through a synchronization logic 406 that can be implemented in manner known per se e.g. by using a cascade of two or more flip-flops depending on the read clock R_CLK frequency and on the physical characteristic of the devices.
The synchronized value is then compared at 410 against the value of the read Gray-code counter 402. If the two values are equal then the “EMPTY” flag FE is asserted.
In order to generate the “FULL” flag FF the read Gray-code counter 402 is synchronized by using a synchronization logic 206. Typically, this is implemented using e.g. a cascade of two or more flip-flops depending on the write clock W_CLK frequency and on the physical characteristic of the devices used.
The synchronized value is then compared at 210 against the value of the shifted write Gray-code counter.
An alternative circuit for generating the FIFO “FULL” flag FF is shown in
In this case, the value of the shifted read Gray-code counter 408 is synchronized at 206 as explained in the foregoing and compared at 210 with the value of the write Gray-code counter 202. The “FULL” flag FE is asserted if the two values match.
It will be recalled that throughout the figures annexed and relating to different embodiments, the same references are used to indicate elements that are identical or equivalent: as a consequence, the description of these elements is not repeated for each embodiment.
In
This solution is preferred for small FIFO memories as it may increase the number of symbols to be decoded and thus become more complex than an embodiment with two independent read and write address counters 204, 404.
Specifically, in
In these embodiments, the write and read address pointers are Gray-coded, and they are preferably converted into binary signals. This can be achieved e.g. by using two Gray-code decoders.
A first Gray-code decoder 218 is used to decode the value of the write Gray-code counter 202 into the write address of the soft FIFO memory. Accordingly the second Gray-code decoder 418 is used to decode the value of the read Gray-code counter 402 into the read address of the soft FIFO memory.
In order to decode the write address into the memory location of a write operation, an address decoder 32 is used. This address decoder preferably lies in the write clock domain 20 and can be realized e.g. by a simple demultiplexer.
In order to decode the read-address into the memory location of a read operation, a second address decoder 34 is used. This address decoder preferably lies in the read clock domain 40 and can be realized e.g. by a simple multiplexer.
Those of skill in the art will appreciate that this Gray-code decoder 218, 418 and the address decoder 32, 34 may take the form of a single decoder, which decodes the respective Gray-coded values directly into the related memory locations.
In the embodiment of
A further possible embodiment is shown in
The 2*N Gray-coded symbols are encoded with the 1-hot encoding technique.
The first Gray-coded symbol of the given set of 2*N symbols will be mapped to the 2*N bit vector having the bit at position 0 set to ‘1’.
The subsequent Gray-coded symbols will be mapped to the vectors obtained by shifting to the left by one bit the previous 1-hot encoded vector.
Accordingly, the 1-hot encoded value of a Gray-coded symbol at distance N from a given Gray-coded symbol can be detected by shifting the 1-hot encoded value of the given Gray-coded symbol by N bit to the left.
With these premises, the “FULL” flag of the FIFO memory can be obtained by comparing at 210 the 1-hot encoded 212 value of the write Gray-code counter 202 shifted by N bit to the left 214 with the 1-hot encoded 216 value of the synchronizer 206 representative of the value of the read Gray-code counter 402.
Those of skill in the art will appreciate that this type of control can be applied also in the read-clock domain 40 following the same principles of the previous described alternative embodiments.
Of course, without prejudice to the underlying principles of the invention, the details and the embodiments may vary, even significantly, with respect to what has been described and illustrated, just by way of example, without departing from the scope of the invention as defined in the annexed claims.
Number | Date | Country | Kind |
---|---|---|---|
06116947.0 | Jul 2006 | EP | regional |