COMPORGA - Module 4
COMPORGA - Module 4
1
CEA - Computer Engineering
COMPORGA – COMPUTER ORGANIZATION AND ARCHITECTURE
Major components:
• Register set
• Arithmetic Logic Unit
• Control Unit
The image below shows different components that makes up the CPU
2
CEA - Computer Engineering
COMPORGA – COMPUTER ORGANIZATION AND ARCHITECTURE
b. Arithmetic Logic Unit - provides the circuitry needed to perform the arithmetic,
logical and shift operations demanded the instruction set.
c. Control Unit - the entity responsible for fetching the instruction to be executed
from the main memory and decoding and then executing it.
The CPU fetches instructions from memory, reads and writes data from and to memory,
and transfers data from and to input/output devices. A typical and simple execution
cycle can be summarized as follows:
1. The next instruction to be executed, whose address is obtained from the PC, is
fetched from the memory and stored in the IR.
2. The instruction is decoded.
3. Operands are fetched from the memory and stored in CPU registers, if needed.
4. The instruction is executed. 5. Results are transferred from CPU registers to the
memory, if needed.
Interrupt handling routines are programs that are invoked to collect the state of the
currently executing program, correct the cause of the interrupt, and restore the state
of the program.
3
CEA - Computer Engineering
COMPORGA – COMPUTER ORGANIZATION AND ARCHITECTURE
Datapath - is a set of functional units that carry out data processing operations.
- contains the registers and the ALU
- capable of performing certain operations on data items.
- Internal and external data movements
- organized using:
• One-bus
• two-bus
• three-bus Organization
- Dedicated datapaths may also be used between components that
transfer data between themselves more frequently
DATAPATH ORGANIZATION
• One-Bus Organization
- the CPU registers and the ALU use a single bus to move outgoing and
incoming data
- 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
• Two-Bus Organization
- Using two buses is a faster solution than the one-bus organization
- Data can be transferred from two different registers to the input point of
the ALU at the same time
4
CEA - Computer Engineering
COMPORGA – COMPUTER ORGANIZATION AND ARCHITECTURE
In some cases, one of the buses may be dedicated for moving data into
registers (in-bus), while the other is dedicated for transferring data out of the
registers (out-bus).
In-bus
moving data
into registers
Out-bus
transferring
data out of the
registers
• Three-Bus Organization
- two buses may be used as source buses (out-bus), while the third is used
as destination (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
5
CEA - Computer Engineering
COMPORGA – COMPUTER ORGANIZATION AND ARCHITECTURE
The more buses, the more data can be move within a single clock cycle.
However, increasing the number of buses will also increase the complexity of
the hardware.
Micro-Operation: Add X, R0
6
CEA - Computer Engineering
COMPORGA – COMPUTER ORGANIZATION AND ARCHITECTURE
Control Unit - directs the system operations by sending control signals to the
datapath.
- signals control the flow of data within the CPU and between the
CPU and external units such as memory and I/O
- Clock signals are used in generating control signals.
Ex. Assume that the instruction set of a machine has the three
instructions: Inst-x, Inst-y, and Inst-z; and A, B, C, D, E, F, G, and H
are control lines
7
CEA - Computer Engineering
COMPORGA – COMPUTER ORGANIZATION AND ARCHITECTURE
8
CEA - Computer Engineering
COMPORGA – COMPUTER ORGANIZATION AND ARCHITECTURE
- Vertical microinstruction, control lines are coded into specific fields within
a microinstruction
Ex. Consider the three-bus datapath shown. In addition to the PC, IR,
MAR, and MDR, assume that there are 16 general-purpose registers
numbered R0 –R15. Also, assume that the ALU supports eight functions
(add, subtract, multiply, divide, AND, OR, shift left, and shift right).
Consider the add operation Add R1, R2, R0, which adds the contents of
source registers R1, R2 , and store the results in destination register R0 . In
this example, we will study the format of the microinstruction under
horizontal organization.
Destination
2
8 functions
16 Registers
Source 1
Source 2
9
CEA - Computer Engineering
COMPORGA – COMPUTER ORGANIZATION AND ARCHITECTURE
ALU
Add sub mul div and or sleft sright none
Source 1
R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 PC IR MAR MDR
Source 2
R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15
Destination
R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 PC IR MAR MDR
Vertical Organization: decoder will be needed. Control lines are assigned with a set of
control bits.
*ALU takes 4 bits since there are 9 instructions (8 functions + 1 transfer) it performs
10
CEA - Computer Engineering
COMPORGA – COMPUTER ORGANIZATION AND ARCHITECTURE
DESTINATION
11
CEA - Computer Engineering
COMPORGA – COMPUTER ORGANIZATION AND ARCHITECTURE
1. Hardwired approach:
Suppose that the instruction set of a machine has three instructions: Inst-1,
Inst-2, and Inst-3; and A, B, C, D, E, F, G, and H are the control lines. The
following table shows the control lines that should be activated for the three
instructions at the three steps T0, T1, and T2. Draw the logic circuit for A, B, C,
D, E, F, G, and H control line.
2. Microprogramming approach
Write down the microprogram for instructions Inst-1 for horizontal and vertical
representation.
Horizontal:
Steps Inst-control lines
T0 T1 T2 A B C D E F G H
Answer: Inst-3
T0 E,H 100 00001000 00000001
T1 D,A,C 010 00010000 10000000 00100000
Vertical:
Steps (3 inst – 2 bits) Inst-control lines (8 bits – 3 bits
00 T0 000 A
01 T1 001 B
10 T2 010 C
11 - 011 D
100 E
101 F
110 G
111 H
Answer: Inst-3
T0 E,H 00 100 111
T1 D,A,C 01 011 000 010
12