Unit3 LDCA
Unit3 LDCA
Noida
Control Unit
Unit: 3
Swarnima COA 3
1
05/17/24
Content
Control Unit:
Instruction types, formats
Instruction cycles and sub cycles (fetch and execute etc)
Micro operations
Execution of a complete instruction.
Program Control
Reduced Instruction Set Computer
Pipelining
Hardwire and micro programmed control
Micro programmed sequencing
Concept of horizontal and vertical microprogramming.
SWARNIMA COA 3
05/17/24 2
Course Objective
SWARNIMA COA 3
05/17/24 3
Course Outcome
SWARNIMA COA 3
05/17/24 4
CO-PO Mapping
CO.K PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12
KCS-
302.3 3 2 2 1 2 2 1 1 2 2 1 2
05/17/24 5
SWARNIMA COA 3
CO- PSO Mapping
SWARNIMA COA 3
05/17/24 6
Prerequisite and Recap
SWARNIMA COA 3
05/17/24 7
Instruction
• Program
– A sequence of (machine) instructions
• (Machine) Instruction
– A group of bits that tell the computer to perform a specific
operation (a sequence of micro-operation)
• The instructions of a program, along with any needed data are
stored in memory
• The CPU reads the next instruction from memory
• It is placed in an Instruction Register (IR)
• Control circuitry in control unit then translates the instruction into
the sequence of micro operations necessary to implement it
SWARNIMA COA 3
05/17/24 8
Instruction Types
• Functional / Data Processing Instructions
- Arithmetic, logic, and shift instructions
- ADD, CMA, INC, CIR, CIL, AND, CLA
• Transfer Instructions
- Data transfers between the main memory and the processor registers
- LDA, STA
• Control Instructions
- Program sequencing and control
- HALT, NOP, RESET
• Input / Output Instructions
- Input and output
- INP, OUT
SWARNIMA COA 3
05/17/24 9
Instruction Types
SWARNIMA COA 3
05/17/24 10
Instruction Types
SWARNIMA COA 3
05/17/24 11
Instruction Types
SWARNIMA COA 3
05/17/24 12
Instruction Types
1.Data Transfer Instructions -
Data transfer instructions move data from one place in the computer
to another without changing the data content.
SWARNIMA COA 3
05/17/24 13
Instruction Types
SWARNIMA COA 3
05/17/24 14
Instruction Types
SWARNIMA COA 3
05/17/24 16
Instruction Types
SWARNIMA COA 3
05/17/24 17
Instruction Types
SWARNIMA COA 3
05/17/24 18
Instruction Types
SWARNIMA COA 3
05/17/24 19
Instruction Types
SWARNIMA COA 3
05/17/24 20
Instruction Types
Status Bit Conditions
SWARNIMA COA 3
05/17/24 21
Instruction Types
SWARNIMA COA 3
05/17/24 22
Instruction Types
Status Bit Conditions
1.Bit C (carry) is set to 1 if the end carry C8 is 1. It is cleared to 0 if the
carry is 0.
2.Bit S (sign) is set to 1 if the highest-order bit F7 is 1. It is set to 0 if the
bit is 0.
3.Bit Z (zero) is set to 1 if the output of the ALU contains all 0’s. It is
cleared to 0 otherwise. In other words, Z 1 if the output is zero and Z 0
if the output is not zero.
4.Bit V (overflow) is set to 1 if the exclusive-OR of the last two carries is
equal to 1, and cleared to 0 otherwise. This is the condition for an
overflow when negative numbers are in 2’s complement
SWARNIMA COA 3
05/17/24 23
Instruction Types
Conditional Branch Instructions
SWARNIMA COA 3
05/17/24 24
Instruction Format
• In the Basic Computer, bit 15 of the instruction specifies the
addressing mode (0: direct addressing, 1: indirect addressing)
• Since the memory words, and hence the instructions, are 16 bits long,
that leaves 3 bits for the instruction’s opcode
Instruction Format
15 14 12 11 0
I Opcode Address
Addressing
mode
SWARNIMA COA 3
05/17/24 25
Instruction Format
SWARNIMA COA 3
05/17/24 26
Instruction Format
SWARNIMA COA 3
05/17/24 27
Instruction Format
SWARNIMA COA 3
05/17/24 28
Instruction Format
SWARNIMA COA 3
05/17/24 29
Instruction Cycle & Sub Cycle
SWARNIMA COA 3
05/17/24 30
Fetch and Decode
SWARNIMA COA 3
05/17/24 31
Fetch and Decode
T0 Cycle:
1.Place the content of PC onto the bus by making the bus selection
inputs S2S1S0 equal to 010.
2.Transfer the content of bus to AR by enabling the LD input of AR.
T1 Cycle:
1.Enable the read input of memory.
2.Place the content of memory onto the bus by making S2S1S0=
111.
3.Transfer the content of bus to IR by enabling the LD input of IR.
4.Increment PC by enabling the INR input of PC.
SWARNIMA COA 3
05/17/24 32
Instruction Cycle & Sub Cycle
Instruction Cycle
There are typically three stages of an instruction cycle that the CPU carries
out:
•Fetch the instruction from memory. This step brings the instruction into
the instruction register, a circuit that holds the instruction so that it can be
decoded and executed.
•Decode the instruction.
•Read the effective address from memory if the instruction has an indirect
address.
•Execute the instruction.
SWARNIMA COA 3
05/17/24 33
Instruction Cycle & Sub Cycle
SWARNIMA COA 3
05/17/24 34
Execution of Complete Instruction
FETCH
SWARNIMA COA 3
05/17/24 35
Execution of Complete Instruction
SWARNIMA COA 3
05/17/24 36
Micro operations
The operations performed on the data stored in registers known as
micro-operations. Example: Shift, Count Clear and Load. The micro-
operations are classified as follows.
1. Register transfer micro-operations: These type of micro
operations are used to transfer from one register to another binary
information.
SWARNIMA COA 3
05/17/24 38
Micro operations
Arithmetic Micro operations
Example Description
R3 ← R1 + R2 Addition
R3 ← R1 - R2 (R1 + R2' + 1) Subtraction
Complement (really a logic
R2 ← R2'
operation)
R2 ← -R2 (R2' + 1) Negation
R1 ← R1 + 1 Increment
R1 ← R1 - 1 Decrement
SWARNIMA COA 3
05/17/24 39
Micro operations
Logic Micro operations
SWARNIMA COA 3
05/17/24 40
Micro operations
Shift Micro operations
Logical Shift:- The symbol “shl” is used for logical shift left
and “shr” is used for logical shift right.
SWARNIMA COA 3
05/17/24 41
Micro operations
SWARNIMA COA 3
05/17/24 42
Micro operations
SWARNIMA COA 3
05/17/24 43
Micro operations
SWARNIMA COA 3
05/17/24 44
Program Control
•Program control is how a program makes decisions or organizes its
activities. Program control typically involves executing particular code
based on the outcome of a prior operation or a user input.
SWARNIMA COA 3
05/17/24 45
Program Control
SWARNIMA COA 3
05/17/24 46
Program Control
SWARNIMA COA 3
05/17/24 47
Program Control
Types of Program Control Instructions:
There are different types of Program Control Instructions:
1.Compare Instruction:
Compare instruction is specifically provided, which is similar to a subtract
instruction except the result is not stored anywhere, but flags are set
according to the result.
Example: CMP R1, R2 ;
RESET – It reset the processor. This may include any or all setting
registers to an initial value or setting program counter to standard
starting location.
SWARNIMA COA 3
05/17/24 50
Reduced Instruction Set Computer
RISC is a microprocessor that is designed to perform a smaller
number of types of computer instructions so that it can operate at
a higher speed (MIPS).
SWARNIMA COA 3
05/17/24 51
Reduced Instruction Set Computer
Characteristic of RISC –
•Simpler instruction, hence simple
instruction decoding.
SWARNIMA COA 3
05/17/24 53
Complex Instruction Set Computer
Characteristic of CISC
SWARNIMA COA 3
05/17/24 55
Pipelining
Pipelining is a technique where multiple instructions are overlapped
during execution.
SWARNIMA COA 3
05/17/24 56
Pipelining
Pipeline Stages
RISC processor has 5 stage instruction pipeline to execute all the
instructions in the RISC instruction set.
Stage 1 (Instruction Fetch)
In this stage the CPU reads instructions from the address in the memory
whose value is present in the program counter.
SWARNIMA COA 3
05/17/24 57
Pipelining
Stage 4 (Memory Access)
In this stage, memory operands are read and written from/to the
memory that is present in the instruction.
SWARNIMA COA 3
05/17/24 58
Pipelining
SWARNIMA COA 3
05/17/24 59
Arithmetic Pipelining
Arithmetic Pipelines are commonly used in various high-performance computers.
The inputs in the floating-point adder pipeline refer to two different normalized
floating-point binary numbers. These are defined as follows:
A = X * 2x = 0.9504 * 103
B = Y * 2y = 0.8200 * 102
Where x and y refer to the exponents and X and Y refer to two fractions representing
the mantissa.
SWARNIMA COA 3
05/17/24 60
Arithmetic Pipelining
The floating-point addition and subtraction process is broken into four pieces.
SWARNIMA COA 3
05/17/24 61
Arithmetic Pipelining
The floating-point addition and subtraction process is broken into four pieces.
SWARNIMA COA 3
05/17/24 62
Arithmetic Pipelining
The floating-point addition and subtraction process is broken into four pieces.
SWARNIMA COA 3
05/17/24 63
Arithmetic Pipelining
A = 0.9504 * 103
B = 0.08200 * 103
SWARNIMA COA 3
05/17/24 64
Arithmetic Pipelining
SWARNIMA COA 3
05/17/24 65
Instruction Pipelining
Pipeline processing can happen not only in the data stream but also in the
instruction stream.
In general, each and every instruction must be processed by the computer in the
following order:
SWARNIMA COA 3
05/17/24 66
Instruction Pipelining
Each step is carried out in its own segment, and various segments may take
different amounts of time to process the incoming data.
Furthermore, there are occasions when multiple segments request memory access
at the very same time, requiring one segment to wait unless and until the memory
access of another is completed.
SWARNIMA COA 3
05/17/24 67
Instruction Pipelining
SWARNIMA COA 3
05/17/24 68
Instruction Pipelining
A four-segment instruction pipeline is illustrated in the block diagram given above.
The instructional cycle is divided into four parts:
Segment 1
The implementation of the instruction fetch segment can be done using the FIFO or
first-in, first-out buffer.
Segment 2
In the second segment, the memory instruction is decoded, and the effective
address is then determined in a separate arithmetic circuit.
Segment 3
In the third segment, some operands would be fetched from memory.
Segment 4
The instructions would finally be executed in the very last segment of a pipeline
organisation.
SWARNIMA COA 3
05/17/24 69
Control Unit (CU)
Control unit (CU) of a processor translates from machine instructions
to the control signals for the microoperations that implement them
Control units are implemented in one of two ways
Hardwired Control
CU is made up of sequential and combinational circuits to
generate the control signals
Microprogrammed Control
A control memory on the processor contains microprograms that
activate the necessary control signals
SWARNIMA COA 3
05/17/24 70
Control Unit (CU)
•Control Unit is the part of the computer’s central processing unit
(CPU), which directs the operation of the processor.
•It is the responsibility of the Control Unit to tell the computer’s
memory, arithmetic/logic unit and input and output devices how to
respond to the instructions that have been sent to the processor.
•A control unit works by receiving input information to which it
converts into control signals, which are then sent to the central
processor.
SWARNIMA COA 3
05/17/24 73
Control Unit (CU)
•HARDWIRED/MICROPROGRAMMED
SWARNIMA COA 3
05/17/24 74
Hardwired control unit
It In the hardwired organization, the control logic is implemented
with gates, flip-flops, decoders, and other digital circuits. It has the
advantage that it can be optimized to produce a fast mode of
operation.
A hardwired control, as the name implies, re quires changes in the
wiring among the various components if the design has to be modified
or changed.
SWARNIMA COA 3
05/17/24 75
Microprogrammed control unit
It In the microprogrammed organization, the control information is
stored in a control memory.
The control memory is programmed to initiate the required
sequence of microoperations.
In the microprogrammed control, any required changes or
modifications can be done by updating the microprogram in control
memory.
SWARNIMA COA 3
05/17/24 76
Hardwired/Microprogrammed
SWARNIMA COA 3
05/17/24 77
Concept of horizontal and vertical
microprogramming.
Micro-programmed control unit
Micro-programmed control unit can be classified into two types based
on the type of Control Word stored in the Control Memory.
• Horizontal micro-programmed control unit
• Vertical micro-programmed control unit.
•In the case of a vertical organization, the signals are grouped and
encoded in order to reduce the size of the control word.
SWARNIMA COA 3
05/17/24 79
Concept of horizontal and vertical
microprogramming.
SWARNIMA COA 3
05/17/24 80
Flynn’s Classification
SWARNIMA COA 3
05/17/24 81
Flynn’s Classification
SWARNIMA COA 3
05/17/24 82
Flynn’s Classification
In SISD, machine instructions are processed in a sequential manner and computers
adopting this model are popularly called sequential computers.
Most conventional computers have SISD architecture. All the instructions and data to
be processed have to be stored in primary memory.
The speed of the processing element in the SISD model is limited(dependent) by the
rate at which the computer can transfer information internally.
SWARNIMA COA 3
05/17/24 83
Flynn’s Classification
SWARNIMA COA 3
05/17/24 84
Flynn’s Classification
The system performs different operations on the same data set. Machines built using the
MISD model are not useful in most of the application, a few machines are built, but none
of them are available commercially.
SWARNIMA COA 3
05/17/24 85
Flynn’s Classification
SWARNIMA COA 3
05/17/24 86
Flynn’s Classification
SWARNIMA COA 3
05/17/24 87
Flynn’s Classification
In the shared memory MIMD model (tightly coupled multiprocessor systems), all
the PEs are connected to a single global memory and they all have access to it.
The communication between PEs in this model takes place through the shared
memory, modification of the data stored in the global memory by one PE is visible to
all other PEs.
Dominant representative shared memory MIMD systems are Silicon Graphics
machines and Sun/IBM’s SMP (Symmetric Multi-Processing).
SWARNIMA COA 3
05/17/24 88
Flynn’s Classification
In the shared memory MIMD model (tightly coupled multiprocessor systems), all
the PEs are connected to a single global memory and they all have access to it.
The communication between PEs in this model takes place through the shared
memory, modification of the data stored in the global memory by one PE is visible to
all other PEs.
Dominant representative shared memory MIMD systems are Silicon Graphics
machines and Sun/IBM’s SMP (Symmetric Multi-Processing).
In Distributed memory MIMD machines (loosely coupled multiprocessor systems)
all PEs have a local memory.
The communication between PEs in this model takes place through the
interconnection network (the inter process communication channel, or IPC).
The network connecting PEs can be configured to tree, mesh or in accordance with
the requirement.
SWARNIMA COA 3
05/17/24 89
Flynn’s Classification
SWARNIMA COA 3
05/17/24 90
Faculty Video Links, You tube Courses Details
SWARNIMA COA 3
05/17/24 91
Daily Quiz
92
05/17/24 SWARNIMA COA 3
Weekly Assignment
SWARNIMA COA 3
05/17/24 93
MCQ
SWARNIMA COA 3
05/17/24 94
Old Question Papers
96
05/17/24 SWARNIMA COA 3
Expected Questions for University Exam
97
05/17/24 SWARNIMA COA 3
Summary
98
05/17/24 SWARNIMA COA 3