7COA Slides-1
7COA Slides-1
CPU Organization
A instruction is of various length depending upon the number of addresses it contain.
Generally CPU organization are of three types on the basis of number of address fields:
• Single accumulator organization
• General register Organization
• Stack organization
1
10/22/2023
2
10/22/2023
Stack Organization
• The computers which use Stack-based CPU Organization are
based on a data structure called stack. The stack is a list of
data words. It uses Last In First Out (LIFO) access method
which is the most popular access method in most of the CPU.
• A register is used to store the address of the topmost element
of the stack which is known as Stack pointer (SP).
• In this organization, ALU operations are performed on stack
data. It means both the operands are always required on the
stack. After manipulation, the result is placed in the stack.
Zero Address instructions:
• Can be found in a stack-organized computer.
Push Operation: Pop Operation:
Stack Organization
• A stack based computer do not use address field in instruction. To evaluate a expression
first it is converted to revere Polish Notation i.e. Post fix Notation.
• Expression: X = (A+B)*(C+D)
• Postfix : X = AB+CD+*
• TOS means top of stack
• M[X] is any memory location
3
10/22/2023
Addressing Modes
• Addressing modes are the ways by which the operand of an instruction is
specified. It is a rule for interpreting or modifying the address field of the
instruction before the operand is actually executed.
• Implied Mode: (Stack Oriented Addressing Mode)
Operands implicitly specified in the definition of the instruction.
All register reference instruction that use accumulator are implied-mode
instruction.
Zero address instructions in a stack organized computer are implied mode
instructions.
Example: CLA, CMA, INC,CLE
4
10/22/2023
Addressing Modes
• Immediate Mode:
• Operands is specified in the instruction itself.
• Immediate mode instruction has an operand field rather
than an address field.
• Useful for initializing registers to a constant value.
• Operand field: Actual Operand + Operation
Example: 1
MOV AL, 35H (move the data 35H into AL register)
ADD, 7
Addressing Modes
• Register Mode:
• Operands are in Registers that reside with in the CPU.
• Any one of 2k Registers are selected from the k-bit of the
register field in the instruction.
Example: AC ← AC + [R]
5
10/22/2023
Addressing Modes
• Register Indirect Mode:
• Instruction specifies a register in the CPU whose
content give the address of the operand in the memory.
• Selected register contains the address of the operand
rather than the operand itself.
• Example: AC ← AC + M[R]
Addressing Modes
• Auto-increment or Auto-decrement Mode:
• Register is incremented (after) or decremented (before) its value is used to
access memory (the execution of the instruction).
• Special mode that automatically increments or decrements the register
content.
• Add R1, -(R2) // OR R2 = R2 - d , R1 = R1 + M[R2]
• Add R1, (R2)+ // OR R1 = R1 +M[R2], R2 = R2 + d
6
10/22/2023
Addressing Modes
• Direct Addressing Mode:
• The operand resides in memory and its address is given
directly by the address field of the instruction (Effective
address).
• Single memory reference to access data.
• Effective address is equal to the address part of the
instruction.
Addressing Modes
• Indirect Address Mode:
• Address field of the instruction gives the address where the
effective address is stored in memory.
• Two references to memory are required to fetch the
operand.
7
10/22/2023
Addressing Modes
• Displacement addressing Mode:
• In this the contents of the indexed register is added to the Address part of the
instruction, to obtain the effective address of operand.
• EA = A + (R), In this the address field holds two values, A(which is the base
value) and R(that holds the displacement), or vice versa.
Addressing Modes
• Relative Addressing Mode:
• It is a modified version of Displacement addressing mode.
• In this the contents of PC(Program Counter) is added to address part of
instruction to obtain the effective address.
• EA = A + (PC), where EA is effective address and PC is program counter.
(Relative to the address of the next instruction).
• The operand is A cells away from the current cell (the one pointed to by PC)
8
10/22/2023
Addressing Modes
• Base register addressing mode:
• It is again a version of Displacement addressing mode.
• Effective address : address part of the instruction + content of a
base register.
• This can be defined as EA = A + (R), where A is displacement
and R holds pointer to base address.
9
10/22/2023
10
10/22/2023
11
10/22/2023
Pipelining
Parallel Processing
Arrange the hardware such that more than one operation can be performed
at the same time.
Provide simultaneous data-processing tasks to increase the computational
speed of a computer system.
Instead of processing each instruction sequentially as in a conventional
computer, a parallel processing system is able to perform concurrent data
processing to achieve faster execution time and its throughput.
– Pipeline processing
– Vector Processing
– Array Processing
12
10/22/2023
Pipelining
• It is a process of arrangement of hardware elements of the
CPU such that its overall performance is increased.
• Simultaneous execution of more than one instruction takes
place in a pipelined processor.
• To increase their instruction throughput (the number
of instructions that can be executed in a unit of time).
Laundry example
Washer takes 30 minutes, Drier takes 40 minutes, Folder takes 20 minutes.
13
10/22/2023
Pipelining
14
10/22/2023
Clock
15
10/22/2023
Arithmetic Pipeline
16
10/22/2023
Arithmetic Pipeline
It is used to implement floating-point operations, multiplications of fixed-point
numbers, and similar computations encountered in scientific problems.
It is found in very high speed computers.
Pipeline unit for floating-point addition and subtraction.
The inputs to the floating-point adder pipeline are two normalized floating-
point binary numbers.
Here, A and B are two fractions that represent the mantissas and a and b are the
exponents.
17
10/22/2023
18
10/22/2023
Instruction Pipeline
19
10/22/2023
Instruction Pipeline
The instruction cycle in the CPU can be
processed with a four-segment pipeline.
The current instruction is being executed in
segment 4(EX), the next instruction in
sequence is busy fetching an operand from
memory in segment 3(FO).
The effective address may be calculated in a
separate arithmetic circuit for the third
instruction, and whenever the memory is
available, the fourth and all subsequent
instructions can be fetched and placed in an
instruction FIFO.
Up-to four sub-operations in the instruction
cycle can overlap and up to four different
instructions can be in progress of being
processed at the same time.
Timing Diagram
20
10/22/2023
Pipeline Conflicts
• Resource Conflicts (Structural Dependency):
• More than one instruction tries to access the same
resource in the same cycle
• Caused due to memory access by two segments at the
same time.
• Data/Address Dependency :
• Instruction depends on the result of a previous
instruction.
• Control Dependency (Branch Difficulties):
• Caused by the branch and other instructions (BRANCH,
CALL, JMP, etc) that transfer the program control.
RISC Pipeline
21
10/22/2023
22
10/22/2023
RISC Instructions
• Reduced instruction set computer (RISC) is restricted to the use of load and store
instructions when communication between memory and CPU. All other instructions
are executed within the registers of the CPU without referring to memory.
• It uses LOAD and STORE instructions that have one memory and one register
address, and computational type instructions that have three addresses with all three
specifying processors registers.
23
10/22/2023
RISC Pipeline
The reduced instruction set computer (RISC) uses an efficient
instruction pipeline.
Three-Segment Instruction Pipeline:
The instruction load or store the data from a selected register
in the register file. The instruction cycle can be divided into
three sub-operations and implemented in three segments:
I: Instruction fetch
A: ALU operation (Instruction decoding,
operation/determine (EA/Branch address)
E: Execute Instruction
RISC Pipeline
Consider the operation of the following four
instructions:
24
10/22/2023
25
10/22/2023
Questions
26