Computer Architecture Lesson 4 (Data Paths in The CPU)
Computer Architecture Lesson 4 (Data Paths in The CPU)
Computer Architecture
Lesson 4 (Data Paths in the CPU)
The CPU can be divided into a data section and a control section.
The data section, which is also called the data path, contains the
registers and the ALU. The data path is capable of performing certain
operations on data items.
The control section is basically the control unit, which issues control
signals to the data path.
Internal to the CPU, data move from one register to another and
between ALU and registers. Internal data movements are performed
via local buses, which may carry data, instructions, and addresses.
Externally, data move from registers to memory and I/O devices,
often by means of a system bus.
Internal data movement among registers and between the ALU and registers
may be carried out using different organizations including one-bus, two-bus,
or three-bus organizations:
1
Prepared by:
Assist. Lect. Omar Haitham Alhabieb
A. One-Bus Organization
Using one bus, the CPU registers and the ALU use a single bus
to move outgoing and incoming data.
Since a bus can handle only a single data movement within one
clock cycle, two-operand operations will need two cycles to
fetch the operands for the ALU. Additional registers may also
be needed to buffer data for the ALU.
This bus organization is the simplest and least expensive, but it
limits the amount of data transfer that can be done in the same
clock cycle, which will slow down the overall performance.
Figure 1 shows a one-bus data path consisting of a set of
general-purpose registers, a memory address register (MAR), a
memory data register (MDR), an instruction register (IR), a
program counter (PC), and an ALU.
2
Prepared by:
Assist. Lect. Omar Haitham Alhabieb
B. Two-Bus Organization
Using two buses is a faster solution than the one-bus organization.
In this case, general-purpose registers are connected to both buses.
Data can be transferred from two different registers to the input point
of the ALU at the same time.
Therefore, a two operand operation can fetch both operands in the
same clock cycle. An additional buffer register may be needed to hold
the output of the ALU when the two buses are busy carrying the two
operands. Figure 2 shows a two-bus organization.
3
Prepared by:
Assist. Lect. Omar Haitham Alhabieb
C. Three-Bus Organization
In a three-bus organization, two buses may be used as source buses
while the third is used as destination.
The source buses move data out of registers (out-bus), and the
destination bus may move data into a register (in-bus).
Each of the two out-buses is connected to an ALU input point. The
output of the ALU is connected directly to the in-bus.
As can be expected, the more buses we have, the more data we can
move within a single clock cycle. However, increasing the number of
buses will also increase the complexity of the hardware.
Figure 4 shows an example of a three-bus data path.
4
Prepared by:
Assist. Lect. Omar Haitham Alhabieb
5
Prepared by:
Assist. Lect. Omar Haitham Alhabieb
Fetch Instructions
Let us consider the one-bus data path organization shown in Fig. 1. We will
see that the fetch operation can be accomplished in three steps as shown in
the table below. Note that multiple operations separated by “;” imply that
they are accomplished in parallel.
Using the three-bus data path shown in Figure 4, the following table shows
the steps needed.
6
Prepared by:
Assist. Lect. Omar Haitham Alhabieb
This instruction adds the contents of source registers R1 and R2, and stores
the results in destination register R0. This addition can be executed as
follows:
1. The registers R0, R1, R2, are extracted from the IR.
Using the one-bus data path shown in Figure 1, this addition will take three
steps as shown in the following table:
Using the two-bus data path shown in Figure 2, this addition will take two
steps as shown in the following table:
Using the two-bus data path with in-bus and out-bus shown in Figure 3, this
addition will take two steps as shown below:
7
Prepared by:
Assist. Lect. Omar Haitham Alhabieb
Using the three-bus data path shown in Figure 4, this addition will take only
one step as shown in the following table.
Add R0, X
Using the one-bus data path shown in Figure 1, this addition will take five
steps as shown below:
8
Prepared by:
Assist. Lect. Omar Haitham Alhabieb
Using the two-bus data path shown in Figure 2, this addition will take four
steps as shown below:
Using the two-bus data path with in-bus and out-bus shown in Figure 3, this
addition will take four steps as shown below:
Using the three-bus data path shown in Figure 4, this addition will take three
steps as shown below:
9
Prepared by:
Assist. Lect. Omar Haitham Alhabieb
Interrupt Handling
2. The MAR is loaded with the address at which the PC contents are to be
saved.
3. The PC is loaded with the address of the first instruction of the interrupt
handling routine.
The contents of MDR (old value of the PC) are stored in memory. The
following table shows the sequence of events:
10