Inutitively I know what microcode is. I think of it
as hard-coded ROM
for the instruction fetch unit of the microprocessor. Since I haven't been
formally schooled in computer science or microprocessor design, I'd like to
understand (in 500 words or less <g>) how microcode works, i.e., how is it
implemented and how does the microprocessor access it.
The problem is that doing it right takes a picture...
A computer is built from (among other things) a whole grundle of
state machines. A state machine is a circuit that, at each clock cycle,
uses some number of inputs and its current state and uses them to generate
some number of outputs. The current state is a set of outputs that are fed
back into the machine; that is, they are outputs that become inputs to the
"next state generator", the logic which figures out what the outputs should
be at the next clock.
The next state generator is a complex piece of logic, especially for a
machine with a lot of states; the next state generator for a state machine
with, say, 256 states has 8 inputs just for the state variables! Designing
the next state generator for a state machine as complex as the control unit
of a CPU is very difficult and error-prone.
Microcode is simply a technique which replaces the logic of the next state
generator with a ROM. The inputs (including the current state) are fed
into the address of the ROM and the data from the ROM are taken to be
the outputs for the next state. Instead of implementing the logic by
tossing around gates, you implement the logic by building a lookup table
in the microcode ROM.
Roger Ivie
ivie(a)cc.usu.edu