Dual port buffer

Abstract: Circuitry is described for transferring information from a first timing environment to a second timing environment. The circuitry comprises a dual port RAM having a first port which is responsive to a first timing signal and a second port which is responsive to a second timing signal, a first control circuit which is responsive to the first timing signal, for controlling storage of data in the dual port RAM through the first port and for generating a control signal indicating that data is stored in the dual port RAM. The circuitry also comprises a synchroniser for synchronising the control signal to the second timing signal, and a second control circuit, which is responsive to the second timing signal and the synchronised control signal and is for controlling retrieval of stored data through the second port of the dual port RAM.

Description: The present invention relates to circuitry for transferring information across a clock boundary between different clock environments, and in particular such circuitry in which a dual port RAM is utilised. In single chip integrated circuits, especially those designed using synchronous design techniques, there are many applications where more than one clock is required. Consideration must be given to any control or data signals which pass from any one clock environment to any other clock environment. Consider a single bit of a data or control signal arriving from a first clock environment, at the input of a clocked storage element or latch of a second clock environment. Depending on the timing of a change in the single bit of the data or control signal (the timing of which is determined by the first clock environment), there are three possibilities as to whether the single bit of the data or control signal will be stored or "captured" in the clocked storage element of the second clock environment. The three cases are: i) If the data changes well before the significant clock edge of the second timing environment, then the data is captured and transferred to the latch output shortly after the clock edge of the second timing environment; ii) If the data changes just after the significant clock edge of the second timing environment, then there is no change to the latch output until the next clock edge of the second timing environment; or iii) If the data changes close to the significant clock edge of the second timing environment, then the data may be captured on that clock edge and transferred to the latch output shortly after the clock edge, or the data may not be captured without any change to the latch output until after the next clock edge of the second timing environment. Furthermore, there is a finite probability that the latch will enter a "meta-stable" condition where the data is not cleanly captured and the output is liable to change an undetermined time after the clock edge of the second timing environment. If the latch does enter the meta-stable condition described in (iii), then the delay before the output changes could be longer than one clock cycle depending on the clock frequencies and design of the latch. This means that the output of the latch is indeterminate, the output from successive latches in the design could also be indeterminate, and the collective state of the entire chip rapidly becomes indeterminate. The effects of metastability can never be completely removed, no matter what technology is used, since it is a fundamental principle of decision making. However, with reasonable design techniques, the probability of metastability propagating in an undesirable manner, can be reduced to an acceptable level. Such acceptable levels may range from the probability of one failure in a year to one failure in an entire product range in a century. This is even more important when there is no relationship between the two clocks and they are said to be asynchronous with respect to each other. Even if two clocks are running at nominally the same frequency, if they have been derived from independent sources then, however tight the tolerances on the frequencies are, the clocks are likely to be drifting with respect to each other. A known technique for passing a single bit of information between clock environments is to use a special latch which is designed to minimise the effects of metastability, commonly known as a synchroniser. If the time period for an acceptable probability of propagated metastability is longer than one clock cycle, then synchronisers are joined in series such that the output of the last synchroniser has an acceptable probability of failure. There are many techniques for passing control information between clock environments. The choice of technique depends on the ranges of the clock frequencies of the environments. The cost of the control synchronisation may be measured in terms of the delay, or latency, in passing the control information and in terms of the number of synchronisers involved. Typically the number of control signals passed across a clock environment boundary is minimised. In order to minimise the number of signals which have to pass through synchronisers, only a few control signals pass through the synchronisers and the remainder of the control signals are treated as data. A typical control signal passing in the same direction as the data across the clock boundary may indicate that the data is stable, and a typical control signal passing in the opposite direction may indicate the data has been accepted. If the data being passed across the clock environment boundary is stable when it is being clocked into the receiving clock environment, then it does not suffer from metastability and does not need to pass through synchronisers. However, the data must remain stable and not change from some time before the control signal indicates that the data is stable up until the control signal in the opposite direction, after it has passed through its synchroniser indicates that the data has been accepted. This means that the data must be stored and remain unchanged for many clocks cycles. If the desired data transfer rate is slower than this number of clock cycles, there is no problem. However, as is more usual, there may be new data arriving at every clock cycle. For every data bus width of data arriving at every clock cycle, it is possible to arrange the data arriving in several successive cycles to be stored and transferred across a significantly wider bus width. For example, if the width of the data bus is 8 bits, namely a byte, then each byte can be stored until there are 8 bytes, then these 8 bytes transferred across the clock boundary using a 64-bit bus for example. While the first 8 bytes are being held stable for transfer across the clock boundary, further bytes could be arriving. These further bytes have to be stored separately. For given data rates, the ranges of each of the clock frequencies, the delays of the synchronisers, and the overall latency of the control protocol used, it is possible to determine how much storage is necessary to support the maximum sustainable data rate. If the protocol latency is 8 cycles and the width of the data bus is 8 bits, then the width of the data bus crossing the clock boundary must be 64 bits. This 64 bits must be held in some storage so that it is stable whilst it is crossing the clock boundary. Thus the amount of storage required is: (Protocol Latency) x (bus width) Since new data, on the 8 bit bus, may continue to arrive while the 64 bits are being held stable for crossing the clock boundary, this new data must be stored somewhere, and thus the amount of storage required is: 2 x (Protocol Latency) x (bus width) A similar scheme is also required in the second clock environment. One 64 bits worth of buffering to capture the data passed across the boundary, and a second 64 bits of buffering to hold the data from the previous transfer being passed deeper into the second clock environment 8-bits at a time. Thus, the amount of storage required is modified to: 4 x (Protocol Latency) x (bus width) Furthermore, according to the protocol used, each synchroniser is a 1-bit data storage element, so the number of synchronisers is added to give the total storage required as: 4 x (protocol Latency) x (bus width) + synchronisers. There are a number of different schemes for implementing the protocol to guarantee safe transference of data across a clock boundary. However, in each case, there is a determined protocol latency and a large amount of data storage is required. In one prior art technique, data is stored in flip-flops prior to transmission across the clock boundary. A large number of flip-flops are needed to store the necessary volume of data, and such an arrangement is expensive in terms of the chip space consumed by the flip-flop circuits. It is thus an object of the present invention to provide a circuit and method for transferring data and control information between clock environments which minimize the circuitry needed and chip area consumed. Thus, according to the present invention there is provided circuitry for transferring information from a first timing environment to a second timing environment, comprising: a dual port RAM having a first port responsive to a first clock signal having a first clock speed and a second port responsive to a second clock signal having a second clock speed different from said first clock speed; a first control circuit, responsive to the first clock signal, for controlling storage of data in the dual port RAM through the first port, and for generating a control signal indicating that the data is stored in the dual port RAM; and a second control circuit, responsive to the second clock signal, for controlling retrieval of stored data through the second port of the dual port RAM, characterised by, a first synchroniser for synchronising the control signal to the second clock signal wherein the second control circuit is additionally responsive to the synchronised control signal; and a second synchroniser for synchronising a second control signal, generated by a second control circuit indicating that data has been retrieved from the dual port, to the first timing signal, wherein the first control circuit stores data in the dual port RAM responsive to the synchronised second control signal. A RAM cell is much smaller than a flip-flip cell, and thus the chip space consumed by a dual port RAM implementation is reduced over a flip-flop implementation for the same number of storage locations. Advantageously according to the present invention fewer storage locations are in any event required using a dual port RAM implementation. The invention also provides a method of transferring information from a first timing environment to a second timing environment, comprising the steps of: storing data in a dual port RAM through a first port thereof responsive to a first timing signal; generating a control signal, responsive to the first timing signal, indicating that data is stored in the dual port RAM; synchronising the control signal to a second timing signal; retrieving data from the dual port RAM through a second port thereof responsive to the second timing signal and the synchronised control signal; generating a second control signal, responsive to the second timing signal, indicating that data has been retrieved from the dual port RAM; and synchronising the second control signal to the first timing signal, wherein data is stored in the dual port RAM in dependence on the synchronised second control signal. Further embodiments of the invention are specified in the appended dependent claims. The control signal may be synchronised to the second timing signal by a plurality of synchronisers. Also, the second control signal may be synchronised to the second timing signal by a plurality of further synchronisers. The first and second timing signals may be first and second clock signals. The first and second timing signals may be derived from a common source. The phase relationship variance of first and second timing signals derived from the common source may be comparable or larger than the period of either timing signal. The first and second timing signals may be asynchronous with respect to each other. The first and second timing signals, asynchronous with respect to each other, may be asynchronous or isynchronous signals. For a better understanding of the present invention and to show how the same may be carried into effect, reference will now be made by way of example to the accompanying drawings in which: Figure 1 is a block diagram of a dual port buffer according to an exemplary embodiment of the present invention; and Figure 2 illustrates an implementation of the dual port buffer of Figure 1. Referring now to Figure 1 there is shown an exemplary embodiment of a dual port buffer according to the present invention. The dual port buffer includes a dual port RAM 2, a first access control circuit 4 and a second access control circuit 6. The first access control circuit 4 comprises a first state machine 8, first synchronisers 10, a first address incrementer 12 and a first buffer 14. The second access control circuit 6 comprises second syncrhonisers 16, a second state machine 18, a second address incrementer 20 and a second buffer 22. The first access control circuit 4, which operates in a first timing environment under the control of a clock signal CLK1, receives from a source on bus 52 data DATA1 to be transferred to a second timing environment. The data DATA1 may pass through the optional first buffer 14 for the purpose of boosting the electrical drive of the signals or for re-timing under the control of the clock signal CLK1. The first buffer 14 outputs the data as the signals DATAIN on bus 54. The first buffer 14 and second buffer 22 are optional. These buffers may be present for two reasons: 1. To electrically buffer the signals to present a low load to the source, or to provide sufficient drive into the destination. 2. To provide a timing adjustment (i.e. to re-time the signal) with respect to the clock, where for example the data arrives late in the cycle from the source, but is required early in the cycle by the destination. The first access control circuit 4 also receives from the source a control signal REQ1 on line 24 which the source outputs to indicate that there is valid data to be transferred to the second timing environment. The signal REQ1 forms an input to the first state machine 8. In response to the signal REQ1, the first state machine 8 controls the transfer of the data DATA1 into the dual port RAM 2. The first state machine 8 outputs a signal INC1 on line 48 to the first address incrementer 12, and the first address incrementer increments the address value ADDR1 on bus 44 to the dual port RAM. In this embodiment data to be transferred is stored in successive memory locations of the dual port RAM, such that for each block of data which is stored in the dual port RAM the first address incrementer 12 increments the storage address by one block. Thus, initially, the address to which the first address incrementer directs the data to be stored is an initial or base address. The first state machine 8 also outputs on bus 40 transmit control signals CONTROL1 to control the loading of the data into the selected address. Thus, under the control of the clock signal CLK1, the data DATAIN on bus 54 of the output of the first buffer is loaded into the dual port RAM at the selected address. Once the data to be transferred has been successfully loaded into the dual port RAM, the first state machine 8 outputs a signal GRANT1 on line 26 back to the source, thereby indicating to the source that the source may begin to send a further block of data on the DATA1 bus 52. Furthermore, when sufficient data has been loaded into the dual port RAM 2, the first state machine 8 sends a signal VALID on line 28 across the clock boundary to the second access control circuit 6. The signal VALID on line 28 is received by the second synchronisers 16 of the second access control circuit 6, and the synchronised output of the second syncrhonisers 16, being the signal VALID synchronised to the second clock signal CLK2, forms an input to the second state machine 18. In response to the synchronised signal VALID the second state machine 18 outputs control signals on the second control bus CONTROL2 42 to the dual port RAM 2, and outputs a signal INC2 on line 50 to the second address incrementer 20. This process is repeated according to how much data was transferred. Thus, the second state machine 18 controls the access of a data block stored in the dual port RAM at a location identified by the address ADDR2 on the address bus 46 output from the second address incrementer. As with the first address incrementer 12, in this preferred embodiment the second address incrementer, in its initial state, retrieves data blocks from a base address, and thereafter from successive address locations. Thus, the second address incrementer follows the first address incrementer such that data is first retrieved from the block to which data has first been written, and so on through successive memory access cycles. Thus the data block which has been stored in the dual port RAM by the first access control circuit 4 is output as DATAOUT on the data bus 56 and stored in the second buffer 22 under the control of the clock signal CLK2 on line 62. Once the data block has been successfully retrieved from the dual port RAM 2, the second state machine 18 sets a signal ACK on line 30 which is transferred to the first timing environment and the first access control circuit 4. The signal ACK is received by the first synchronisers 10, and the synchronised output thereof is input on line 32 to the first state machine 8. When the first state machine 8 receives the synchronised signal ACK on line 32 it indicates that there is further space in the dual port RAM for the first access control circuit to load data into. The second state machine 18 also outputs a signal REQ2 on line 36 to a destination circuit which the data is to be transferred to in the second timing environment, when the data block has been successfully accessed from the dual port RAM 2. This signal indicates that valid data is available on.the data bus 58 on the output of the second buffer 22. When the destination circuit receives the signal REQ2 it loads therein the data DATA2 on the bus 58 and once this is done returns a signal GRANT2 on line 38 to the second state machine 18, in response to which the second state machine 18 can, if further data blocks are available in the dual port RAM 2, access these data blocks and forward them to the destination circuit. In the embodiment of Figure 1, it is shown that the control protocol between the two timing environments is a single signal VALID in one direction from the first timing environment to the second timing environment, and a single signal ACK in the other direction from the second timing environment to the first timing environment. However, the particular protocol that is used to control the flow of data across the timing boundary may vary considerably according to the desired application, the volume of flow of data, and the relative speeds of the two clocks of the respective timing environment. For instance, if the clock signal CLK2 in the second timing environment was much faster than the clock signal CLK1 in the first timing environment, then it is possible that the return signal of the protocol described with reference to Figure 1, i.e. the signal ACK on line 30 could be dispensed with. However, to successfully operate such a system where there would be a single flow control signal in one direction only, i.e. the signal VALID on line 28, it would be necessary to know that the dual port buffer was going to be used in an environment where the two clocks had significantly different speeds. It can also be appreciated that the flow control signals according to the protocol of Figure 1, rather than being the signal signals VALID and ACK in each direction, could in fact be comprised of a plurality of signals, the flow control protocol being more complex. If the flow control signals in either direction comprised a plurality of signals, then each of such signals would have synchronisers such as the synchronisers 10 and 16 associated therewith. Each of the plurality of control signals may have one or more synchronisers, in series, associated therewith. Depending on the protocol used, even if the control signals in both directions comprise a plurality of control signals, the number of signals in each direction may differ, for example if a different protocol is being used in each direction, or be the same. Furthermore, either or both edges of any one of the control signals used may be active edges. In particular, in one envisaged embodiment the dual port RAM 2 could be split into two halves, and each of the signals VALID and ACK could comprise two signals, one associated with the top half of the dual port RAM 2 and the other associated with the bottom half of the dual port RAM 2. The dual port buffer described hereinabove transfers data or information in one direction only from a first clock environment to a second clock environment. In order to allow the transfer of data in the other direction from the second clock environment to the first clock environment it is necessary to provide a second dual port buffer. Referring now to Figure 2, there is shown such an implementation where the exemplary dual port buffer described hereinabove with reference to Figure 1 is shown duplicated for use for transmitting data to and from a system environment. Figure 2 illustrates the use of the dual port buffer of Figure 1, in two instances, as an interface between, firstly, on-chip functional circuitry operating in a clock environment determined by various on-chip requirements and means, and, secondly, an off-chip data source and data sink each having separate clocks determined by off-chip requirements and possibly off-chip means. Referring to Figure 2 the system environment is generally designated as 78, and there is also shown therein a receive interface driver 70, a receive dual port buffer 74, a transmit dual port buffer 76 and a transmit interface driver 72. Each of the receive dual port buffer 74 and transmit dual port buffer 76 are, in the preferred embodiment, identical to the dual port buffer described hereinabove with reference to Figure 1. The system environment 78 may include a central processor unit, a digital signal processor, or some form of specific logic circuitry. The receive interface driver 70 receives data RXDATA on a bus 82 and protocol control signals RXCONTROL on lines 80 from a source. Under the control of a receive clock RXCLK on line 98 the receive interface driver 70 transfers the data from the source on the bus 82 to the bus 88 as data RXDATA1. As will be understood and in line with normal flow control protocol techniques, when the data is transferred to the bus 88 then the receive interface driver 70 sends flow control signals on the signals RXCONTROL on line 80 back to the source to indicate that the data has been received. The data output by the receive interface driver 70 on bus 88 as RXDATA1 is output simultaneously with the signal RX on line 84 which, as discussed hereinabove with reference to Figure 1, is a protocol control signal. The receive dual port buffer 74 then transfers the data RXDATA1 on bus 88 from the clock environment of the clock signal RXCLK to the system clock environment on the data bus RXDATA2 on bus 94. Thus the receive dual port buffer is clocked by the receive clock RXCLK and also a system clock SYSCLK on line 96. The data RXDATA2 on the bus 94 is synchronised to the system clock SYSLCK and received in the system environment 78. Similarly, in the reverse direction, the system environment outputs data TXDATA1 on bus 112 under the control of the system clock SYSCLK for transmission in a different clock environment on bus TXDATA2 on bus 106. The data TXDATA2 on bus 106 corresponds directly to the data TXDATA1 on bus 112 but is synchronised to a transmit clock TXCLK on line 100. Again, the transmit dual port buffer 76 operates in identical fashion to that described with reference to Figure 1. Again, the data TXDATA2 on bus 106 is transmitted by the transmit interface driver 72 onto bus 102 as TXDATA for transmission to a destination circuit. The control of the TXDATA on bus 102 from the transmit interface driver 72 is controlled by protocol control signals TXCONTROL on lines 104. The destination circuits and source circuits may be on-chip or off-chip. In addition both the receive interface driver 70 and the transmit interface driver 72 may interface with a plurality of source and destination circuits. The receive interface driver may include polling circuitry for determining the priority of a source attempting to send data to the system environment 78, and the protocol control signals RXCONTROL on lines 80 may include control signals for polling various sources. Similarly, the transmit interface driver 72 may include polling circuitry for determining the destination of the data to be transmitted, and for transmitting data to the destination having highest priority. The receive interface driver 70 and the transmit interface driver 72 may also include interrupt circuitry, such that if data being buffered therein for either transmission to or transmission from the system environment has a higher priority in terms of the address of its source or destination than other buffered data, then the data associated with the highest priority source/destination is transmitted first. The system environment may comprise cell engines (in respect of which reference is made to The ATM Forum, Technical Committee. Utopia, An ATM-PHY Interface Specification, Level 2 Version 1.0 21 November 1996. AF-PHY-0039.000 Editors: Des YOUNG et al. ALANTEC, 70 Plumeria Drive, An Jose, CA 95134-2134), and may interface directly to individual devices via a plurality of receive and transmit dual port buffers. The dual port buffers may interface to a data-strobe serial link according to IEEE 1355, a central processor unit, or another system environment. The dual port buffers may also interface the system environment to a SDRAM. All of the logic of the dual port buffer outside of the dual port RAM is fully scan testable. In addition, the dual port RAM is preferably fully accessible by one of the timing environments such that the dual port RAM may be tested for production purposes using a function test as opposed to a structural scan test or a built in self-test engine, which may be expensive to implement for a small dual port RAM. Any sort of structure test of the dual port RAM may be implemented.

