Cu Coa Lect Note
Cu Coa Lect Note
Lecturer Summary
1. Introduction to control unit
2. Hardwired control unit
3. Microprogrammed control unit
1 Introduction
In computer organization and architecture, the control unit is a fundamental component
responsible for directing and coordinating the operations of the CPU (Central Processing Unit).
It acts as the "brain" of the CPU, managing the execution of instructions and controlling the flow
of data within the processor.
In other words, the unit which directs the operation of the processor & is a part of the CPU is
known as Control Unit. It generates control signals for the operations of a computer.
Key Functions of Control Unit
For example,
Instruction Interpretation: The control unit fetches instructions from memory, decodes
them, and determines the actions required to execute them.
Instruction Decoding: Once fetched, the control unit decodes the instruction to understand
its operation code (opcode) and operands.
Instruction Execution: After decoding, the control unit coordinates the execution of the
instruction by issuing commands to the appropriate components within the CPU, such as the
arithmetic logic unit (ALU), registers, and memory units.
Sequencing: The control unit ensures that instructions are executed in the correct order,
following the program's logic. It manages the instruction pipeline and handles branch
instructions, jumps, and other control flow operations.
Timing and Synchronization: It generates timing signals to synchronize the activities of
various components within the CPU, ensuring proper coordination and data integrity.
Error Detection and Handling: The control unit may include mechanisms for detecting and
handling errors that occur during instruction execution, such as arithmetic overflow or
invalid memory accesses.
Overall, the control unit plays a crucial role in orchestrating the operation of the CPU, ensuring
that instructions are executed correctly and efficiently according to the program's logic. It acts as
a bridge between the CPU's hardware components and the software instructions being executed.
The actions needed to fetch and execute instructions are described in the previous sections. We
now examine how the processor generates the control signals that cause these actions to take
place in the correct sequence and at the right time. There are two basic approaches: hardwired
control and microprogrammed control.
Types of Control Unit: There are two types of control units as follows. The two approaches
have trade-offs in terms of area, speed, and flexibility.
a) Hardwired control unit: This type of control unit relies on fixed circuitry to decode
instructions and generate control signals. Hardwired control units are simple and fast, but
they are inflexible and cannot be easily modified to support new instructions.
b) Micro-programmed control unit: This type of control unit uses a special program called
microcode stored in control memory to decode instructions and generate control signals.
Microprogrammed control units are more complex than hardwired control units, but they
Computer Organisation and Acrchitecture (COA) Lecture Notes of Prof. Anil Kumar Swain, KIIT-CSE Page 1 / 10
are more flexible and can be easily modified to support new instructions by simply
updating the microcode.
Computer Organisation and Acrchitecture (COA) Lecture Notes of Prof. Anil Kumar Swain, KIIT-CSE Page 3 / 10
To derive the equation for Zin, we need to identify where Zin appears in each
instruction. In the case of the ADD instruction, it appears in step-1 and step-6, thus the
equation wrt ADD is T1.ADD + T6.ADD. Similarly, for the BR instruction, Zin
appears in step-1 and step-4 only, leading to the equation T1.BR + T4.BR. Combining
these, we can express it as follows:
Zin = T1.ADD + T6.ADD + T1.BR + T4.BR
= T1.ADD + T1.BR + T6.ADD + T4.BR
= T1 + T6.ADD + T4.BR (as this signal is asserted during time slot T1 for all
instructions )
So, now design a logic circuit for Zin = T1 + T6.ADD + T4.BR , which is as follows:
Assignment-Class-Work1: Derive the equation for Zout signal considering only the
instructions ADD (R3), R1 and BRANCH Label for the single-bus CPU and design logic
circuit for it
b. Example-2: Derive the equation for End signal considering only the instructions ADD (R3),
R1, BRANCH Label and BRANCH < 0 Label for the single-bus CPU and design logic
circuit for it
Solution
The sequence of control steps required for the single-bus CPU for the following instruction
ADD (R3), R1, BRANCH L1 and BRANCH < 0 are as follows:
Computer Organisation and Acrchitecture (COA) Lecture Notes of Prof. Anil Kumar Swain, KIIT-CSE Page 4 / 10
BRANCH < 0 L1 or BRN L1
Step Action
1. PCout, MARin, Read, Select 4, ADD, Zin
2. Zout, PCin, Yin, WMFC
3. MDRout, IRin
4. Offset-field-of-IRout, Select Y,ADD, Zin if N=0, then
End
5. Zout, PCin, End
To derive the equation for End, we need to identify where End appears in each
instruction (in this case three instructions such as ADD, BR and BRN).
In ADD, End appears in step-7, so we will write T7.ADD
In BR (unconditional branching), End appears in step-5 and it will execute always, so
we can write T5.BR
IN BRN, End appears in step-4 and step-5, but step-4 End will be executed if N=0 and
if N=1 then stp-5 End will be executed. So we can write T4.N.BRN + T5.N.BRN.
Combiningly we can write as follows:
End = T7.ADD + T5.BR + T4.N.BRN + T5.N.BRN + …
= T7.ADD + T5.BR + (T4.N + T5.N).BRN + ….
So, now design a logic circuit for End = T7.ADD + T5.BR + (T4.N + T5.N).BRN
+ …., which is as follows:
Assignment-Class-Work2: Derive the equation for WMFC signal considering only the
instructions ADD (R3), R1, BRANCH L1, BRANCH L1 < 0 for the single-bus CPU and
design logic circuit for it
Computer Organisation and Acrchitecture (COA) Lecture Notes of Prof. Anil Kumar Swain, KIIT-CSE Page 5 / 10
Rigidity: Modifying control signals is cumbersome as it involves rearranging hardware
circuitry.
Feature Expansion Difficulty: Adding new features is challenging and time-consuming.
Design Evaluation and Debugging: Identifying and rectifying flaws in the initial design is
difficult.
Cost: Hardwired Control Units tend to be more expensive compared to other control unit
types.
The following figure shows the CWs corresponding to the 7 steps of single bus architecture
for the instruction ADD (R3), R1 as shown above.
Microroutine
CW or
Microinstructions
Computer Organisation and Acrchitecture (COA) Lecture Notes of Prof. Anil Kumar Swain, KIIT-CSE Page 6 / 10
The block diagram of micorprogrammed control unit organization is shown below:
i. Sequencer: It is used to determine the address sequence that is read from control memory.
Next address of the next microinstruction can be specified several way depending on the
sequencer input
ii. Control Memory Address Register or Control Address Register or MicroProgram
Counter (µPC) : It contains the address of the next microinstruction to be executed.It is
used to read the control words sequentially from the control store.
iii. Control Store or Memory : It is used to store the microprograms (a series of
microinstructions) that can not be altered, means it is stored in a ROM. The microroutines for
all instructions in the instruction set of a computer are stored in a spectial memory called the
control store.
iv. Control Memory Data Register or Control Data Register: It holds the present
microinstruction while the next address is computed & read from control memory. Allows
the execution of the microoperations specified by the control word simultaneously with
thegeneration of the next microinstruction. This requires two phase clock, with one clock
applied to address register and other to data register.
v. Control Word (CW): It is a word whose individual bits represent the various control
signals. Each Word in Control Memory contains within it a microinstruction.
Computer Organisation and Acrchitecture (COA) Lecture Notes of Prof. Anil Kumar Swain, KIIT-CSE Page 7 / 10
Working of Microprogrammed Control unit
a) Address Sequencing
Microinstructions are usually stored in groups where each group specifies a routine,
where each routine specifies how to carry out an instruction.
Each routine must be able to branch to the next routine in the sequence.
An initial address is loaded into the µPC when power is turned on; this is usually the
address of the first microinstruction in the instruction fetch routine. That is when a
new instruction is loaded into the IR, the output of “Starting and Branch address
generator” block is loaded into the microprogram counter.
Next, the control unit must determine the effective address of the instruction.
b) Mapping
The next step is to generate the microoperations that executed the instruction. This
involves taking the instruction’s opcode and transforming it into an address for the the
instruction’s microprogram in control memory. This process is called mapping.
While microinstruction sequences are usually determined by incrementing the µPC
automatically by the clock, this is not always the case. If the processor’s control unit
can support subroutines in a microprogram, it will need an external register for storing
return addresses.
c) Conditional Branching:
When the control unit is required to check the status of the condition codes or external
inputs to choose between alternative courses of action, it uses conditional branch
microinstructions.
To allow implementation of a conditional branch, inputs to “Starting and Branch
address generator” block consists of the external inputs, condition codes and the
contents of the instruction register.
The microprogrammed counter (µPC) does not increment in the following situation:
- When a new instruction is loaded into IR
- When a branch micro instruction is encountered and the branch condition is
satisfied.
- When an End microinstruction is encountered.
Computer Organisation and Acrchitecture (COA) Lecture Notes of Prof. Anil Kumar Swain, KIIT-CSE Page 8 / 10
Drawback: Assigning individual bits to each control signal results in long microinstructions
because the number of required signals is usually large.
The length of the micro-instructions can be reduced easily, because most signals are not
needed simultaneously and many signals are mutually exclusive
Highly encoded schemes that use compact codes to specify only a small number of control
functions in each micro-instruction are referred to as vertical organization.
Difference
Horizontal Micro-organization Vertical Micro-organization
Minimally encoded scheme in which Highly encoded schemes that use compact
many resources can be controlled with a codes to specify only a small number of
single micro-instruction, is called a control functions in each micro-instruction
horizontal organization. are referred to as vertical organization.
This scheme is useful when a higher Vertical approach results in considerably
operating speed is desired and when the slower operating speeds because more
machine structure allows parallel use of micro-instructions are needed to perform
resources. the desired control functions.
Computer Organisation and Acrchitecture (COA) Lecture Notes of Prof. Anil Kumar Swain, KIIT-CSE Page 9 / 10
2 Home Assignment
Q1. Write the sequence of control steps for following instructions using single bus CPU organization.
INS1: Add 10(R3),R4
INS2: Branch<0, L1
INS3: MUL –(R5),R5
and design the logic function for WMFC control signal with reference to above instructions i.e
INS1 to INS3. Draw the circuit diagram for hardwired control unit.
Q2. Write the logic function expression and design circuit for Zin, End, Add, MDRout, PCin control
signal with reference to above instructions i.e INS1 to INS3 for hardwired control unit.
Computer Organisation and Acrchitecture (COA) Lecture Notes of Prof. Anil Kumar Swain, KIIT-CSE Page 10 / 10