Vous êtes sur la page 1sur 2

Microprogramming Concepts

O p e r a t i o n
O p - c o d

A c do dd r e e I s n s s t r u c t i o n
e

r e

is t e r

C
g

t r o

r a

c h

r e

M a p p i n g R O M lo o k s u p s t a r t i n a d d r e s s o f m i c r o p r o g r a m
s s S t a r t a d d r e s s

i t The microprogrammed control unit takes a macro-instruction (machine level


instruction) and uses it to locate the first microinstruction in the control store. A MAPing ROM takes the macroinstruction op-code and simply looks up the first address of the microprogram memory in the microprogram ROM (or control store). Microinstructions are read from the control store and their bits used to control the computer. A microinstruction contains fields that

ic r o

p
M

r o

r a m
in

c o

n
n

t e
a

r C
d d

l o c k
r e s s

i c r o

s t r u

c t i o

A M

d p a

r e r o t a

s s g r a m R M O M

ic r o D

select the next microinstruction address (a ic r o i n s t r u c t io n r e g i s t e r jump or the next address in sequence). M i c r o in s t r u c t i o n C o n t r o l s ig n a ls l t o b u s e s , A L U , r e g is t e r s s x t m i c r o C i n o s n t rd u i tc i ot i on n C l e P c Ut c o n t r o l f ie l d a d d r e s sc o d e s e

F C o n d i t i o n c o m u lt i p le x e r s s c o n t r o l d e

x t

r e

r o m C a r r Z e r o O v e N e g

t h y

r f lo w a t i v e

The microinstruction field may be very long because it includes the tristate bus drivers, register clocks, ALU function inputs, memory controls and so on. There are two approaches to dealing with a microinstruction. One is called horizontally encoding and the other vertically encoding. In a system with horizontal encoding, the bits of the microinstruction directly control the CPU; for example, if there are 8 registers that can put data on a bus, there will be eight enable signals, one for each register. In vertical encoding, a secondary decider is required between the microinstruction register and the computer being controlled. For example, if there are 8 registers that can put data on a bus, the instruction register may use three bits to select one of eight registers. Additional logic must be used to convert the three-bit register select code into one of eight enable signals, one for each register.

Horizontal encoding uses one control signal per control point, whereas vertical encoding uses microinstruction fields that are encoded and must be further decoded to generate actual control signals (via logic or via ROM look-up table decoders). A vertically encoded instruction register is slower than a horizontally encoded instruction register because additional delays are required for the decoding. In a horizontally encoded microinstruction, operations can be carried out in parallel (e.g., you can select multiple registers as the destination of an operand). This is not possible with vertical encoding where, say, a register select field defines one specific register. A real system might use a mixture or vertical and horizontal encoding. Nanoprogramming If you examine microcode in a control store, you will find that some microinstruction words appear over and over again; for example, an operation such as read a word from memory and put it in the MBR may be used by many microinstructions. It has been observed that out of the billions of possible microinstruction words only a tiny fraction are found in any control store. Consequently, a modification of the conventional control store has been suggested the nanoprogram store. The nanoprogram store holds the actual microinstructions that are executed. These nanoinstructions are very wide. The control store itself contains a table of pointers to the microinstruction in the nanoprogram ROM. Consequently, nanoprogramming uses a two-level store to save bits at the cost of speed. The figure illustrates the relationship between the mapping ROM, control store, and nanoprogram ROM.

Example A computer has an 8-bit op-code and defines 200 unique machine-level (macroinstructions). Each macroinstruction is implemented in terms of 4 microinstructions. A microinstruction is 150 bits wide. It is observed that there are only 120 unique microinstructions. (a) How many bits of control store in all its forms are required by this arrangement? (b) How many bits would be required if nanoprogramming werent used? (a) There are 200 macroinstructions and each uses 4 microinstructions. This requires 200 x 4 = 800 microinstructions. The mapping ROM has to select one of 800 microinstructions. This requires a 10-bit address (210 = 1024). The mapping ROM takes an 8-bit op-code and selects a starting microprogram address. This requires a 256 word x 10-bit ROM (i.e., 2560 bits). There are 120 unique microinstructions each of which is 150 bits wide in the nanoprogram ROM; this is 120 x 150 = 18,000 bits. Because there are 120 microinstructions, it takes a 7-bit address to select one of 120 microinstructions (27 = 128). The control store contains 800 microinstructions, each requiring a 7-bit pointer which takes 800 x 7 = 5,600 bits. The total storage is 2,560 (mapping ROM) + 5,600 (control store) + 18,000 (nanoprogram) = 26,160 bits. (b) If the system does not use nanoprogramming, the control store requires 800 words x 150 bits = 120,000. The total number of bits is control store plus mapping ROM = 120,000 + 2,560 = 122,560 bits.