Microcode: Difference between revisions

Content deleted Content added
Write a lede that addresses the recent comments, integrate it with the article (more could be done)
Line 1:
A '''microprogram''' is a highly-specialized [[computer program]] that allows one computer microarchitecture to [[Emulator|emulate]] another, usually more-complex microarchitecture. The microprogram is usually very small compared to ordinary software, hence its name. It is also very carefully designed and optimized for the fastest possible execution.
A '''microprogram''' is a program consisting of '''microcode''' that controls the different parts of a computer's central processing unit ([[Central processing unit|CPU]]). The [[computer storage|memory]] in which it resides is called a [[control store]]. Complex microprograms were typical of [[mainframe computer]]s, such as the [[IBM]] [[System/360]]; but see [[RISC]] for more modern processor design.
 
As with any computer program, microprograms consist of series of microinstructions. These microinstructions usually control the computer's [[central processing unit]] ([[Central processing unit|CPU]]) at a very fundamental level. For example, a single typical microinstruction might specify the following operations:
==Overview and benefits==
A microprogrammed processor is a processor whose hardware implements a different (usually simpler) [[Computer architecture|architecture]] than that which is visible to the normal programmer; that simpler architecture (the microarchitecture) is used to execute a microprogram that implements the programmer-visible architecture.
 
* Connect Register 1 to the "A" side of the [[ALU]]
For example, the IBM System/360 has a 32-bit architecture with 16 general-purpose registers, but most of the System/360 implementations actually used hardware implementing a much simpler underlying microarchitecture. The 360 Model 30 used an 8-bit processor with only a few hardware registers; most other models used 16-bit or 32-bit processors.
* Connect Register 7 to the "B" side of the [[ALU]]
* Set the ALU to perform two's-complement addition
* Set the ALU's carry input to zero
* Store the result value in Register 8
* Update the "condition codes" with the ALU status flags ("Negative", "Zero", "Overflow", and "Carry")
* Microjump to MicroPC nnn for the next microinstruction
 
Microprogramming enabled IBM to design many System/360 models with substantially different hardware and spanning a wide range of cost and performance, while making them all architecturally compatible. This dramatically reduced the amount of unique system software that had to be written for each model.
 
To simultaneously control all of these features, the microinstruction is often very wide, for example, 56 bits or more.
Microprogramming also reduced the cost of field changes to correct defects ([[Computer bug|bug]]s) in the processor; a bug could often be fixed by replacing a portion of the microprogram rather than by changes being made to hardware logic and wiring.
 
The microprogram is also refered to as the CPU's '''microcode'''. The [[computer storage|memory]] in which it resides is called a [[control store]]. The microcode may be stored in ROM (as a form of [[firmware]]) or loaded into [[RAM]] memory as part of the initialization of the central processing unit.
PLEASE ADD A DEFINITION FOR MICROCODE, AND DISTINGUISH IT, IF POSSIBLE, FROM FIRMWARE. THANKS, mkl@pobox.com
 
== The reason for microprogramming ==
When computers were first developed, the speed of the central processor approximately matched the speed of the main memory, and each instruction word read from memory could efficiently command the execution of a single operation by the central processing unit. As logic design became more advanced, however, it became possible for the central processor to execute operations much faster than instruction words could be fetched from memory.
 
Microprogramming was a response to this imbalance. By allowing each instruction fetched from memory to invoke a micro[[subroutine]], instructions fetched from memory could command the central processor to perform very complex operations such as the addition of floating-point numbers or the execution of complete operations on character strings. The rise of [[CISC]] computers was a direct result of the availability of microprogramming and many computer architectures such as the [[IBM]] [[System/360]] and the [[Digital Equipment Corporation|DEC]] [[VAX]] family used complex microprograms.
 
In recent times, advances in memory speeds have made microprogramming less necessary, leading to the return of direct-execution computer architectures (now called [[RISC]]).
 
==Overview andOther benefits ==
A microprogrammed processor is a processor whose hardware implements a different (usually simpler) [[Computer architecture|architecture]] than that which is visible to the normal programmer; that simpler architecture (the microarchitecture) is used to execute a microprogram that implements the programmer-visible architecture. This underlying microarchitecture need not have any fixed relationship to the resulting programmer-visible architecture. This makes it very easy to implement a given programmer-visible architecture on a wide variety of underlying hardware micro-architectures.
 
For example, the IBM System/360 has a 32-bit architecture with 16 general-purpose registers, but most of the System/360 implementations actually used hardware implementing a much simpler underlying microarchitecture. The 360 Model 30, the slowest model in the line, used an 8-bit processormicroarchitecture with only a few hardware registers; mosteverything otherthat the programmer saw was emulated by the microprogram. Other, faster models used 16-bit or 32-bit processorsunderlying microarchitectures that more-closely resembled the programmer-visible architecture; this allowed much faster execution speeds.
 
MicroprogrammingIn this way, microprogramming enabled IBM to design many System/360 models with substantially different hardware and spanning a wide range of cost and performance, while making them all architecturally compatible. This dramatically reduced the amount of unique system software that had to be written for each model.
 
The exact same approach was used by Digital Equipment Corporation in their VAX family of computers. At the low end, a 32-bit 2901 bit-sliced approach was used with a large amount of supporting microcode; at the high end, the system contained 128-bit datapaths capable of directly executing the largest format used for floating-point numbers.
 
Microprogramming also reduced the cost of field changes to correct defects ([[Computer bug|bug]]s) in the processor; a bug could often be fixed by replacing a portion of the microprogram rather than by changes being made to hardware logic and wiring.
 
==History==