Control Unit

Microprogrammed control unit

History
How microprogram work
Horizontal microprogram
Vertical microprogram

Maurice Wilkes invented "microprogram" in 1953.  He realised an idea that made a control unit easier to design and is more flexible. His idea is that a control unit can be implemented as a memory which contains patterns of the control bits and part of the flow control for sequencing those patterns.  Microprogram control unit is actually like a miniature computer which can be "programmed" to sequence the patterns of control bits.  Its "program" is called "microprogram" to distinguish it from an ordinary computer program. Using microprogram, a control unit can be implemented for a complex instruction set which is impossible to do by hardwired.  Wilkes told his realisation by his own words:

Maurice Wilkes 1953, he thought of a centralized control using diode matrix and, after visiting the Whirlwind computer in U.S., wrote :

I found that it did indeed have a centralized control based on the use of a matrix of diodes.  It was, however, only capable of producing a fixed sequence of 8 pulses -- a different sequence for each instruction, but nevertheless fixed as far as a particular instruction was concerned.  It was not, I think, until I got back to Cambridge that I realized that the solution was to turn the control unit into a computer in miniature by adding a second matrix to determine the flow of control at the microlevel and by providing for conditional micro-instructions.  [Wilkes 1985]
His idea was too far ahead of its time as it required high speed memory which was not possible at that time.  Microprogram approach for control unit has several advantages :
1.  One computer model can be microprogrammed to "emulate" other model.
2.  One instruction set can be used throughout different models of hardware.
3.  One hardware can realised many instruction sets. Therefore it is possible to choose the set that is most suitable for an application.

At IBM, a chief architect of IBM 360 family, Gene Amdahl, has recognised the importance of microprogram and committed to implement it for IBM 360 to the point that in-house development for the high speed memory was pursued.  IBM had a great success for her 360 family and soon other manufacturers followed.

How microprogram work
Like the RAM model, microprogrammed control unit composed of microprogram PC, micro memory, output buffer and a sequencing unit.  Micro memory (sometime called micro store) contains bit patterns that are used to control the datapath.  Each word of micro memory is separated into several fields: internal control, external control, conditional, next address.  Internal control bits are the signals that control the datapath.  External control bits are the signals that control external unit such as memory (read, write), interrupt acknowledge etc.  Conditionals are the bits that are used to determine the flow of microprogram; loop, branching, next instruction etc. Its input comes from the datapath (usually from the conditional code register).  Next address determines the next microword to be executed.

A microprogram is executed as follow :
1.  a word from microprogram at the location specified by the microPC is read out, control bits are latched at the output buffer which is connected to the datapath.
2.  if conditional field is specified and the test for conditional is true, the next address of microprogram will come from the next address field otherwise the microPC will be incremented (execute the next microword).

What that has been described is called horizontal microprogram.  The microword can have other formats.  There are several possibilities :
1.  single format, one address as just described above.
2.  single format, two addresses, contain two next addresses field, one for result of test true, the other for result of test false.
3.  multiple format, such as, one format for the control bits without the next address field and another format for "jump on condition" with the address field.  The advantage is that the microword can be shorter than the single format.  The disadvantage is that to "jump" will take one extra clock.

Horizontal microprogram allows each control bit to be independent from other therefore enables maximum simultaneous events and also offers great flexibility. It is also waste a lot bit. For each field of microword, there may be a group of bits that are not activated at the same time therefore they can be "encoded" to use a fewer bit.  A decoder is required to  "decode" these bits and to connect them to the datapath.  This approach is called vertical microprogram.  There are many possibilities to compact the micro memory to be as small as possible, sometime trading off speed for space, for example, two level microprogram.  The first level is "vertical" i.e. maximally encoded, the microword of the level one is pointed to the "horizontal word" of the second level.  This is rather like the first level is composed entirely from "subroutine call" and the second level is the subroutine.

Microprogram becomes obsolete mainly because the present design emphasises the performance and microprogram is slower than hardwired.  The change in instruction set design toward a minimum number of clock per instruction simplifies the instruction set to the point that microprogram is not really required.  Also the design of hardwired control unit can be mostly automated as opposed to microprogram which must be "written" and "debug".  Hence, for the current instruction set architecture, hardwired control unit offers a lower engineering cost.