Microcode

From Simple English Wikipedia, the free encyclopedia
Revision as of 09:20, 25 April 2010 by Eptalon (talk | changes) (Removed category "Software"; Quick-adding category "Microprocessor design" (using HotCat))

Microcode is the name for a number of instructions or data structures which in involved in implementing higher-level machine language in many processors, especially microprogrammed ones. Microcode is on memory that is very fast to access. When a machine level instruction needs to be executed, microcode tells the processor what electronic circuits should be used. When a new processor is designed, an engineer also writes the microcode for the instructions of machine language. This is called Microprogramming, the resulting code is called a microprogram.

In early processors, each instruction was hard-wired. This has several drawbacks, the most obvious is that correcting an error in processor design means that the processor needs to be replaced.

Example

A processor should add two values, which are in registers A and B.

  1. Configure the ALU for addition
  2. Put the value of register A on one input of the ALU
  3. Put the value of register B on one input of the ALU
  4. After waiting a short time, to allow for the addition, the result needs to be copied into a register, which has not been used yet
  5. The value of that register needs to be copied to register A
  6. The next instruction needs to be fetched from memory

Items 1-3, as well as 5-6 can be coded as one instruction. It is also possible to hard-wire the logic needed for this operation. This has the benefit of being faster, but the drawback that it no longer allows changes that might be needed later on.

The concept of microprogramming was developed by Maurice Wilkes in 1951, using diode matrices for the memory element.