Claims: Circuitry for transferring information from a first timing environment to a second timing environment, comprising: a dual port RAM (2) having a first port (54) responsive to a first clock signal (60) having a first clock speed and a second port (56) responsive to a second clock signal (62) having a second clock speed different from said first clock speed; a first control circuit (4), responsive to the first clock signal (60), for controlling storage of data in the dual port RAM (2) through the first port (54), and for generating a control signal (28) indicating that the data is stored in the dual port RAM (2); and a second control circuit (6), responsive to the second clock signal (62), for controlling retrieval of stored data through the second port (56) of the dual port RAM (2), characterised by , a first synchroniser (16) for synchronising the control signal (28) to the second clock signal (62) wherein the second control circuit is additionally responsive to the synchronised control signal; and a second synchroniser (10) for synchronising a second control signal (30), generated by a second control circuit (6) indicating that data has been retrieved from the dual port, to the first timing signal, wherein the first control circuit stores data in the dual port RAM responsive to the synchronised second control signal. Circuitry according to claim 1, further comprising a receive buffer (22), wherein the second control circuit transfers data retrieved from the dual port RAM into the receive buffer. Circuitry according to claim 1 or 2, further comprising a first buffer (14), wherein the first control circuit transfers data to be stored in the dual port RAM from the first buffer. Circuitry according to any one of claims 1 to 3, wherein the first control circuit includes a first address incrementer (12), data being stored in successive memory locations of the dual port RAM. Circuitry according to claim 4, wherein the second control means includes a second address incrementer (20), data being retrieved from successive memory locations of the dual port RAM. Circuitry according to claim 5, wherein the first and second address incrementers are cyclical. Circuitry according to any one of claims 1 to 6, wherein the control signal is synchronised to the second timing signal by a plurality of the synchronisers in series. Circuitry according to any one of claims 1 to 6, wherein the first control circuit generates a plurality of control signals, the synchroniser being one of a plurality of synchronisers each associated with a respective one of the plurality of control signals for synchronising the respective control signals to the second timing signal. Circuitry according to claim 8, wherein each control signal is synchronised to the second timing signal by a plurality of synchronisers in series. Circuitry according to any preceding claim, wherein the second control signal is synchronised to the first timing signal by a plurality of second synchronisers in series. Circuitry according to claim 9, wherein the second control circuit generates a plurality of second control signals, the second synchronisers being one of a plurality of second synchronisers each associated with a respective one of the plurality of second control signals for synchronising the respective second control signals to the first timing signal. Circuitry according to claim 11, wherein each second control signal is synchronised to the first timing signal by a plurality of second synchronisers in series. Circuitry according to claim 11, wherein the first control circuit generates the same number of control signals as the number of second control signals generated by the second control circuit. Circuitry according to any one of claims 1 to 13, wherein the first and second timing signals are first and second clock signals. Circuitry according to any one of claims 1 to 14, wherein the first and second timing signals are derived from a common source. Circuitry according to any one of claims 1 to 15, wherein the first and second timing signals are asynchronous with respect to each other. A method of transferring information from a first timing environment to a second timing environment, comprising the steps of: storing data in a dual port RAM (2) through a first port thereof responsive to a first timing signal (60); generating a control signal (28), responsive to the first timing signal, indicating that data is stored in the dual port RAM; characterized by synchronising the control signal to a second timing signal (62); retrieving data from the dual port RAM through a second port thereof responsive to the second timing signal and the synchronised control signal; generating a second control signal (30), responsive to the second timing signal, indicating that data has been retrieved from the dual port RAM; and synchronising the second control signal to the first timing signal, wherein data is stored in the dual port RAM in dependence on the synchronised second control signal. The method of claim 17, further comprising the step of buffering data prior to storage in the dual port RAM. The method of any one of claims 17 to 18, further comprising the step of buffering data after retrieval from the dual port RAM. The method of any one of claims 17 to 19, wherein the storing step stores data in successive locations of the dual port RAM. The method of claim 20, wherein the retrieval step retrieves data from successive locations of the dual port RAM. The method according to any one of claims 17 to 21, wherein the generating step generates a plurality of first control signals, and the synchronising step synchronises each of the plurality of first control signals to the second timing signal. The method of claim 22, wherein the generating step generates a plurality of second control signals, and the synchronising step synchronises each of the plurality of second control signals. The method according to any of claims 17 to 23, wherein the first and second timing signals are first and second clock signals. The method according to any one of claims 17 to 24, wherein the first and second timing signals are derived from a common source. The method according to any one of claims 17 to 24, wherein the first and second timing signals are asynchronous with respect to each other. An interface for receiving and transmitting information to and from a system environment, comprising: first circuitry according to claim 1 operating as receive circuitry and second circuitry according to claim 1 operating as transmit circuitry, wherein a system clock acts as the second clock signal of the first circuitry and as the first clock signal of the second circuitry.

Inventors: WARREN ROBERT, WARREN, ROBERT
Applicants: SGS THOMSON MICROELECTRONICS, STMICROELECTRONICS, LTD.
Application year: 1998
Main classification: G06F5
IPC codes: G06F5, G06F13