Module 5 SRB
Module 5 SRB
Module 5 SRB
Communication Engineering
(Accredited by NBA, New Delhi. Validity 01.07.2019 to 30.06.2022)
COMPUTER ORGANIZATION
AND ARCHITECTURE
18EC35
Department of Electronics &
Communication Engineering
(Accredited by NBA, New Delhi. Validity 01.07.2019 to 30.06.2022)
Module -2: Addressing Modes, Assembly Language, Basic Input and Output
Operations, Stacks and Queues, Subroutines, Additional Instructions (from
2.4.7 of Chap 2, except 2.9.3, 2.11 & 2.12 of Text).
MODULE 5
Syllabus
Learning outcomes
How a processor executes instructions
The internal functional units of a processor& how they are
interconnected
Hardware generating internal control signals
The microprogramming approach
Preamble
Pipelining Method 1
Method 2
The fetch-decode-
execute cycle
A standard process describes
the steps needed for
processing to take place. It is
called the Fetch - Decode -
Execute cycle or sometimes
simply called the Fetch-Execute
Cycle.
1. FETCH
• The first step the CPU carries out is to fetch some data and instructions
(program) from main memory then store them in its own internal temporary
memory areas. These memory areas are called 'registers'.
• This is called the 'fetch' part of the cycle.
• For this to happen, the CPU makes use of a vital hardware path called the
'address bus'.
• The CPU places the address of the next item to be fetched on to the address
bus.
• Data from this address then moves from main memory into the CPU by
travelling along another hardware path called the 'data bus'.
03/22/2024 Dept. of ECE, ATMECE, Mysuru 11
Department of Electronics &
Communication Engineering
(Accredited by NBA, New Delhi. Validity 01.07.2019 to 30.06.2022)
2. DECODE
• The next step is for the CPU to make sense of the instruction it has just
fetched.
• The CPU decodes the instruction and prepares various areas within the
chip in readiness of the next step.
3. EXECUTE
• This is the part of the cycle when data processing actually
takes place. The instruction is carried out upon the data
(executed). The result of this processing is stored in yet
another register.
Fundamental Concepts
• Processor fetches one instruction at
a time and perform the operation
specified.
• Instructions are fetched from
successive memory locations until a
branch or a jump instruction is
encountered.
• Processor keeps track of the address
of the memory location containing
the next instruction to be fetched AE00 MOV A(d),B(s) =3C
using Program Counter (PC). AE01 MOV R1, R2
• Instruction Register (IR)
Executing an Instruction
• Fetch the contents of the memory
location pointed to by the PC. The
contents of this location are
loaded into the IR (fetch phase).
IR ← [[PC]]
• Assuming that the memory is byte
addressable, increment the
contents of the PC by 4 (fetch
phase).
PC ← [PC] + 4
• Carry out the actions specified by
the instruction in the IR (execution
phase).
03/22/2024 Dept. of ECE, ATMECE, Mysuru 15
Department of Electronics &
Communication Engineering
(Accredited by NBA, New Delhi. Validity 01.07.2019 to 30.06.2022)
Processor Organization
Internal processor
bus
Control signals
PC
Instruction
Address
MDR HAS TWO lines
MAR
decoder and
control logic
INPUTS AND Memory
TWO OUTPUTS bus
MDR
Data
lines IR
Constant 4 R0
Select MUX
Add
A B
ALU Sub R n - 1
control ALU
lines
Carry-in
XOR TEMP
Internal processor
bus
loaded PC
Memory
MDR
Add
→ issuing the control-signals to all the units ALU Sub
A B
R n - 1
control
inside the processor.
ALU
lines
Carry-in
XOR
→ implementing the actions specified by the
TEMP
Internal processor
bus
Control signals
The programmer can access these registers for general- PC
purpose use. Instruction
Address
Only processor can access 3 registers Y, Z &Temp for lines
MAR
decoder and
control logic
temporary storage during program-execution. The Memory
bus
programmer cannot access these 3registers. MDR
Data
lines IR
multiplexer(MUX). Constant 4 R0
processor-bus. Add
Z
• MUX selects either
→ output of Y or
→ constant-value 4( which is used to increment PC Figure 7.1. Single-bus organization of the datapath inside a processor.
content).
Register Transfers
• Internal processor
•• bus
• •• Riin
Instruction execution involves a sequence of
steps in which data are transferred from one •• Ri
used:
• Y
To place the contents of the register on the • Constant 4
bus • Select • MUX
or
To load the data on the bus into the register •
•
A •
ALU
B
•• Zin
Riin &Riout are called Gating Signals.
• Z
• Riin=1 data on bus is loaded into Ri.
Riout=1 content of Ri is placed on the bus. •• Zout
Riout=0, bus can be used for transferring • Figure 7.2. Input and output gating for the registers in Figure 7.1.
data from other registers.
•
03/22/2024 Dept. of ECE, ATMECE, Mysuru 20
Department of Electronics &
Communication Engineering
(Accredited by NBA, New Delhi. Validity 01.07.2019 to 30.06.2022)
5
5
R1=? R4=?
• Y
This can be accomplished as follows: • Constant 4
1) Enable the output of registers R1 by setting R1out• Select • MUX
to 1. This places the contents of R1 on processor-
bus. •
•
A •
ALU
B
Register Transfers
All operations and data transfers are controlled by the processor clock
Bus
D Q
1
Q
Riout
Ri in
Clock
Figure 7.3. Input and output gating for one register bit.
MDR
External Internal
Figure 7.4. Connection and control signals for register MDR.
memory bus
5. R2 ← [MDR]
MDRinE
MDR inE MDRin
Data
Figure 7.4. Connection and control signals for register MDR.
3. MDRout, R2in
Figure 7.5. Timing of a memory Read operation.
MARin
Read
MDRinE
command is issued.
3) MDRoutE,WMFC ;load data into memory- Figure 7.5. Timing of a memory Read operation.
Move (R4), R5
R1out,MARin
R2out,MDRin,Write
MDRoutE, WMFC
Internal processor
bus
Control signals
PC
Instruction
Address
Step Action lines
decoder and
MAR control logic
Memory
1 PC out , MAR in , Read, Select4, Add, Zin bus
Step3--> Fetched instruction is moved into MDR and then to IR. The
step 1 through 3 constitutes the Fetch Phase.
Step4--> Contents of R3 are loaded into MAR & a memory read signal
step1.
• Incrementer unit.
Multiple-Bus Organization
• Add R4, R5, R6
Step Action
through the ALU using R=B control signal & loaded into MAR to
start a memory read operation
At the same time PC is Incrementer by 4
• Step 2:The processor waits for MFC
• Step 3: Loads the data ,received into MDR ,then transfers them to
IR.
• Step 4: The execution phase of the instruction requires only one
control step to complete.
HARDWIRED CONTROL
• To execute instructions, the processor must have some means of
generating the control signals needed in the proper sequence.
• Two categories: hardwired control and microprogrammed control
• Hardwired system can operate at high speed; but with little
flexibility.
Generating Zin
• Zin = T1 + T6 • ADD + T4 • BR + …
Branch Add
T4 T6
T1
Department of Electronics &
Communication Engineering
(Accredited by NBA, New Delhi. Validity 01.07.2019 to 30.06.2022)
Generating End
• End = T7 • ADD + T5 • BR + (T5 • N + T4 • N) • BRN +…
Branch<0
Add Branch
N N
T7 T5 T4 T5
End
A Complete Processor
Instruction Data
cache cache
Bus interface
Processor
System bus
Main Input/
memory Output
MICROPROGRAMMED CONTROL
• Microprogramming is a method of control unit design.
• Control-signals are generated by a program similar to machine
language programs.
• Control Word(CW) is a word whose individual bits represent
various control-signals (like Add, PCin).
Clock P C
Control
store CW
WMFC
MDRout
MARin
Select
PCout
Read
R1out
R3out
Micro -
Add
End
PCin
R1in
Zout
IRin
Yin
Zin
instruction
1 0 1 1 1 0 0 0 1 1 1 0 0 0 0 0 0
2 1 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0
3 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0
4 0 0 1 1 0 0 0 0 0 0 0 0 0 1 0 0
5 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0
6 0 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0
7 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1
CONDITIONAL BRANCH
• The previous organization cannot handle the situation when the control unit is
required to check the status of the condition codes or external inputs to
choose between alternative courses of action.
• Use conditional branch microinstruction.
Address Microinstruction
Microprogrammed Control
External
inputs
Starting and
branch address Condition
IR codes
generator
Clock m PC
Control
store CW
Department of Electronics &
Communication Engineering
(Accredited by NBA, New Delhi. Validity 01.07.2019 to 30.06.2022)
MICROINSTRUCTIONS