MODULE-5 - Basic-Processing-Unit
MODULE-5 - Basic-Processing-Unit
and Architecture
Carl Hamacher, Zvonko Vranesic, Safwat
Zaky,
Computer Organization, 5th
Edition,
Tata McGraw Hill, 2002.
Module-5
BASIC PROCESSING UNIT
Overview
InstructionSet Processor (ISP) –
executes machine instructions and
coordinates the activities of other
cells.
Also called Central Processing Unit (CPU)
A typical computing task consists of a
series of steps specified by a
sequence of machine instructions
that constitute a program.
An instruction is executed by carrying
Some Fundamental
Concepts
Fundamental Concepts
Processor fetches one instruction at a
time and performs 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 using Program
Counter (PC).
After fetching an instruction, the contents of
the PC are updated to point to the next
Steps in Executing an
Instruction
Fetch the contents of the memory location
pointed to by the PC. The contents of this
location are loaded into the instruction
register 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).
Processor Organization Internal processor
bus
C
o
PC n
t
r
o Instruction
Address l decoder and
lines
MAR control logic
MDR HAS s
Memory i
TWO INPUTS bus g
AND TWO n
MDR a
OUTPUTS Data l
lines s IR
Datapat
Y
Constant 4 R0 h
Select MUX
Add
A B
ALU Sub R n - 1
control ALU
lines
Carry-in
XOR TEMP
Textbook Page
413
Processor Organization..
Figure 7.1 shows an organization in which
the ALU and all the registers are
interconnected via a single common bus.
This bus is internal to the processor.
7.2.
The input and output of register Ri are
connected to the bus via switches
Register Transfers..
When Riin is set to 1, the data on the
bus are loaded into Ri.
Similarly, when Ri
out is set to 1, the
contents of register Ri are placed on the
bus.
While Ri is equal to 0, the bus can be
out
used for transferring data from other
registers.
Register Transfers.. R iin
Internal processor
bus
Ri
Riout
Y in
Constant 4
Select MUX
A B
ALU
Z in
Z out
Figure 7.2. Input and output gating for the registers in Figure 7.1.
Register Transfers..
Suppose that we wish to transfer the
contents of register R1 to register R4.
This can be accomplished as follows:
Enable the output of register R1 by setting
R1out to 1. This places the contents of R1 on
the processor bus.
Enable the input of register R4 by setting R4in
to 1. This loads data from the processor bus
into register R4.
All operations and data transfers within
the processor take place within time
periods defined by the processor clock.
Register Transfers..
An implementation for one bit of
register Ri is shown in Figure 7.3 as an
example.
A two-input multiplexer is used to select
D Q
1
Q
Riiout
Riin
Clock
Figure 7.3. Input and output gating for one register bit.
Performing an Arithmetic or
Logic Operation
The ALU is a combinational circuit that
has no internal storage.
It performs arithmetic and logic operations on
the two operands applied to its A and B inputs.
ALU gets the two operands from MUX and
bus. The result is temporarily stored in
register Z.
The sequence of operations to add the
contents of register R1 to those of R2 and
1 store the result in R3.
. R1out, Yin
2. R2out, SelectY, Add,
Zin
3
. Zout, R3in
Performing an Arithmetic or
Logic Operation..
The signals whose names are given in
any step are activated for the duration of
the clock cycle corresponding to that
step.
All other signals are inactive.
In step 1, the output of register R1 and
the input of register Y are enabled,
causing the contents of RI to be
transferred over the bus to Y.
Performing an Arithmetic or
Logic Operation..
In step 2, the multiplexer's Select signal is
set to SelectY, causing the multiplexer to
gate the contents of register Y to input A
of the ALU.
At the same time, the contents of register R2
are gated
onto the bus and, hence, to input B.
The Add line is set to 1, causing the output of the
ALU to be the sum of the two numbers at inputs
A and B.
This sum is loaded into register Z because its
input
control signal is activated.
Fetching a Word from
Memory
To fetch a word of information from
memory, the processor has to specify the
address of the memory location where
this information is stored and request a
Read operation.
The information to be fetched may be an
instruction in a program or an operand
specified by an instruction.
The processor transfers the required
address to the MAR, whose output is
connected to the address lines of the
Fetching a Word from
Memory..
At the same time, the processor uses the
control lines of the memory bus to
indicate that a Read operation is needed.
When the requested data are received
from the memory they are stored in
register MDR,
From MDR, they can be transferred to
other registers in the processor.
Fetching a Word from
Memory..
MDR
MDRinE MDRin
instruction are:
1. MAR ← [R1]
5. R2 ← [MDR]
Fetching a Word from
Memory..
The memory read operation requires
three steps, which can be described by
the signals being activated as follows:
1. R1out, MARin, Read
2. MDRinE, WMFC
3. MDRout, R2in
Step 1 2 3
Timing Clock
MDR inE
Data
MDR out
Load MDR from the memory
bus
R2 ←
[MDR]
PC
Register
file
Constant 4
MUX
ALU R
B
Instruction
decoder
IR
MDR
MAR
Memory b us Address
data lines lines
Multiple-Bus Organization..
All general-purpose registers are
combined into a single block called the
register file.
Implemented in the form of an array of
memory cells.
The register file in Figure 7.8 is said to
have three ports.
There are two outputs, allowing the contents
of two different registers to be accessed
simultaneously and have their contents
placed on buses A and B.
The third port allows the data on bus C to be
Multiple-Bus Organization..
Buses A and B are used to transfer the
source operands to the A and B inputs
of the ALU, where an arithmetic or logic
operation may be performed.
The result is transferred to the
destination over bus C.
If needed, the ALU may simply pass one
External
inputs
Decoder/
IR
encoder
Condition
codes
Control signals
Figure 7.10. Control unit organization.
Control Unit Organization..
The required control signals are
determined by the following
information:
Contents of the control step counter
Contents of the instruction register
Contents of the condition code flags
External input signals, such as MFC and
interrupt requests
Control Unit Organization..
The decoder/encoder block in Figure
7.10 is a combinational circuit that
generates the required control
outputs, depending on the state of all
its inputs.
By separating the decoding and
encoding functions, we obtain the
more detailed block diagram in Figure
7.11.
Control Unit Organization -
Detailed Block Description
CLK
Clock Control step Reset
counter
Step decoder
T 1 T2 T
n
INS 1
INS External
2 inputs
Instruction
IR decoder Encoder
Condition
codes
INS m
Run End
Control signals
Instruction Data
cache cache
Bus interface
Processor
System bus
Main Input/
memory Output
MDRout
WMFC
MAR in
Micro -
Select
PCout
Read
R1out
R3out
instruction
Zout
End
Add
R1in
PCin
IRin
Yin
Zin
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