Abstract:
A synchronous memory interface feeds back a buffered (34) clock signal to a microcontroller (20) to simplify and improve output hold time for the memory (38). An output delay circuit (36) in the microcontroller (20) is controlled by the same delayed clock signal as the synchronous memory (38). This delay circuit (36) selectively delays memory signals to the synchronous memory (38) from the microcontroller delay circuit (36). The use of flip-flops (40, 44) in the delay circuit (36) provides a mechanism for scan testing. This enables three different selectable modes of operation of the delay circuit (36) providing flexibility in interfacing in different environments.

Description:
FIELD OF THE INVENTION 
     The present invention generally relates to data processing systems, and more specifically to interfacing a microcontroller (MCU) to an external synchronous dynamic random access memory (SDRAM). 
     BACKGROUND OF THE INVENTION 
     As data processing system bus speeds increase there has been a movement from asynchronous to synchronous memory interfaces. This is especially true for dynamic random access memories (DRAM), due to their relatively slow access speeds. A synchronous interface allows for a significantly faster interface. One speed disadvantage of an asynchronous memory system is that transactions are initiated and completed atomically. Therefore each transaction must be completed before the next transaction is begun. Synchronous memory interfaces allow various stages of the transaction to be pipelined, where requests to the memory and responses from the memory are overlapped. 
     Although synchronous memories provide speed advantages, they also create unique problems with respect to timing and clocking. This becomes a special burden for a system designer trying to implement a cost effective solution while at the same time meeting design specifications for the devices in a system. Hold times may be very difficult to meet, both from the perspective of the memory and the perspective of a processor. In the microcontroller environment, this can be even more difficult if bus clocks are derived from input signals of different frequencies or large skews with respect to the input clock. Bus specifications may be related to output clocks, and so a simple clock tree arrangement will not guarantee synchronous clocks. 
     FIG. 1 is a prior art timing diagram of an interface between a micro controller and a synchronous memory. Three signals are illustrated: clock out, SDRAM control out, and SDRAM clock. The clock out signal is generated by the data processing system. The bus specifications are defined with respect to this clock out signal. The SDRAM control out signal is generated by the data processing system and is recognized by a synchronous (SDRAM) memory. The SDRAM clock is the input clock to the synchronous DRAM (SDRAM) memory. Two time intervals are illustrated in FIG. 1. The first period is the output hold time for the data processing system. This is the minimum amount of time between a rising clock edge transition and the transition of an output to the memory. The other time period illustrated is the DRAM input hold time requirement. This is the minimum amount of time that a signal must be held after the DRAM input clock rising edge transition to be successfully recognized. In this illustration, the output hold time is two nanoseconds and the DRAM input hold time requirement is one nanosecond. The result is that the difference, one nanosecond, is the maximum skew allowed between the clock out of the data processing system and the clock into the SDRAM. This minimum skew requirement greatly increases the design complexity required in designing a system using synchronous DRAM (SDRAM). It should be noted that there is a similar requirement for data returning to the micro controller from a synchronous memory. 
     Prior to this invention, the problem has been solved with relatively expensive external hardware, such as a phased locked loop (PLL), and rigorous circuit board design to tightly control the skew of the clocks. 
     It would therefore be advantageous to provide a system solution which would allow the setup and hold time requirements of the devices within the system to easily be achieved without rigorous control of the clocks. This would significantly simplify the system design of an interface to a synchronous memory. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     The features and advantages of the present invention will be more clearly understood from the following detailed description taken in conjunction with the accompanying FIGURES where like numerals refer to like and corresponding parts and in which: 
     FIG. 1 is a prior art timing diagram of an interface between a micro controller and a synchronous memory; 
     FIG. 2 illustrates, in block diagram form, a data processing system in accordance with the present invention; 
     FIG. 3 illustrates, in logic diagram form, a portion of output delay in accordance with the present invention; 
     FIG. 4 illustrates a timing diagram of various signals of output delay of FIG. 3 during the feedback delay mode; 
     FIG. 5 illustrates a timing diagram of various signals of output delay of FIG. 3 during the positive edge mode of operation; and 
     FIG. 6 illustrates a timing diagram of various signals of output delay of FIG. 3 during the negative edge mode of operation. 
    
    
     DETAILED DESCRIPTION 
     Generally, the present invention provides a circuit for interfacing a microcontroller to an external synchronous dynamic random access memory (SDRAM) that solves the timing problem of the prior art by feeding back the output clock signal for controlling the timing of the SDRAM to output delay 36. This feedback clock signal is used to control the output registers of output delay 36 that data, address, and control signal to the SDRAM. By feeding back the clock signal, a gate delay caused by buffering the clock signal improves hold times of the SDRAM relative to the microcontroller. Also, feeding back the clock signal matches the output of data processing system 20 with the input hold times of the SDRAM without requiring complex timing control circuits. 
     FIG. 2 illustrates, in block diagram form, a data processing system 20 in accordance with the present invention. Data processing system 20 includes a central processing unit (CPU) 22, a bus controller 24, other peripherals 26, SDRAM controller 28, clock generator 32, output delay 36 and multiplexer 30. In the illustrated embodiment, data processing system 20 is a microcontroller (MCU) coupled to a synchronous dynamic random access memory (SDRAM) 38. CPU 22 is coupled to bus controller 24 via a bus labeled &#34;INTERNAL BUS&#34;. Also SDRAM controller 28 and other peripherals 26 are coupled to the INTERNAL BUS. Bus controller 24 includes a plurality of bidirectional terminals for both receiving and providing data signals labeled &#34;DATA&#34;. Bus controller 24 also includes a plurality of output terminals for providing address signals labeled &#34;ADDRESS&#34;. SDRAM controller 28 provides a select signal labeled SYNC --  MODE --  SEL, a RAS control signal labeled &#34;SRAS --  IN&#34; and a plurality of conventional SDRAM control signals labeled &#34;SDRAM --  CNTL&#34;. Mux 30 receives addresses from the bus controller 24 and multiplexes them to be compatible with standard DRAM operation. Output delay 36 receives data signals from bus controller 24, address signals from mux 30, and the control signals from SDRAM controller 28. In response, output delay 36 provides data signals labeled &#34;DATA&#34;, address signals labeled &#34;ADDRESS&#34;, a control signal labeled &#34;SRAS --  OUT&#34;, and plurality of plurality of conventional SDRAM control signals also labeled &#34;SDRAM --  CNTL&#34; for accessing and controlling an external SDRAM 38. Note that for convenience, some of the signals entering and leaving output delay 36 have the same name. 
     Clock generator 32 receives an input clock signal labeled &#34;CLK --  IN&#34;, and in response, provides a system clock signal labeled SYS --  CLK to each of the modules of data processing system 20. In addition, clock generator 32 provides an output clock signal labeled &#34;CLOCK --  OUT&#34; to an output terminal of data processing system 20. An application using data processing system 20 may include an external buffer circuit such as buffer 34 to provide a buffered clock signal labeled &#34;EDGE --  SEL&#34; to a clock input terminal of SDRAM 38 and as the feedback signal to output delay 36. In some embodiments, buffer 34 may be included on data processing system 20, or may be omitted. 
     Other peripherals 26 includes various other module circuits for performing communications, timing and other processing tasks for data processing system 20, such as for example, a serial communications interface module (SCI), a general purpose timer, direct memory access module, or additional memory. 
     In operation, when SDRAM controller 28 recognizes that an access is requested to SDRAM 38, SDRAM controller 28 receives control of multiplexer 30 and asserts select signal SYNC --  MODE --  SEL as an active high to output delay 36, indicating that the access is to synchronous DRAM 38. When select signal SYNC --  MODE --  SEL is a logic low, output delay 36 may be used to access another type of memory, such as static random access memory (SRAM), or a type of non-volatile memory such as read-only-memory (ROM), or electrically erasable read-only-memory (EEPROM). When the access is to SDRAM 38, SDRAM controller 28 asserts the appropriate control signals to control the access of SDRAM 38. SDRAM 38 is a conventional SDRAM and is accessed in a conventional manner and therefore will not be discussed in detail. 
     The clock timing for SDRAM 38 is provided by data processing system 20 via buffer 34. The output of buffer 34 is then fed back to output delay 36 to cause the output signals from output delay 36 to match the required timing of SDRAM 38 thereby matching the output timing of output delay 36 with the input timing of SDRAM 38. 
     Note that in other embodiments, SDRAM 38 may be replaced with other types of synchronous memory such as a synchronous SRAM. 
     FIG. 3 illustrates, in logic diagram form, a portion of output delay 36 in accordance with the present invention. The circuit illustrated in FIG. 3 is one example of an output of output delay 36 of FIG. 2. All of the other output signals including DATA and ADDRESS include circuits similar to the circuit illustrated in FIG. 3. For example, FIG. 3 illustrates the circuit for outputting the SRAS --  OUT signal. In the case of DATA signals the circuit of FIG. 3 is applicable if SRAS --  IN and SRAS --  OUT are replaced with data signals. 
     The portion of output delay 36 illustrated in FIG. 3 includes flip-flops 40 and 44, inverter 42, multiplexer 48 and AND logic gate 46. Flip-flop 40 has an input terminal for receiving RAS signal SRAS --  IN. A clock input signal for receiving SYS --  CLK and an output terminal for providing an output signal, labeled &#34;POS --  REG&#34;, that changes on a rising edge of clock signal SYS --  CLK. Inverter 42 has an input terminal for receiving SYS --  CLK and an output terminal. Flip-flop 44 has an input terminal coupled to the output terminal of flip flop 40, a clock input terminal coupled to the output terminal of inverter 42, and an output terminal for providing an output signal labeled &#34;NEG --  REG&#34;, that changes on a falling edge of clock signal SYS --  CLK. Multiplexer 48 has a first input terminal, labeled &#34;0&#34;, coupled to the output terminal of flip-flop 40, a second input terminal, labeled &#34;1&#34;, coupled to the output terminal of flip-flop 44, a select terminal, and an output terminal. AND logic gate 46 has an inverted first input terminal for receiving a select signal labeled &#34;EDGE --  SEL&#34;, a second input terminal for receiving SYNC --  MODE --  SEL, and an output terminal coupled to the select terminal of multiplexer 48. 
     In operation, output delay 36 provides three modes of operation: (1) a feedback delay mode, where the output of output delay 36 follows the rising edge of a toggling EDGE --  SEL signal; (2) a positive edge mode, where an output of output delay 36 follows the rising clock edge of clock signal SYS --  CLK; and (3) a negative edge mode, where the output of output delay 36 follows the falling edge of clock signal SYS --  CLK. 
     When select signal SYNC --  MODE --  SEL is negated, or a logic low, multiplexer 48 couples the output of flip-flop 40 to the output of multiplexer 48. This allows a non-SDRAM access using output delay 36 that uses the rising edge of SYS --  CLK. 
     Output delay 36 is enabled for an SDRAM access when select signal SYNC --  MODE --  SEL is asserted as a logic high. 
     The operation of output delay 36 of FIG. 3 will now be discussed in connection with the timing diagrams of FIGS. 4-6. When select signal SYNC --  MODE --  SEL is a logic high, the output of AND logic gate 46 is dependent on the logic state of EDGE --  SEL. 
     FIG. 4 illustrates a timing diagram of various signals of output delay 36 during the feedback delay mode. In the feedback delay mode, feedback clock signal EDGE --  SEL toggles in response to the CLOCK --  OUT signal of clock generator 32. However, EDGE --  SEL is delayed by an amount equal to the delay of buffer 34. When EDGE --  SEL rises, the output of AND logic gate 46 causes the first input terminal of multiplexer 48 to be provided at the output of multiplexer 48, and when EDGE --  SEL falls multiplexer 48 couples the output of flip-flop 44 to the output of multiplexer 48. Since the input of flip-flop 44 is connected to the output of flip-flop 40 then the output of multiplexer 48 does not change during as EDGE --  SEL transitions from a logic high to a logic low because both flip-flops are providing the same information. 
     Because the output of output delay 36 is triggered by EDGE --  SEL, the input hold time of the output signals of output delay 36, such as for example SRAS --  OUT, is shifted to match the output signals to the clock input signals of SDRAM 38. This matches the output signals of output delay 36 to the clock signal of SDRAM 38 so that the problems as discussed above in the background are avoided without using a complex clocking scheme. 
     FIG. 5 illustrates a timing diagram of various signals of output delay 36 of FIG. 3 during the positive edge mode of operation. In this mode of operation, the output of buffer 34 is not fed back to output delay 36, and select signal EDGE --  SEL is held at a logic high causing the output of AND logic gate 46 to provide a logic low at its output terminal. This selects the first input terminal (labeled &#34;0&#34;) of multiplexer 48 to provide the output of flip-flop 40 at the output terminal of multiplexer 48. This is used in applications where the feedback delay mode is not required and the SDRAM control signal is required to change on the rising edge of the system clock signal. 
     FIG. 6 illustrates a timing diagram of various signals of output delay 36 during the negative edge mode of operation. In FIG. 6, select signal EDGE --  SEL is held at a logic low causing the second input terminal (labeled &#34;1&#34;) of multiplexer 48 to be coupled to the output of multiplexer 48. This is used in applications where the feedback delay mode is not required and it is desirable that the output of output delay 36 depend on a falling edge of the system clock signal. 
     Because flip-flops 40 and 44 are utilized, scan testing of data processing system 20 is also supported. 
     Those skilled in the art will recognize that modifications and variations can be made without departing from the spirit of the invention. Therefore, it is intended that this invention encompass all such variations and modifications as fall within the scope of the appended claims. 
     Claim elements and steps herein have been numbered and/or lettered solely as an aid in readability and understanding. As such, the numbering and/or lettering in itself is not intended to and should not be taken to indicate the ordering of elements and/or steps in the claims.