Information AboutMicroprogram |
|
On most computers the microcode is not produced by a compiler, but exists in a special high speed memory. The microcode is written by the CPU engineer during the design phase. In some computers the microcode is in RAM and can be altered to correct bugs in the instruction set, or to implement new machine instructions. Microcode can also allow one computer Microarchitecture to Emulate another, usually more-complex architecture. The elements composing the microprogram exist on a lower conceptual level than the more familiar assembler instructions. Each element is differentiated by the "micro" prefix to avoid confusion: microprogram, microcode, microinstruction, microassembler, etc. Microprograms are carefully designed and optimized for the fastest possible execution, since a slow microprogram would yield a slow machine instruction which would in turn cause all programs using that to be slow. The microprogrammer must have extensive low-level hardware knowledge of the computer circuitry, as the microcode controls this. The Memory in which the CPU's ''microcode'' 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. Microprograms consist of series of microinstructions. These microinstructions control the computer's Central Processing Unit ( CPU ) at a very fundamental level. For example, a single typical microinstruction might specify the following operations:
To simultaneously control all of these features, the microinstruction is often very wide, for example, 56 bits or more. THE REASON FOR MICROPROGRAMMING Microcode was originally developed as a simpler method of developing the control logic for a computer. Initially CPU instruction sets were "hard wired". Each machine instruction (add, shift, move) was implemented directly with circuitry. This provided fast performance, but as instruction sets grew more complex, hard-wired instruction sets became more difficult to design and debug. Microcode alleviated that problem by allowing CPU design engineers to write a microprogram to implement a machine instruction rather than design circuitry for that. Even late in the design process, microcode could easily be changed, whereas hard wired instructions could not. This greatly facilitated CPU design and led to more complex instruction sets. Another advantage of microcode was the implementation of more complex machine instructions. In the 1960s through the late 1970s, much programming was done in assembly language, a symbolic equivalent of machine instructions. The more abstract and higher level the machine instruction, the greater the programmer productivity. The ultimate extension of this were "Directly Executable High Level Language" designs. In these each statement of a high level language such as PL/1 would be entirely and directly executed by microcode, without compilation. The IBM Future Systems Project and Data General Fountainhead Processor were examples of this. Those systems were never produced, but elements of the IBM project were implemented in the System/38 and AS/400 , which used extensive microprogramming to implement high level constructs. For example the System/38 and AS/400 could perform a Relational SQL Join in a machine instruction. Microprogramming also helped alleviate the memory bandwidth problem. During the 1970s, CPU speeds grew more quickly than memory speeds. Numerous acceleration techniques such as memory block transfer, memory pre-fetch and multi-level caches helped reduce this. However high level machine instructions (made possible by microcode) helped further. Fewer more complex machine instructions require less memory bandwidth. For example complete operations on character strings could be done as a single machine instruction, thus avoiding multiple instruction fetches. Architectures using this approach included the IBM System/360 and DEC VAX family used complex microprograms. The IBM System/38 and AS/400 took this concept even further. The approach of using increasingly complex microcode-implemented instruction sets was later called CISC . OTHER BENEFITS A processor's microprograms operate on a more primitive, totally different and much more hardware-oriented architecture than the assembly instructions visible to normal programmers. In coordination with the hardware, the microcode implements the programmer-visible architecture. The underlying hardware need not have a fixed relationship to the visible architecture. This makes it possible to implement a given instruction set architecture on a wide variety of underlying hardware micro-architectures. Doing so is important if binary program compatibility is a priority. That way previously existing programs can run on totally new hardware without requiring revision and recompilation. However there may be a performance penalty for this approach. The tradeoffs between application backward compatibility vs CPU performance are hotly debated by CPU design engineers. 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 microarchitecture with only a few hardware registers; everything that the programmer saw was emulated by the microprogram. Other, faster models used 16-bit or 32-bit underlying microarchitectures that more-closely resembled the programmer-visible architecture; this allowed much faster execution speeds. In 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. A similar approach was used by Digital Equipment Corporation in their VAX family of computers. Initially a 32-bit TTL processor in conjunction with supporting microcode implemented the programmer-visible architecture. Later VAX versions used different microarchitectures, yet the programmer-visible architecture didn't change. Microprogramming also reduced the cost of field changes to correct defects ( 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 Before 1951, the control logic for central processing units was designed by '' Ad Hoc '' methods. One of the simplest was to use rings of Flip-flop s to sequence the computer's control logic. In 1951 Maurice Wilkes had a fundamental insight. He realized that if one takes the control signals for a computer, one could understand them as being played much like a Player Piano roll. That is, they are controlled by a sequence of very wide words constructed of Bit s. IMPLEMENTATION A microprogram provides the bits to control these. The fundamental advance is that CPU control becomes a specialized form of a computer program. It thus transforms a complex electronic design challenge (the control of a CPU) into a less-complex programming challenge. To take advantage of this, computers were divided into several parts: A Microsequencer picked the next word of the Control Store . A sequencer is mostly a counter, but usually also has some way to jump to a different part of the control store depending on some data, usually data from the Instruction Register and always some part of the control store. The simplest sequencer is just a register loaded from a few bits of the control store. A Register set is a fast memory containing the data of the central processing unit. It may include the program counter, stack pointer, and other numbers that are not easily accessible to the application programmer. Often the register set is triple-ported, that is, two registers can be read, and a third written at the same time. An Arithmetic And Logic Unit performs calculations, usually addition, logical negation, a right shift, and logical AND. It often performs other functions, as well. There may also be a Memory Address Register and a Memory Data Register , used to access the main Computer Storage . Together, these elements form an " Execution Unit ." Most modern CPUs have several execution units. Even simple computers usually have one unit to read and write memory, and another to execute user code. These elements could often be bought together as a single chip. This chip came in a fixed width which would form a 'slice' through the execution unit. These were known a 'bit slice' chips. The parts of the execution units, and the execution units themselves are interconnected by a bundle of wires called a Bus . Programmers develop microprograms. The basic tools are software: A Microassembler allows a programmer to define the table of bits symbolically. A Simulator program executes the bits in the same way as the electronics (hopefully), and allows much more freedom to debug the microprogram. A typical micromachine's control word has a field, a range of bits, to control each piece of electronics in the CPU. For example, one simple arrangement might be:
|