Field of the Invention
The present invention relates generally to data processing systems, and more particularly, to low power management which utilizes status and control registers within a central processing unit.
Background of the Invention
Microcontroller integrated circuits are widely used today for many embedded and/or control applications. Typical microcontroller integrated circuits are required to communicate with on-chip and off-chip peripherals in order to effectively perform specific tasks. Communication of information from a packaged microcontroller which is formed on an integrated circuit is usually performed through a data bus or one or more output ports. The use of output ports and/or a data bus to communicate to an external environment is not always advantageous.
The data bus of a microcontroller will be used to carry an abundance of information. The data bus is used not only to interface with peripherals, but to read data from memory, write data to memory, execute software, and the like. The data bus will usually continually be in use reading operand and operation information so that the microcontroller can execute software to perform its function. Therefore, controlling a peripheral in address space by accessing data in the peripheral through the data bus is limited by bandwidth and can be inefficient. Control registers and status registers to monitor and control peripheral activity may also be stored in external memory and require access via the data bus. Therefore, memory stored registers to control and monitor peripherals may also be bandwidth limited and inefficient.
IO ports have been designed to alleviate some of the band width problems associated with using the data bus for many functions. However, IO ports are frequently memory-mapped or are accessed internal to the microcontroller integrated circuit by the same internal data bus used to access the external data bus. Therefore, the CPU internal to the microcontroller integrated circuit will have a difficult time accessing IO ports in a manner similar to accessing register and status information in external memory.
There exists a need in the industry to allow for a rapid status and control access between a peripheral device and the CPU of a microcontroller.
Brief Description of the Drawings
FIG. 1 illustrates, in a block diagram, a system for allowing rapid status and control access between a peripheral device and the CPU of a microcontroller in accordance with the present invention;
FIG. 2 illustrates, in a flowchart, a method for communicating information between a peripheral and an on-chip CPU in an efficient manner in accordance with the present invention; and
FIG. 3 illustrates, in a block diagram, the register file illustrated in FIG. 1.
Description of the Preferred Embodiment
Generally, the present invention comprises a method and an apparatus for allowing a microcontroller CPU to communicate effectively and efficiently with external peripheral devices. In order to provide effective and efficient communication, the CPU is located on an integrated circuit die along with a register file. The register file is the user's programming model of the microcontroller. The CPU writes to the register file via internal buses that are independent and distinct from the internal data bus and address bus used by the CPU to access data and software for execution. The register file contains a plurality of registers such as one or more program counters (PCs), one or more status registers such as a floating point status register, one or more base registers such as a vector base register, and like on-chip registers. In particular, the register file contains a global control register (GCR) and a global status register (GSR). The global control register is part of the internal register file of the microcontroller and is coupled directly to output pins of the integrated circuit. The global status register, while being part of the users programming model and register file, is directly coupled to status input pins of the integrated circuit. Therefore, a programmer can write code that communicates directly to the global status register and the global control register, which are within the users programming model, via internal data address and control buses to allow for efficient communication to an external environment without the bandwidth limitations of the prior art. In addition, the bus controller 14 (see FIG. 1) which drives the external address and data buses coupled to the data processor 10 may be non-functional or in a low power mode of operation while not inhibiting the operation of the power management signals communicated through the register file 16 to the external peripherals 46, 48 and 50.
The method and apparatus described above can be further understood with reference to FIGS. 1-3 discussed below.
FIG. 1 illustrates a data processor 10 that is a microcontroller or microprocessor system. Data processor 10 has a CPU 12 which is coupled to a bus controller 14. The CPU 12 is coupled to the bus controller 14 via an internal data bus 22, an internal address bus 24, and a control bus 26. The bus controller 14 communicates the data, address, and control information received via buses 22-26 to data pins 30, control pins 32, and address pins 28. Every element illustrated in FIG. 1 as being within the data processor 10 is formed on a single substrate and packaged in a material which provides for external pins or terminals such as data pins 30, control pins 32, and address pins 28. Therefore, the pins 28-32 allow the on-chip resources, such as the CPU 12 and the bus controller 14, to communicate to an environment external to the data processor 10. "Pins" may refer to solder bumps, terminals, conductive contact pads, or any external interconnect media.
The bus controller 14 communicates with an external data bus 34, an external control bus 36, and an external address bus 38, via the pins 28-32. The external buses 34-38 are connected to an external memory 20. External memory 20 is used to store opcodes and operands for access and execution by the CPU 12.
The CPU is coupled to the register file 16 via internal source and destination data buses and a control bus illustrated in FIG. 1. The register file 16 communicates with the CPU 12 via these internal buses wherein the internal buses between the CPU 12 and register file 16 are independent and separated from the buses 22-26 in FIG. 1. The register file contains a plurality of registers on-chip within the data processor 10. The register file contents are further illustrated in FIG. 3. The register file 16 is accessed by an instruction referred to as a MOVEC (move control) instruction. Therefore, the internal buses used to communicate to the register file 16 are accessed via instructions that are different from the instructions used to access the data bus 22 and the address bus 24. Within the register file 16 is a global status register 16a and a global control register 16b. The CPU can write information directly to the global control register via the MOVEC instruction. In addition, the CPU can read information directly from the global status register via the MOVEC instruction. The register file 16 contains registers that are part of the users programming model of the data processor 10.
Any information written to the global control register 16b is communicated directly to external control pins 54. Therefore, the CPU 12 can write information directly to the global control register 16b in order to directly control binary logic values of output pins of the data processor 10. These logic values of the output pins 54 can then be directly used to provide control information to external peripherals 46, 48 and 50. In addition to using the global control register 16b to provide control signals to external peripherals, register 16b can also be used to provide control signals to peripherals which may be internal to the data processor 10 and on-chip with the CPU 12. These on-chip peripherals are illustrated by peripherals 40 and 42 in FIG. 1.
FIG. 1 specifically illustrates that the global control register is used to provide low power control information to peripheral devices. The peripheral devices 40, 42, 46, 48, and 50 provide status information to the global status register 16a. Global status information provided by external peripherals 46-50 are provided through status input pins 52 where status input pins 52 are external terminals of the data processor 10. (status input pins 52 are also referred to as control input pins 52) Once status information is provided to register 16a, information may be read from the status register 16a via the internal register file source bus and the internal register file control bus. Therefore, the CPU can receive efficient and quick status information from external peripherals. The status information inherent in FIG. 1 is illustrated as providing peripheral feedback regarding the peripheral's low power mode(s) of operation. Therefore, in the aggregate, FIG. 1 allows a CPU to effectively control the power consumption of a complicated system without being limited by the bus controller resources or the limited bandwidth of the heavily-used external buses 34-38. In addition, the low power management system of FIG. 1 is not inhibited by the high band width and utilization of the internal buses 22-26 which are located internal to the data processor 10.
In order to perform low power monitoring and management, the CPU will write control values to the global control register 16b. In a preferred form, the registers located in the register file 16 are 32-bit registers. However, other sized registers such as 64-bit registers may also be used. By using 32-bit registers in the register file 16, global control register 16b can be used to provide 32 distinct low power control bits to peripherals 40-50. Therefore, one or more control bits from the control register 16b are coupled to one or more of the peripherals 40-50 to communicate to the peripherals whether they are to operate in a normal mode of operation, a low power mode of operation, or some hybrid mode of operation which is between a lowest power mode of operation and a highest-powered normal mode of operation. Once peripheral devices in FIG. 1 have been instructed via the control register 16b to change or modify a method of operation or power consumption, the global status register 16a is used to monitor the activity of the peripherals. The global status register 16a allows feedback so that the CPU 12 can effectively and efficiently control subsequent operations of the peripheral devices.
FIG. 2 is a flow chart which describes a method that can be used by the data processor 10 of FIG. 1 for providing status and control operations for low power management. In a step 100, at least one binary control signal is written from the CPU 12 to a global control register 16b within the register file 16. After the step 100, a step 102 allows binary values from the control register 16b to be communicated to control output pins 54 via optional buffer circuitry. Step 104 indicates that these control signals are then further conducted to communicate directly to input pins of peripheral devices. In a step 106, the peripheral devices receive the at least one control signal and alters a peripheral mode of operation in accordance with the signals provided via the register 16b. In a step 108, the peripheral devices of FIG. 1 periodically communicate status information to a plurality of input pins 52. The plurality of status signals are communicated and written into a global status register 16a via a step 110. In a step 112, the CPU performs a read operation to access the information stored in the status register 16a. The read and write operations from the CPU to the register 16a and 16b are performed via special internal dedicated bus resources. Once the CPU receives status information from the register 16A, the CPU can use the status information received from the peripherals to change the peripherals status, continue the existing peripheral status, or continue monitoring the progress of a peripheral device.
FIG. 3 illustrates the registers used in the register file 16. FIG. 3 illustrates a processor status and control register (PSR) which is used to control supervisory/user modes, indicate byte ordering, allows debugging by setting a serial mode, handles carry bit(s), etc.. The exception process status register (EPSR) is used to indicate the status of exceptions/interrupts in the system. The fast-exception process status register (FPSR) is used to indicate the status of fast exceptions in the system. The exception program counter (EPC) is a shadow register for use when performing exception handling. The fast exception program counter (FPC) register is used to shadow the program counter for processing fast exceptions. The supervisory scratch registers (SS0-SS4) are used in supervisory mode. The vector base register (VBR) is a register which indicates where the exception vector registers are located in address space. The global control register (GCR) and the global status register (GSR) are discussed herein.
While the present invention has been illustrated and described with reference to specific embodiments, further modifications and improvements will occur to those skilled in the art. For example, plurality as used herein is intended to mean and value between two and infinity and should not be limited to any particular constant or sub-range. More than one GSR and more than one GCR may be used with the data processor taught herein. Buses and registers can be any size in width. The above teachings can be utilized for any control methodology and is not limited just to low power control. The low power signals and control taught herein can extend further than just low power control/monitoring to a broader category of overall power management. It is to be understood, therefore, that this invention is not limited to the particular forms illustrated and that it is intended in the appended claims to cover all modifications that do not depart from the spirit and scope of this invention.