The Control Unit Unit 4
The Control Unit Unit 4
I Structure
Introduction
Page No.
Objectives
The Control Unit
The Hardwired Control
Wilkes Control
The Micro-Programmed Control
The Micro-Instructions
4.6.1 Types of Micro-Instructions
4.6.2 Control Memory Organisation
4.6.3 Micro-Instruction Formats
The Execution of Micro-Program
Summary
Solutions1 Answers
4.0 INTRODUCTION
By now we have discussed instruction sets and register organisation followed by a
discussion on micro-operations and a simple arithmetic logic unit circuit. We have
also discussed the floating point ALU and arithmetic processors, which are
commonly used for floating point computations.
In this unit we are going to discuss the functions of a control unit, its structure
followed by the hardwired type of control unit. We will discuss the micro-
programmed control unit, which are quite popular in modem computers because of
flexibility in designing. We will start the discussion with several definitions about the
unit followed by Wilkes control unit. Finally, we will discuss the concepts involved
in micro-instruction execution.
4.1 OBJECTIVES
After going through this unit you will be able to:
.-
define what is a control unit and its function;
describe a simple control unit organization;
define a hardwired control unit;
define the micro-programmed control unit; ,
define the term micro-instruction; and
identify types and formats of micro-instruction.
But how does a control unit control the above operations? What are the functional
requirements of the control unit? What is its structure? Let us explore answers of
these questions in the next sections.
The basic responsibility of the control unit lies in the fact that the control unit must be
able to guide the various components of CPU to perform a specific sequence of
micro-operations to achieve the execution of an instruction.
\
What are the functions, which a control unit performs to make an instruction
execution feasible? The instruction execution is achieved by executing micro-
operations in a specific sequence. For dizcrent instructions this sequence may be
different. Thus the control unit must perform two basic functions:
Cause the execution of a micro-operation.
Enable t:-, CPU +o execute a proper sequence of micro-operations, which is
dpt: ..~nedby the instruction to be executed.
B11+how are these two tasks achieved? The control unit generates control signals,
which in turn are responsible for achieving the above two tasks. But, how are these
control signals generated? We will answer this question in later sections. First let us
discuss a simple structure of control unit.
The Control Unit
Structure of Control Unit
A control unit has a set of input values on the basis of which it produces an output
conrrol signal, which in turn performs micro-operations. These output signals control
the execution of a program. A general model of control unit is shown in Figure 1.
F within CPU
t
1
I
Flag values :
b
a Received fmm
system bus
b Co~ltmlUnit
Clock b
sendto
system bus
3
Control
bus
Figure 1: A General Model ofControl Unlt
In the model given above the control unit is a black box, which has certain inputs and
outputs.
Flags: Flags are used by the control unit for determining the status of the CPU &
the outcomes of a previous ALU operation. For example, a zero flag if set
conveys to control unit that for instruction ISZ (skip the next instruction if zero
i
flag is set) the next instruction is to be skipped. For such a case control unit
cause increment of PC by program instruction length, thus skipping next
instruction.
a Control Signals from Control Bus: Some of the control signals are provided to
the control unit through the control bus. These signals are issued from outside
the CPU. Some of these signals are interrupt signals and acknowledgement
signals.
On the basis of the input signals the control unit activates certain output control
signals, which in turn are responsible for the execution of an instruction. These output
) control signals are: .
a Control signals, which are required within the CPU: These control signals
The Central
Processing Unit Control signals to control bus: These control signals transfer data from or to
CPU register to or from memory or I/O interface. These control signals are
issued on the control bus to activate a data path on the data 1 address bus etc.
Now, let us discuss the requirements from such a unit. A prime requirement for
control unit is that it must h o w how all the instructions will be executed. It should
also know about the nature of the results and the indication of possible errors. All
this is achieved with the help of flags, op-codes, clock and some control signals to
itself.
A control unit contains a clock portion that provides clock-pulses. This clock signal is
used for measuring the timing of the micro-operations. In general, the timing signals
from control unit are kept sufficiently long to accommodate the proportional delays of
signals within the CPU along various data paths. Since within the same instruction
cycle different control signals are generated at different times for performing different
micro-operations, therefore a counter can be utilised with the clock to keep the count.
However, at the end of each instruction cycle the counter should be reset to the initial
condition. Thus, the clock to the control unit must provide counted timing signals.
Examples, of the functionality of control units along with timing diagrams are given
in further readings.
How are these control signals applied to achieve the particular operation? The
control signals are applied directly as the binaly inputs to the logic gates of the logic
circuits. All these inputs are the control signals, which are applied to select a circuit
(for example, select or enable input) or a path (for example, multiplexers) or any
other operation in the logic circuits.
Let us revisit the micro-operations described in Unit 2 to discuss how the events of
3r.r instruction cycle can be described as a sequence of such micro-operations.
L Fetch Cycle
The begnning of each instruction cycle is the fetch cycle, and causes an instruction to
be.fetched fiom memory.
The fetch cycle consists of four micro-operations that are executed in three timing
steps. The fetch cycle can be written as: ,
T , : M A R C PC
Tz : MBR t [MAR]
PC t P C + I
T3: IR t MBR
where I is the instruction length. We assume that a clock is available for timing
purposes and that it pmits regularly spaced clock pulses. Each clock pulse defines a
time unit. Thus, all the uruts are of equal duration. Each micro-operation can be
performa6 *ithin the time of a single time unit. The notation (TI, T2,T3) represents
successive time units. What is done in these time units?
In the first time unit the content of PC is moved to MAR. ,
In the second time unit the contents of memory location specified by MAR is
moved to MBR and the contents of the PC is incremented by I.
The Control Unit
In the third time unit tne content of MBR is moved lo IR.
l'he MAR is loaded with the address field of IR register. Then the memory is read to
fetch the address of operand, which is transferred to the address field of IR through
PIABR as data is received in MBR during the read operation.
l'hus, the IR now is in the same state as of direct address, viz., as if indirect
addressing had not been used. IR is now ready for the execute cycle.
'This is not true: of the execute cycle. For a machine with N different opcodes, there
2 re N different sequences of micro-operations that can occur. Let us consider some
l~ypotheticalir structions:
add instruction that adds the contents of memory location X to Register R1 with
111 storing the result:
ADD R1, X
t , i t the beginning of the execute cycle IR contains the ADD instruction and its direct
operand address (memory location X). At time T I ,the address portion of the IR is
lransferred to ?he MAR. At T2 the referenced memory location is read into MBR
]:inally, at T3 the contents of R1 and MBR are added by the ALU.
I
! Let us discuss one more instruction:
I 'iSZ X, it increments the content of memory location X by 1. If the result is 0, the next
:.nstructionin the sequence is skipped. A possible sequence of micro-operations for
~ b i sinstructioii may be:
T, : MAR f IR(address)
'r2 : MBR f [MAR]
The PC is incremented if MBR contains 0. This test and action can be implemented as
one micro-operation. Note also that this micro-operation can be performed during the
same time unit during which the updated value in MBR is stored back to memory.
Such instructions are usehl in implementing looping.
On completion of the execute cycle the current instruction execution gets completed.
At this point a test is made to determine whether any enabled interrupts have
occurred. If so, the interrupt cycle is performed. This cycle does not execute an
interrupt but causes start of execution of Interrupt Service Program (ISR). Please note
that ISR is executed as just another program instruction cycle. The nature of this
cycle varies greatly from one machine to another. A typical sequence of micro-
operations of the interrupt cycle are:
TI: M B R t P C
T2: MAR t Save-Address
PC t ISR- Address
T3: [MAR] t MBR
At time TI, the contents of the PC are transferred to the MBR, so that they can be
saved for return lkom the interrupt. At time T2 the MAR is loaded with the address at
which the contents of the PC are to be saved, and PC is loaded with the address of the
start of the interrupt-servicing routine. At time T3 MBR, which contains the old value
of the PC, is stored in the memory. The processor is now ready to begin the next
instruction cycle.
The instruction cycle for this given machine consists of four cycles. Assume a 2-bit
instruction cycle code (ICC). The ICC can represent the state of the processor in
terms of cycle. For example, we can use:
00 : Fetch
01 : Indirect
10 : Execute
11 : Interrupt
At the end of each of the four cycles, the ICC is set appropriately. Please note that r
indirect cycle is always followed by the execute cycle and the interrupt cycle is
always followed by the fetch cycle. For both the execute and fetch cycles, the next
cycle depends on the state of the system. Let us show an instruction execution using
timing diagram and instruction cycles:
The Control Unit
CLK
Signal
%-%
Dl,%
RD
WR
~ e n k r yread &tPt n
I
d
!
-4
3
-
Assumptiom: 10 bit address bus, 16 bit data bus, size of insmaion 16bits with 10 bit &dress, 6 bit opcode
Please note that the address line determine the location of memory. Read/ write signal
controls whether the data is being input or output. For example, at time T2in M2 the
read control signal becomes active, A9 - A, input contains MAR that value is kept
enabled on address bits and the data lines are enabled to accept data from RAM, thus
enabling a typical RAM data output on the data bus.
For reading no data input is applied by CPU but it is put on data bus by memory after
the read coiltrol signal to memory is activated. Write operation is activated along with
data buS carrying the output value.
This diagram is used for illustration of timing and control. However, more
information on these topics can be obtained from further readings.
The clock portion of the control unit issues a repetitive sequence of pulses for the SS
duration of micro-operation(s). These timing signals control the sequence of
execution of instruction and determine what control signal needs to applied at what
time for instruction execution. '
1 lrlstnrctior~register I
4
m I
1,
Decoder
I Ir~tnlctlonI
1, selectroll 11.
\
hnes
0 flags
Clock C0lItrol ulul fmm
sequerrlng
CPIJ
logrc
..................................................................................................................................
...................................................................................................
2. How does a control unit control the instruction cycle?
..................................................................................................
3. What is a hardwired control unit?
.................................................................................................................................. I
a) Control field which indicates the control lines which are to be activated and
b) Address field, which provides the address of the next microinstruction to be
executed.
Clock
signal
k-J Register I
I
Address of the next
micro-ulstniction
liming
sequel= Address
through decoder
Clock
- . ,
Cantml signals
Figure 4: Wilkes Control Unit
The control memory in Wilkes control is organized, as a PLA's like matrix made of
diodes. This is partial matrix and consists of two components, the control signals and
the address of the next micro-instruction. The register I contains the address of the
next micro-instruction that is one step of instruction execution, for example TI in MI
or T2 in M2 etc. as in Figure 2. On decoding the control signals are generated that
cause execution of micro-operation@) of that step. In addition, the control unit
indicates the address of the next micro-operation which gets loaded through register I1
to register I. Register I can also be loaded by register I1 and "enable IR input" control
signal. Thrs will pass the address of first micro-instruction of execute cycle. During a
machine cycle one row of the matrix is activated. The first part of the row generates
the control signals that control the operatioils of the processor. The second part
generates the address of the row to be selected in the next machine cycle.
At the beginning of the cycle, the address of the row to be selected is contained in
register I. This address is the input to the decoder, which is activated by a clock pulse.
Tile Central
Processing Unit
This activates the row of the control matrix. The two-register arrangement is needed,
as the decoder is a combinational circuit; with only one register, the output would
become the input during a cycle. This may be an unstable condition due to repetitive
loop.
l~~stnlction
register
r1
The micro-i:;atructions are stored in the control memory. The address register for the
control memory contains the address of the next instruction that is to be read. The
control memory Buffer Register receives the micro-instruction that has been read. 4
micro-instruction execution primarily involves the generation of desired control
signals and signals used to determine the next micro-instruction to be executed. The
sequencing logic section loads the control memory address register. It also issues a
read command to control memory. The following functions are performed by the
micro-programmed control unit:
I 1. The sequence logic unit specifies the address of the control memory word that is The Control Unit
1 to be read, in the Address Register of the Control Memory. It also issues the
I READ signal.
i 2.
3.
The desired control memory word is read into control memory Buffer Register.
The content of the control memory buffer register is decoded to create control
I
signals and next-address information for the sequencing logic unit.
4. The sequencing logic unit finds the address of the next control word on the basis
of the next-address information from the decoder and the ALU flags.
1 ..................................................................................................
2. State True or False
1 (a) A micro-instruction can initiate only one micro-operation at a time. ITIF(
(b) A control word is equal to a memory word.
3. What will be the control signals and address of the next micro-instruction in the
Wilkes control example of Figure 4, if the entry address for a machine
instruction selects the last but one (branching control line) and the conditional
bit value for branch is true?
..................................................................................................
Fetch cycle
Indimt cycle
lntcmpt cycle
Execute cycle
instruction each bit oft: micro-instruction represents a control signal, which directly
controls a single bus line or sometimes a gate in the machine. However, the length of
such a micro..instruction may be hundreds of bits. A typical horizontal micro-
instruction with its related fields is shown in Figure 7(a).
Inl~v~dual wnml I h v ~ d u awmml
l
s~g,mIfor ~ntemal signal for system
CF'U ~011trOl A mrrninenarlinn RILCcnntml
'1
I- +
lump conditions
(unconditional. zcm,
oveflow, indi.m)
F i i ~ r t i ocodes
~l
1
cm&mction branch address
23tiom
@) Vertical Micro-instructions
Individual
co~~trnl A micminstruotion
signal
In general, a horizontal control unit is faster, yet requires wider instruction words,
whereas vertical control units, although; require a decoder, are shorter in length. Most
of the systems use neither purely horizontal nor purely vertical micro-instructions
figure 7(c).
Since we are dealing with binary control signals, therefore, a 'N' bit micro-instruction
can represent 2Ncombinations of control signals.
Unencoded micro-instructions
One bit is needed for each control signal; therefore, the number of bits required
in a micro-instruction is high.
It presents a detailed hardware view, as control signal need can bbdetermined.
The Control Unit
Since each of the control signals can be controlled individually, therefore these
micro-instructions are difficult to program. However, concurrency can be
exploited easily.
I
I
Almost no control logic is needed to decode the instruction as there is one to
one mapping of control signals to a bit of micro-instruction. Thus, execution of
micro-instruction and hence the micro-program is faster.
The unencoded micro-instruction aims at optimising the performance of a
machine.
In most of the cases, the design is kept between the two extremes. The LSI 11 (highly
encoded) and IBM 3033 (unencoded) control units are close examples of these two
i~pproaches.
Another aspect of encoding is whether it is direct or indirect (Figure 8). With indirect
encoding, one field is used to determine the interpretation of another field.
f f C f E
J
con1101Signals
b lgure ( 0 ) : Indirect Encoding
FiEgiife E-Mrcro-instruction Encoding
1 4#.8 SUMMARY
In this unit we have discussed the organization of control units. Hardwired, Wilkes
and micro-programmed control units are also discussed. The key to such control units
are micro-instruction, which can be briefly (that is types and formats) described in
this unit. The function of a micro-programmed unit, that is, micro-programmed
execution, has also been discussed. The control unit is the key for the optimised
performance of a computer. The information given in this unit can be further
appended by going through further readings.
3. Wilkes control typically has one address field. However, for a conditional
branching micro-instruction, it contains two addresses. The Wilkes control, in