Cross Reference to Related Application
Related subject matter is contained in a patent application Ser. No. 08/194,900 now U.S. Pat. No. 5,559,981, entitled "Pseudo Static Mask Option Register and Method Therefor" by Gregory A. Racino and Jeffrey R. Jorvig, filed Feb. 14, 1994, and assigned to the assignee hereof.
Field of the Invention
This invention relates generally to data processors, and more particularly, to a data processor with a mask option register for mode selection.
Background of the Invention
Computer systems are classically defined as having a central processing unit, memory, and input/output devices. Recent advances in integrated circuit technology have allowed many of the classical computer functions to be integrated onto a single integrated circuit chip. These devices are known by a variety of terms such as microcontrollers, embedded controllers, microcomputers, and the like. However, they share a common characteristic in that they incorporate most classical computer functions on-chip. Because of their high level of integration, microcontrollers are ideal for applications such as automobile engine controllers, refrigerators, cellular telephones, remote controllers, and the like. In order to alleviate the need for external memory to store the operating program, microcontrollers commonly include nonvolatile memory in the form of read-only memory (ROM), programmable ROM (PROM), erasable programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM of E.sup.2 PROM), or one-time programmable ROM (OTPROM).
These microcontrollers frequently operate in a variety of modes but may be customized for individual applications. For example, a microcontroller may selectively implement an instruction of the central processing unit's instruction set. Other examples of different operating modes include the selection of whether an on-chip peripheral is active, support of different clock oscillator types such as crystal or resistor-capacitor (RC) network, the selection of the function of input/output pins, and the selection of other electrical characteristics of the device.
Some of these microcontrollers have their modes customized through bits, known as mask option bits, stored in nonvolatile memory. These bits are collectively referred to as the mask option register, or MOR. The MOR bits can be programmed at the same time the on-chip nonvolatile memory is programmed, and thus the microcontroller may be customized for the application. The mask option bits form signals which are continuously driven to various circuits to select the operating modes.
There are three known approaches for implementing the MOR. In the first approach, known as the static latched design, mask option data is stored in a portion of a nonvolatile memory. The other portion is used to store the software and data required to operate the microcontroller. When the microcontroller receives a reset signal (due to powering up or the system forcing a reset to the microcontroller), the mask option information is read from the nonvolatile memory and stored in static latches which generally retain the state of the data during normal operation.
There are problems with the static latched design. First, the mask option signals are not valid until the reset signal is inactivated. Therefore, some types of mask options, such as the clock oscillator type, cannot be implemented in the static latched MOR design because the mask options must be valid during the reset sequence. Second, the states of the mask option bits are held in latches which may become corrupted under adverse conditions with no possibility of recovery.
The second approach, known as the continuous refresh approach, uses a separate nonvolatile memory whose contents are continuously sensed and latched. The continuous refresh design corrects the problems of the static latched design. First, the continuous refresh approach provides valid mask option bits prior to the inactivation of the reset signal. Second, the state of the nonvolatile memory bits are almost instantaneously reflected on the mask option signals, eliminating most of the susceptibility to electrical disturbances.
However, the continuous refresh approach has several disadvantages compared to the static latched approach. The continuous refresh design requires a significant amount of power because the nonvolatile memory bits are being sensed continuously, causing current to flow continuously through the nonvolatile memory cells. The magnitude of the current flowing through each of the nonvolatile memory bits is dependent on the type of fabrication process used to manufacture them. Another problem is decreased reliability. The constant sensing bias voltage applied to the nonvolatile memory cells tends to degrade their data retention time (how long the bit retains data). The data retention time is known to be dependent on the period of time the nonvolatile memory cell is biased.
The third approach, known as the pseudo static approach, solves the problems with both of the previous two approaches. In the pseudo static approach, the MOR bits are stored in a separate nonvolatile memory. Instead of continuous updating, however, the MOR bits are read (sensed) only periodically. This periodic reading prevents unrecoverable errors caused when an electrical disturbance corrupts the contents of the stored MOR bits. The pseudo static approach reduces power consumption by only periodically reading the contents of the nonvolatile memory cells. Additionally, the pseudo static MOR output signals are valid prior to the termination of reset.
However, two main problems with the pseudo static approach remain. Since the pseudo static approach uses a separate nonvolatile memory array, the circuitry in general is different. For example, the sense amplifiers in the main nonvolatile memory array, which may have several thousand bits, are designed for speed whereas the sense amplifiers for the MOR block, which may typically have eight bits, are designed for low power consumption. Thus, the operation of this block must be evaluated and its reliability guaranteed separately from the main nonvolatile memory block. Even if the nonvolatile memory cells themselves are the same as in the main array, the difference in sense amplifiers makes the overall operation different.
Second, the pseudo static approach requires a large amount of circuit area to implement the separate nonvolatile memory cells, sense amplifiers, and high voltage circuits. In addition to area, the extra circuitry consumes more power. While the pseudo static approach consumes less power than the continuous refresh approach, further reduction is desirable.
Thus, it would be desirable to have a microcontroller which operates in a variety of modes which may be configured at program time, and which operates reliably and without excessive circuit area and power consumption. The present invention provides such a microcontroller, and these and other features and advantages will be more clearly understood from the following detailed description taken in conjunction with the accompanying drawings.
Brief Description of the Drawings
FIG. 1 illustrates in block diagram form a microcontroller according to the present invention.
FIG. 2 illustrates in partial block and partial logic diagram form the nonvolatile memory system of FIG. 1.
FIG. 3 illustrates in logic diagram form the data access control circuit of FIG. 2.
Detailed Description of a Preferred Embodiment
FIG. 1 illustrates in block diagram form a microcontroller 20 according to the present invention. Microcontroller 20 is an integrated circuit microcontroller and includes a central processing unit (CPU) 21 connected to an address bus 22 and a bidirectional data bus 23. CPU 21 has an input terminal for receiving a clock signal labelled "SYSCLK" and an output terminal for providing a read/write control signal labelled "R/W". CPU 21 also has other conventional input and output terminals but these are well known in the art and their description is omitted.
CPU 21 executes a program stored in nonvolatile memory system 25. Nonvolatile memory system 25 also stores the mask option bits associated with the operation of microcontroller 20. For example, in the illustrated embodiment, CPU 21 is an MC68HC05 family microprocessor available from Motorola, Inc. Nonvolatile memory system 25 provides one mask option bit, labelled "STOP", to CPU 21 to selectively enable the STOP instruction in the instruction set of CPU 21.
Microcontroller 20 also includes a random access memory (RAM) 24, a system integration module 26, a watchdog timer 27, and a clock generator 28. RAM 24 has an address input connected to address bus 22, and a bidirectional data connection to data bus 23. RAM 24 stores variables, measurements, operating parameters, and the like.
System integration module 26 performs many "glue logic" functions to allow microcontroller 20 to be used in various applications with little or no external hardware. System integration module 26 has an address input connected to address bus 22, a bidirectional connection to data bus 23, and a clock input for receiving signal SYSCLK. System integration module 26 provides outputs to several blocks in microcontroller 20. One such output is a signal labelled "END OF RESET", which system integration module 26 provides to nonvolatile memory system 25. Signal END OF RESET causes the static mask option bits in nonvolatile memory system 25 to be initially loaded into a volatile MOR register at the end of reset. System integration module 26 generates this signal in response to the end of a reset sequence initiated by an active-low external reset input signal labelled "RESET".
Another such output signal is labelled "REFRESH REQUEST" which system integration module 26 provides to another input of nonvolatile memory system 25. System integration module 26 activates signal REFRESH REQUEST after a certain predefined number of SYSCLK cycles. The REFRESH REQUEST signal ensures that mask option bits stored in nonvolatile memory system 25 are periodically refreshed, or updated, so that the value stored in the volatile MOR register may recover after an event, such as external noise, corrupts its contents. Note that while system integration module 26 provides the REFRESH REQUEST signal in microcontroller 20, in other embodiments other blocks may generate the REFRESH REQUEST signal as well.
CPU 21 programs system integration module 26 to define the address spaces of RAM 24 and nonvolatile memory system 25. Conventionally, a startup or boot program is stored within nonvolatile memory system 25, and system integration module 26 defaults to setting the address range of nonvolatile memory system 25 to include the reset vector of CPU 21. Thereafter, CPU 21 may alter the address ranges by writing to the registers of system integration module 26. In response to detecting a memory access to RAM or nonvolatile memory space, system integration module 26 activates control signals labelled "EPROM SELECT" or "RAM SELECT", respectively. System integration module 26 also provides a control signal labelled "MEMORY READ ENABLE" to cause nonvolatile memory system 25 to provide its contents to data bus 23 when accessed.
System integration module 26 also has an output for providing a divided clock signal labelled "WCLK" to a watchdog timer 27. Watchdog timer 27 also has an address input connected to address bus 22, and a bidirectional connection to data bus 23. CPU 21 can thus program and read registers in watchdog timer 27 to control its operation. Watchdog timer 27 periodically generates a timing signal labelled "COP" to prevent system errors and for other timing functions.
Nonvolatile memory system 25 includes nonvolatile memory for storing the operating program of CPU 21, and also includes mask option bits. The mask option bits are memory-mapped and may be read by CPU 21. Thus, when system integration module 26 detects an access to this memory-mapped location, it activates a control signal labelled "MOR SELECT" and provides it to nonvolatile memory system 25.
Nonvolatile memory system 25 has an address input terminal connected to address bus 22, a bidirectional data terminal connected to data bus 23, a control input terminal for receiving signal R/W from CPU 21, control input terminals for receiving signals END OF RESET, REFRESEH REQUEST, MOR SELECT, and EPROM SELECT from system integration module 26, a control input terminal for receiving signal COP from watchdog timer 27, and output terminals for providing signals corresponding to each of the mask option bits. These signals will vary from application to application. Shown in FIG. 1 is a representative mask option signal STOP, which nonvolatile memory system 25 provides to CPU 21.
Nonvolatile memory system 25 improves reliability over the pseudo static approach by implementing the mask option bits with the program memory in a common nonvolatile memory cell array. The mask option bits share decoding, high voltage, and sense amplifier circuitry with the program memory and have the same reliability characteristics. Furthermore, nonvolatile memory system 25 allows the mask option bits to be stored with the program memory in a common nonvolatile memory cell array without adding the circuit area and thus power consumption of the extra blocks used in pseudo static approach.
FIG. 2 illustrates in partial block and partial logic diagram form nonvolatile memory system 25 of FIG. 1. Nonvolatile memory system 25 includes an array 30 of nonvolatile memory cells. Array 30 has two portions, a first portion for storing mask option bits 32, and a second portion including the remaining bits such as the operating program of CPU 21 labelled "EPROM ARRAY" 31. While the illustrated nonvolatile memory array is an array of EPROM cells, it should be apparent that other types of nonvolatile memory cells such as ROM, PROM, EEPROM, and OTPROM may be used as well.
Array 30 includes memory cells organized into rows and columns. Mask option bits 32 occupy part of one row and may be located anywhere in the address space of EPROM array 31. However, mask option bits 32 are preferably mapped into a memory location physically at the edge of EPROM array 31 to ease silicon debugging. Note that the address corresponding to this location is not necessarily the highest or lowest address of the address space of array 30. An access to array 30 uses conventional decoding techniques, in which a first portion of the address forms a row address and is input to a row decoder 33, and a second portion of the address forms a column address and is input to column decoder 34. A set of sense amplifiers 35 then sense the voltages provided by the memory cells selected by row decoder 33 and column decoder 34, and provide data output signals in response. In the illustrated embodiment, to support applications using very low power supply voltages, row decoder 33 and column decoder 34 also each include high voltage circuitry. The high voltage circuitry increases the power supply voltage to ensure proper accessing and sensing of voltage of selected bit lines. The high voltage circuitry includes charge pumps to increase the power supply voltage and thus the headroom of sense amplifiers 35 for fast accesses.
Nonvolatile memory system 25 also includes a data access circuit 40 which allows mask option bits 32 to be stored in a common array, namely array 30. Data access circuit 40 includes generally a data access control circuit 41, a data bus register 42, a three-state buffer 43, a mask option register 44, and transmission gates 47 and 48. Data access control circuit 41 has inputs for receiving signal SYSCLK from clock generator 28, signal R/W from CPU 21, signals REFRESH REQUEST, EPROM SELECT, and MOR SELECT from system integration module 26, and signal COP from watchdog timer 27. Data access control circuit 41 has a first output for providing a first control signal labelled "CLKA", and a second output for providing a second control signal labelled "CLKB".
The operation of data access control circuit 41 may be better understood with reference to FIG. 3, which illustrates data access control circuit 41 in logic diagram form. Data access control circuit 41 includes an OR gate 50, an AND gate 51, a NOR gate 52, an AND gate 53, an OR gate 54, and a set-reset (SR) type flip-flop 55. OR gate 50 has a first input terminal for receiving signal EPROM SELECT, a second input terminal for receiving signal MOR SELECT, and an output terminal. AND gate 51 has a first input terminal connected to the output terminal of OR gate 50, a second input terminal for receiving signal R/W, a third input terminal for receiving signal SYSCLK, and an output terminal for providing signal CLKA. Data access control circuit 41 thus provides signal CLKA when system integration module 26 detects a read access to EPROM array 31 or a read access to mask option bits 32, which is synchronized with the rising edge of signal SYSCLK.
NOR gate 52 has a first input terminal for receiving signal EPROM SELECT, a second input terminal for receiving signal MOR SELECT, and an output terminal. AND gate 53 has a first input terminal connected to the output terminal of NOR gate 52, a second input terminal for receiving signal SYSCLK, a third input terminal, and an output terminal. OR gate 54 has a first input terminal connected to the output terminal of AND gate 53, a second input terminal for receiving signal END OF RESET, and an output terminal for providing signal CLKB. Flip-flop 55 has a set input terminal labelled "S" for receiving signal REFRESH REQUEST, a reset input terminal labelled "R" for receiving signal CLKB, and a true output terminal labelled "Q" connected to the third input terminal of AND gate 53. Flip-flop 55 is set in response to signal REFRESH REQUEST and thus indicates a pending refresh request. Flip-flop 55 is not reset until the request is satisfied by the activation of signal CLKB, which occurs when system integration module 26 detects neither an access to EPROM array 31 nor an access to mask option bits 32. AND gate 53 further synchronizes signal CLKB to the rising edge of signal SYSCLK. OR gate 54 causes the activation of signal CLKB in response to the end of the reset sequence, or to a pending refresh request. It should be apparent that other logic circuitry may be used to implement the logical functions of data access control circuit 41 as well.
Returning now to FIG. 2, data bus register 42 has a data input terminal connected to sense amplifiers 35, a control input terminal for receiving signal CLKA from data access control circuit 41, and an output terminal. Data bus register 42 provides intermediate storage for the data read from array 30 so that a stable value may be presented to data bus 23. Three-state buffer 43 has an input terminal connected to the output of data bus register 42, a control input terminal for receiving signal MEMORY READ ENABLE, and an output terminal connected to data bus 23.
Mask option register 44 is a volatile register which stores a copy of mask option bits 32. Mask option register 44 has a data input terminal connected to sense amplifiers 35, a control input terminal for receiving signal CLKB, and an output terminal for providing the mask option bits.
Transmission gate 47 has a first terminal connected to address bus 22, a complementary control input terminal for receiving signal CLKB, and an output terminal connected to the input terminals of row decoder 33 and column decoder 34. Transmission gate 48 has a first terminal for receiving a value labelled "MOR ADDRESS", a true control input terminal for receiving signal CLKB, and an output terminal connected to the input terminals of row decoder 33 and column decoder 34. MOR ADDRESS includes the row and column address of mask option bits 32 in array 30.
During a normal access cycle to array 30, signal CLKB is inactive at a logic low, and signal CLKA is active. Transmission gate 47 is active and provides the address value from address bus 22 to the inputs of row decoder 33 and column decoder 34. Sense amplifiers 35 detect the accessed data value, which is latched in data bus register 42. During a refresh cycle, which is indicated by signal CLKB being active, transmission gate 48 is active to cause mask option bits 32 to be read out of array 30. At the same time, mask option register 44 latches mask option bits 32, completing the refresh cycle.
Certain software instructions may cause a refresh to be pending for a very long or indefinite period of time, such as when software executes a long loop which does not require CPU 21 to execute any idle cycles. While in such a routine, mask option register 44 could be corrupted by noise, and not be refreshed for a very long period of time. One technique to prevent this lengthy corruption from occurring is illustrated in FIG. 2, in which a refresh timeout decoder 46 detects such an occurrence. Preferably, refresh timeout decoder 46 activates its output to data access control circuit 41 when signal COP is activated a second time before data access control circuit 41 responds to a refresh request. In response to the activation of the output of refresh timeout decoder 46, data access control circuit 41 acts to force an access to mask option bits 32, and thus includes extra logic for this purpose not shown in FIG. 3.
Another technique may also be used to ensure that a refresh occurs even when the software is erroneously stuck in a tight loop. In this technique, EPROM array 31 is segmented into two halves, a left half and a right half. Preferably, the least significant address bit, or A0, is used to select between the halves. In this way, a two-byte opcode requires sequential fetches to each half. Data access circuit 40 updates the MOR bits when the half in which they are stored in is not being accessed. This technique would be preferred when EPROM array 31 is already organized into halves selected by A0.
In the illustrated embodiment, CPU 21 uses an 8-bit architecture; data bus 23 is eight bits wide. Address bus 22 is sixteen bits wide. However, these sizes are merely one example and the present invention is applicable to any arbitrary CPU architecture and bus sizes.
While the invention has been described in the context of a preferred embodiment, it will be apparent to those skilled in the art that the present invention may be modified in numerous ways and may assume many embodiments other than that specifically set out and described above. For example, any type of nonvolatile memory may be used including ROM, PROM, EPROM, EEPROM, OTPROM, and the like. Furthermore, the refresh request signal may be generated in a variety of ways, such as by an on-chip watchdog timer or as an external input signal. Also, the MOR may be greater than one byte in length. In this case, the refresh may require more than one cycle, but the most critical bits should be placed into a byte which is refreshed first. Accordingly, it is intended by the appended claims to cover all modifications of the invention which fall within the true spirit and scope of the invention.