1. Field of the Invention
The invention relates to the field of computer microcontrollers and more particularly to the field of pipeline architectures for a microcontroller.
2. Description of Background Art
Microcontrollers are microprocessors integrated with peripherals on a single integrated circuit. They are compact in size and yet retain the computational power of traditional microprocessors, allowing them to be used in a multitude of applications. For example, in a single household, microcontrollers are a part of microwave ovens, televisions, calculators, remote controls, clocks, etc. In a microwave oven, for example, the microcontroller senses the settings keyed in by the user and heats up the food for the set time interval and power level. The microcontroller keeps track of real time and produces a beep to notify the user when the heating is done. The microcontroller also displays the status of the microwave oven on a suitable display, typically an LCD or LED.
Every car has about twenty microcontrollers. In a car, they are used in the engine control modules, the antilock braking systems, the sound systems, the airbags, and automobile suspension control modules. In antilock braking systems, the microcontroller monitors the rotational speed of the tires through sensors attached to the tires. When the driver applies the brakes, the microcontroller determines whether any of the tires have locked. If any of the tires are locked, the microcontroller releases the brakes for that tire through a servo-mechanical device coupled to the brakes. Thus, the driver is able to steer the car during emergency braking situations without fear of having the tires lock and causing the car to skid or turn over.
A modern semiconductor microcontroller is basically a low-cost computer adapted to provide rapid solutions to external events after intensive computation. The microcontroller senses the happening of external events through signals received at input ports and transmits responses to the events through output ports. In order to provide this functionality, a typical microcontroller employs an on-chip Programmable Read Only Memory (PROM) to store its instructions, an on-chip data RAM to store the data temporarily, a Central Processing Unit (CPU) to execute the instructions stored in the PROM, an oscillator driver to generate the system clock, and other application-specific peripherals such as timers, interrupt handlers, watchdogs, analog comparators, etc.
The majority of consumer electronics applications use 8-bit microcontrollers. However, modern consumer electronic devices are requiring more powerful processing from their microcontrollers while attempting to maintain or reduce their costs. Existing 8-bit microcontrollers are unable to meet the heightened performance requirements of modem applications. Sixteen-bit or thirty-two bit microcontrollers may be able to provide the processing power required by the modern applications; however, these microcontrollers are also very expensive.
A second problem with existing microcontrollers is their inflexibility. The market window of consumer electronics devices has become extremely short, and the consumer electronics design houses have been forced to reduce their design and manufacture cycle. However, in order to shorten the design and manufacture cycle, a flexible microcontroller is needed that can be rapidly reconfigured to meet the changing needs of the design house. One method of maintaining flexibility in design is to use software to emulate the hardware functions of consumer electronics devices. For example, the design house may use software to implement software timers, software modems, software analog-to-digital converters, etc. However, software emulation of hardware requires an extremely high performance microcontroller. Moreover, in order to correctly emulate hardware devices, the microcontroller must use a fixed number of clocks to execute every instruction. This ensures that the software emulation precisely replicates the hardware. However, existing microcontrollers cannot ensure that instructions are executed in a fixed number of clock cycles.
Therefore, a microcontroller is needed which can meet both the heightened performance requirements of modem applications and ensure that instructions are executed in a fixed number of clock cycles, without requiring the use of more expensive hardware.
The invention is a system and method for efficiently processing instructions in a pipeline architecture for a microcontroller and maintaining a fixed instruction execution per clock cycle rate. The pipeline preferably comprises four stages, an instruction fetch stage, an operand fetch stage, an execution stage, and a write back stage. In a first embodiment, the instruction fetch stage retrieves instruction data from non-volatile memory in a single clock cycle. Thus, by dedicating a single clock cycle to the instruction fetch, instructions are retrieved from non-volatile program memory without incurring pipeline delay, as in conventional systems. In a second embodiment, the operand fetch stage is coupled to the instruction fetch stage and preliminarily decodes the instruction data to determine tasks to be performed. By preliminarily decoding instructions in a separate stage, the execution stage is able to perform its time-intensive calculations in a single clock cycle. Additionally, the operand fetch stage initiates the performance of tasks determined from the decoding of the instructions. For example, in one embodiment, responsive to determining a task requires a read operation to be performed by the execution stage, the operand fetch stage generates a read address. As performing a read operation is one of the most time-critical operations of the pipeline, having the operation initiated in a previous stage allows the read operation to be performed without delay.
In a third embodiment, the execution stage and the write back stage perform read and write operations concurrently. This is preferably accomplished by using a dual port data memory coupled to the operand fetch stage, the execution stage, and the write back stage. Thus, the execution stage can perform a read operation in a single clock cycle, and the write back operation can perform a write operation in the same clock cycle. Another time-saving advantage is obtained by having the execution stage generate a write address for the write back stage. As performing the write operation is also time-intensive, having the write address generated in a previous stage allows the write operation to have an entire clock cycle to perform its write operation. Additional embodiments are disclosed for addressing circumstances in which one stage modifies the data address pointer required by another stage or one stage writes to an data memory location required for a read operation by a previous stage. All of the above embodiments allow a microcontroller to execute one instruction in each clock cycle, which is an execution rate which meets or exceeds the high performance required by modern applications. The present invention also maintains a fixed single instruction per clock cycle rate, which allows the use of this microcontroller for hardware emulation applications. Finally, the microcontroller design of the present invention may be implemented as an eight-bit microcontroller, thus providing significant savings over other solutions.
USPTO Backgrounds
USPTO Backgrounds