Design of Control Unit
Design of Control Unit
• Comparative study
2
Introduction-Prerequisites
• Functional Units of the Computer
• Main memory
• Secondary memory
• Cache
• Virtual
• Multiprogramming environment
3
Hardwired control unit 2.1.1
• To execute an instruction, the control unit of the CPU must generate
the required control signal in the proper sequence.
• There are two approaches used for generating the control signals in
proper sequence as Hardwired Control unit and Micro-programmed
control unit.
• The Control Unit is classified into two major categories:
• Hardwired Control
• Microprogrammed Control
4
Types of the Control Unit
5
Hardwired Control Unit
8
Hardwired Control Unit
9
Block Diagram of Hardwired Control Unit
10
Block Diagram of Hardwired Control Unit
• A Hard-wired Control consists of two decoders, a sequence counter, and a
number of logic gates.
• An instruction fetched from the memory unit is placed in the instruction register
(IR).
• The component of an instruction register includes; I bit, the operation code, and
bits 0 through 11.
• The operation code in bits 12 through 14 are coded with a 3 x 8 decoder.
• The outputs of the decoder are designated by the symbols D0 through D7.
• The operation code at bit 15 is transferred to a flip-flop designated by the symbol
I.
• The operation codes from Bits 0 through 11 are applied to the control logic gates.
• The Sequence counter (SC) can count in binary from 0 through 15.
11
Design of HardWired Control Unit
12
Design of HardWired Control Unit
• Control signals for instruction execution must be generated during the whole time range
that corresponds to the cycle of instruction execution, not just at a single moment in time.
• The control unit organises the appropriate sequence of internal states based on the
structure of this cycle.
• The control signal generator matrix sends a number of signals back to the inputs of the
following control state generator matrix.
• This matrix mixes these signals with the timing signals created by the timing unit
depending on the rectangular patterns typically provided by the quartz generator.
• The control unit is in the beginning state of new instruction, fetching whenever a new
instruction arrives at it.
• Instruction decoding permits the control unit to enter the first state relevant to the new
instruction execution, which lasts as long as the computer’s timing signals as well as other
input signals, such as flags and state information, stay unchanged.
• A change in any of the previously stated signals causes the control unit’s status to change.
13
Design of HardWired Control Unit
• A new corresponding input for the control signal generator matrix is formed
as a result of this.
• When an external signal (such as an interrupt) comes, the control unit
enters the next control state, which is concerned with the response to the
external signal (for example, interrupt processing).
• The computer’s flags and state variables are utilised to choose appropriate
states for the cycle of instruction execution.
• The cycle’s last states are control states that begin fetching the program’s
next instruction: sending the program’s counter content to the address of
the main memory buffer register and then reading the instruction word
into the computer’s instruction register. The control unit enters an OS state,
where it waits for the next user directive when the running instruction is
the stop instruction, which terminates programme execution.
14
Design of HardWired Control Unit
15
• A hardwired control is a mechanism of producing control signals
using Finite State Machines (FSM) appropriately.
• It is designed as a sequential logic circuit.
• The final circuit is constructed by physically connecting the
components such as gates, flip flops, and drums.
• Hence, it is named a hardwired controller.
• The figure shows a 2-bit sequence counter, which is used to develop
control signals.
• The output obtained from these signals is decoded to generate the
required signals in sequential order.
16
• The hardwired control consists of a combinational circuit that outputs
desired controls for decoding and encoding functions. The instruction
that is loaded in the IR is decoded by the instruction decoder. If the IR is
an 8-bit register, then the instruction decoder generates 28 (256) lines.
• Inputs to the encoder are given from the instruction step decoder,
external inputs, and condition codes.
• All these inputs are used and individual control signals are generated.
• The end signal is generated after all the instructions get executed.
Furthermore, it results in the resetting of the control step counter,
making it ready to generate the control step for the next instruction.
• The major goal of implementing the hardwired control is to minimize
the cost of the circuit and to achieve greater efficiency in the operation
speed.
17
Advantages of Hardwired
Control Unit
• Hardwired Control Unit is quick due to the usage of combinational
circuits to generate signals.
• The amount of delay that can occur in the creation of control signals
is dependent on the number of gates.
• It can be tweaked to get the fastest mode of operation.
• Quicker than a micro-programmed control unit.
• Extremely fast
• Instruction set size is small as hardwired control unit relies on
hardware more.
• The rapid mode of operation can be produced by optimising it.
18
Disadvantages of Hardwired
Control Unit
• As we require additional control signals to be created, the design becomes more
complex (need for more encoders or decoders).
• Changes to control signals are challenging since they necessitate rearranging
wires in the hardware circuit.
• It’s difficult and time-consuming to add a new feature.
• It’s difficult to evaluate and fix flaws in the initial design.
• It’s a bit pricey.
• Modification becomes tougher as each time we have to play with complex
circuits.
• Difficult to handle complex instructions.
• Design is complicated, and decoding is complex.
19
CONTROL UNIT: Implementation
• Hardwired Memory Instruction code
20
MICRO PROGRAMMED CONTROL UNIT
• Control signals
• Control variables
• Control word
21
• Control memory
• Memory contains control words
• Microinstructions
• Control words stored in control memory
• Specify control signals for execution of micro
operations
• Micro program
• Sequence of microinstructions
22
MICRO PROGRAMMED CONTROL UNIT
23
MICRO PROGRAMMED CONTROL UNIT
• The Control memory address register specifies the address of the micro-instruction.
• The Control memory is assumed to be a ROM, within which all control information
is permanently stored.
• The control register holds the microinstruction fetched from the memory.
• The micro-instruction contains a control word that specifies one or more micro-
operations for the data processor.
• While the micro-operations are being executed, the next address is computed in
the next address generator circuit and then transferred into the control address
register to read the next microinstruction.
• The next address generator is often referred to as a micro-program sequencer, as it
determines the address sequence that is read from control memory.
24
Microprogrammed Control Unit
• Microprogrammed Control Unit has a sequence of microinstructions
stored in control memory.
• These microinstructions refer to a control word that resides in control
memory, containing control signals for execution of micro-operations.
• Furthermore, a Microprogrammed Control Unit is used in processors
based on complex instruction set known as Complex Instruction Set
Computer (CISC).
• Overall, these control units have a simple structure.
• Therefore, it is easier to design, implement and test.
• Moreover, Microprogrammed Control Units are easier to modify.
25
Microprogrammed Control Unit
• The control signals associated with operations are stored in special
memory units inaccessible by the programmer as Control Words.
• Control signals are generated by a program are similar to machine
language programs.
• Micro-programmed control unit is slower in speed because of the
time it takes to fetch microinstructions from the control memory.
26
Microprogrammed Control Unit
• If the control memory grows horizontally, due to an increase
in control signals, it is referred to as horizontal
microprogramming.
• If the control memory grows vertically, due to an increase in
control signals, and the bits are decoded then it is referred to
as vertical microprogramming.
• If we are using two-level control memory providing both the
advantage of horizontal and vertical microprogramming,
then it is referred to as nano programming.
• Memory access time in nano programming is increased as
two levels are to be traversed.
27
CONTROL MEMORY
Control memory
Contains microprograms (set of microinstructions)
Microinstruction contains
Bits that initiate microoperations
Bits that determine address of next microinstruction
Control address register (CAR)
Specifies address of next microinstruction
29
Contd..
30
Contd..
31
MICRO PROGRAM ROUTINES
• Routine
• Group of microinstructions stored in control
memory
• The Micro Programmed Control follows the sequence of steps as listed below –
• The CPU breaks down the final instruction into sequential operations known as
microinstruction
• The control signals facilitate the execution of sequential micro-operations
• The CPU executes the instructions on the data direction by generating the
control signals in the ROM. These control signals can direct the micro-
operations associated with a microinstruction at any time step
• Following the sequence, it then generates the address of the next
microinstruction to be executed
• Finally, it repeats the two preceding steps until the CPU executes all of the
microinstructions associated with the instruction in the set
34
Conclusion
• The Micro Programmed Control is a simple logical microprogramm
present in the control memory that facilitates the generation of
control signals.
• The main benefit of using a microprogrammed control is that no
further changes can be made once the hardware configuration is set.
• If a different control sequence is to be used, a new set of
microinstructions for the system must be written.
35
y p e s o fM ic ro p ro g ra m m e d C o n tro lU n it
T
39
• Example:
A microinstruction in vertical microprogramming might look like this:
• | Opcode | Control Code |
• | 1010 | 1100 |
• The Control Code (1100) needs to be decoded into actual control
signals.
• The decoding process adds extra time, making execution slower.
• 🔸 Best for:
✅ Memory-constrained systems where reducing microinstruction
storage is essential.
40
Vertical Microprogrammed
• The bits of the micro-instruction are
decoded.
• The decoded output decides the
control signal to be produced.
• N bits in the micro-instruction will
totally generate 2N control signals.
• But one control can be generated by
one micro-instruction.
• More micro-instructions are needed.
• Also, the decoding makes the
execution slower.
• The circuit is complex.
41
Comparison: Horizontal vs. Vertical
Microprogramming
Feature Horizontal Microprogramming Vertical Microprogramming
42
• 3. Nano Microprogramming
• Instead of directly using microinstructions to generate control signals, it
further translates them into nano-instructions stored in a nanomemory.
• It acts as a compressed microprogramming method that reduces
redundancy in microinstructions.
• 🔹 Example of Nano Microprogramming
• Scenario: Executing an ADD Instruction
• Traditional Microprogrammed Control Unit:
• A microinstruction may directly generate 10-15 control signals, leading to
redundancy.
• Nano Microprogrammed Control Unit:
• The microinstruction is broken into nano-instructions, where common
operations are reused.
43
• For example:
• Microinstruction: Fetch operands → Perform addition → Store result
• Nano-instructions:
• Fetch operand 1
• Fetch operand 2
• Send to ALU
• Perform addition
• Store result
• This reduces duplicate microinstructions and optimizes control
memory usage.
44
• 🔹 Advantages of Nano Microprogramming
• ✔ Reduces control memory size (by eliminating redundant
microinstructions).
✔ More efficient execution of complex instructions.
✔ Enhances flexibility while reducing memory requirements.
✔ Improves performance by reusing frequently needed nano-
instructions.
45
• Need for nano programming :
• Horizontal micro-instructions can produce multiple control signals
simultaneously but are very wide. This makes the control memory
very large.
• Vertical micro-instructions are narrow, but after decoding, only
produce one control signal. This makes the control memory small, but
the execution is slow.
• Both methods have their own pros and cons.
• Hence, a combination of both techniques is needed to be called nano
programming.
46
• Nano programming :
• Here we have a two-level control memory.
• The instruction is fetched from the main memory into instruction register IR.
• Using its opcode we load address of its first micro-instruction into µPC,
• Using this address we fetch the micro-instruction from micro control memory (µCM) into
micro instruction register µIR.
• This is in vertical form and decoded by a decoder.
• The decoded output loads a new address in a nano program counter (nPC).
• By using this address, the nano-instruction is fetched from nano-control memory (nCM)
into nano instruction register (nIR).
• This is in horizontal form and can directly generate control signals which can be multiple at
a time.
• Such a combination gives advantage of both techniques.
• The size of the control Memory is small as micro-instructions are vertical.
47
48
Example –
• Suppose processors have 32 instructions (8 for arithmetic operations 8 for data transfer operations,
8 for logical operations 8 for shift operation). Suppose we require 32 control signals total in which 8
are responsible for performing data transfer operation, 8 for logical,8 for a shift, and 8 for
arithmetic.
• If we implement it by horizontal micro-instruction, then the size of each micro-instruction should be
32 bits.
• Most probably for data transfer operation we don’t need a control signal for the other 3 types of
instruction so in the whole micro-instruction the 27 bits for generating control signals for different 3
instruction types are 0 (garbage) which makes lots of memory space waste, also control memory
size increases.
• If we use nano programming, then micro-control memory has instructions for identifying the type
of the instruction by decoding i.e using vertical micro-instruction.
• After identifying the type of instruction the nano control memory is responsible for generating
control signals for that particular instruction type that is identified previously. So the advantage of
that is every nano instruction size reduces to 8 bits and every micro-instruction size reduces to 2
bits(for identifying 4 different types of instruction and for 2×4 decoder) i.e advantage of vertical
micro-instruction also we can produce multiple control signal for a particular instruction type
simultaneously which is an advantage of horizontal instruction.
49
• Disadvantage of Nano programming
• Increased memory access time:- The main disadvantage of the two
level memory approaches is the loss of speed due to theextra
memory access required for Nano control memory.
50
Types of Micro-programmed Control
Unit –
• Horizontal Micro-programmed control Unit:
• The control signals are represented in the decoded binary format that is
1 bit/CS.
• Example: If 53 Control signals are present in the processor than 53 bits
are required. More than 1 control signal can be enabled at a time.
• It supports longer control word.
• It is used in parallel processing applications.
• It allows higher degree of parallelism. If degree is n, n CS are enabled
at a time.
• It requires no additional hardware(decoders). It means it is faster than
Vertical Microprogrammed.
• It is more flexible than vertical microprogrammed
51
Horizontal Micro-programmed Control Unit:
53
Horizontal Micro-programmed
Control Unit:
54
Vertical Micro-programmed
control Unit:
• The control signals are represented in the encoded binary format. For
N control signals- Log2(N) bits are required.
• It supports shorter control words.
• It supports easy implementation of new control signals therefore it
is more flexible.
• Requires an additional hardware (decoders) to generate control
signals, it implies it is slower than horizontal microprogrammed.
• It is less flexible than horizontal but more flexible than that of
hardwired control unit.
55
Vertical Micro-programmed
control Unit:
• Here, the CPU represents the control signals in the encoded binary format. It
requires Log2(N) bits for N control signals.
• It allows for control words of shorter length
• Because it necessitates the use of additional hardware (decoders) to
generate control signals, it implies that it is slower than horizontal
microprogramming
• It implements new control signals, making it more adaptable
• It is more flexible than a hardwired control unit but less flexible than a
horizontal control unit
• It allows for a low degree of parallelism, with the degree of parallelism being
either 0 or 1
56
Vertical micro-instruction :
•
Here, we will discuss the vertical micro-instruction format as follows.
• The bits of the micro-instruction are decoded.
• The decoded output decides the control signal to be produced.
• N bits in the micro-instruction will totally generate 2N control signals.
• But one control can be generated by one micro-instruction.
• More micro-instructions are needed.
• Also, the decoding makes the execution slower.
• The circuit is complex.
57
Vertical Micro-programmed
control Unit:
58
Nano programming :
59
Nano programming :
60
Nano programming :
• Example –
• Suppose processors have 32 instructions (8 for arithmetic operations 8 for
data transfer operations, 8 for logical operations 8 for shift operation).
Suppose we require 32 control signals total in which 8 are responsible for
performing data transfer operation, 8 for logical,8 for a shift, and 8 for
arithmetic.
• If we implement it by horizontal micro-instruction, then the size of each
micro-instruction should be 32 bits. Most probably for data transfer operation
we don’t need a control signal for the other 3 types of instruction so in the
whole micro-instruction the 27 bits for generating control signals for different
3 instruction types are 0 (garbage) which makes lots of memory space waste,
also control memory size increases.
61
Nano programming :
63
Advantages and Disadvantages
• Advantages of Micro-programmed Control Unit
• Micro-program can be updated easily.
• Flexible.
• Better in terms of scalability than hardwired.
• Easier to handle complex instructions.
• Design is systematic, and decoding is pretty much straightforward.
• Disadvantages of the Micro-programmed Control Unit
• Hardware cost is more because of control memory and its access circuitry.
• Slower than a hardwired control unit.
• Instruction set size is comparatively large as this relies on microprogramming.
•
64
65
DESIGN OF CONTROL UNIT
microoperation fields
F1 F2 F3
AND
ADD AC
Arithmetic
logic and
DRTAC shift unit DR
From From
PCTAR
DRTAR
PC DR(0-10) Load
AC
Select 0 1
Multiplexers
Load Clock
AR
66
Input Logic for Micro-program
Sequencer
1 L L(load SBR with PC) for subroutine Call
From I MUX2 Test
S T
CPU Z Select BR field Input
I0 logic S0 for next address
of CS I1
S1 selection
CD Field of CS
Input Logic
I1I0T Meaning Source of Address S1S0 L
• Resultant design is inflexible, and difficult to build upon (Pipeline, multiple computation units, etc.)
• Adding new instructions requires major design and adds complexity quickly
68
Advantages and Disadvantages of
Microprogramming
Advantage:
• Cheaper
• Less error-prone
• Easier to modify
Disadvantage:
• Slower
69
Comparative Study
Micro programmed control
• Micro programmed control is a control mechanism to generate control signals by using a memory
called control storage (CS), which contains the control signals. Although micro programmed control
seems to be advantageous to CISC machines, since CISC requires systematic development of
sophisticated control signals, there is no intrinsic difference between these 2 control mechanisms.
Hard-wired control
• Hardwired control is a control mechanism to generate control signals by using appropriate finite
state machine (FSM). The pair of "microinstruction-register" and "control storage address register"
can be regarded as a "state register" for the hardwired control. Note that the control storage can be
regarded as a kind of combinational logic circuit. We can assign any 0, 1 values to each output
corresponding to each address, which can be regarded as the input for a combinational logic circuit.
This is a truth table
70
APPLICATIONS
• Computer organization and architecture course deals with instruction set architecture, micro
• Understanding the computer architecture concepts is essential for students interested in hardware,
71
REFERENCES
Reference Books:
1. J.P. Hayes, “Computer Architecture and Organization”, Third Edition.
2. Mano, M., “Computer System Architecture”, Third Edition, Prentice Hall.
3. Stallings, W., “Computer Organization and Architecture”, Eighth Edition, Pearson Education.
Text Books:
4. Carpinelli J.D,” Computer systems organization &Architecture”, Fourth Edition, Addison Wesley.
5. Patterson and Hennessy, “Computer Architecture” , Fifth Edition Morgaon Kauffman.
Reference Website
6. https://www.geeksforgeeks.org/computer-organization-and-architecture-tutorials/
72
THANK YOU