0% found this document useful (0 votes)
2 views

Chapter 6

Chapter Six discusses the Central Processing Unit (CPU), detailing its structure, including registers, the Arithmetic and Logic Unit (ALU), and the control unit. It covers general register organization, stack organization, instruction formats, addressing modes, and data transfer and manipulation instructions. The chapter emphasizes the CPU's role in data processing and the various instruction types that facilitate computational tasks.

Uploaded by

kblob2676
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Chapter 6

Chapter Six discusses the Central Processing Unit (CPU), detailing its structure, including registers, the Arithmetic and Logic Unit (ALU), and the control unit. It covers general register organization, stack organization, instruction formats, addressing modes, and data transfer and manipulation instructions. The chapter emphasizes the CPU's role in data processing and the various instruction types that facilitate computational tasks.

Uploaded by

kblob2676
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 39

Chapter Six

Central Processing Unit


1 Prepared By Haftom B. 05/01/2025
Contents
 Central processing unit (4hr)

1. General register organization

2. Stack organization

3. Instruction formats

4. Addressing modes

5. Data transfer and manipulation

6. Characteristics of RISC and CISC

2 Prepared By Haftom B. 05/01/2025


6.1 Central Processing Unit (CPU)
 The part of the computer that performs the bulk of data
processing operations is called the Central processing unit
and is referred to as the CPU.

 It is the heart of computer system.

 The CPU is made up of three major parts,


 Register
 The Arithmetic and Logic unit (ALU)
 The control unit
3 Prepared By Haftom B. 05/01/2025
Cont..
 The register set stores intermediate data used during
the execution of the instructions.

 The Arithmetic and Logic unit (ALU) performs the


required micro-operations for executing the instructions.

 The control unit supervises the transfer of information


among the registers and instructs the arithmetic and logic
units as to which operation to perform.
4 Prepared By Haftom B. 05/01/2025
Cont..
 The CPU performs a variety of functions dictated by the
type of instructions that are incorporated in the computer.
 Computer architecture is sometimes defined as the
computer structure and behavior as seen by the
programmer that uses machine language instructions.
This includes the
 Instruction formats,
 Addressing modes,
 The instruction sets and the
 General organizations of the CPU registers.

5 Prepared By Haftom B. 05/01/2025


6.2 General register organization
 We have shown that memory locations are needed for
storing
 Pointers,
 Counters,
 Return addresses,
 Temporary results and
 Partial product during multiplication.
 It is more convenient and more efficient to store these
intermediate values in processor register.

6 Prepared By Haftom B. 05/01/2025


Cont.…
 When a large number of registers are included in the CPU,
it is most efficient to connect them through a common bus
system.
 The registers communicate with each other not only for
direct data transfers, but also while performing various
micro-operations.
 it is also necessary to provide a common unit that can
perform all the
 arithmetic,
 logic
 shift micro-operations in the processor.
7 Prepared By Haftom B. 05/01/2025
Cont..
 For example, to perform the operation
 R1 R2 + R3, the control must provide binary selection variables
to the following selector inputs:
 1. MUX A selector (SELA): to place the content of R2 into bus A.
 2. MUX B selector (SELB): to place the content of R3 into bus B.
 3. ALU operation selector (OPR): to provide the arithmetic
addition A +B.
 4. Decoder destination selector (SELD): to transfer the content
of output bus in to R1.
 The four control selection variables are generated in the control
unit and must be available at the beginning of a clock cycle.

8 Prepared By Haftom B. 05/01/2025


Diagrams Representations

9 Prepared By Haftom B. 05/01/2025


Example of Micro Operations Encoding of register selection fields

10 Prepared By Haftom B. 05/01/2025


Examples of Micro-Operations for the CPU

11 Prepared By Haftom B. 05/01/2025


6.3 Stack Organization
A useful feature that is included in the CPU of most
computers is a stack or last- in, first-out (LIFO) list.
 A stack is a storage device that stores information
in such a manner that the item stored last is the
first item retrieved.
 The stack in digital computers is essentially a
memory unit with an address register that can
count only (after an initial value is loaded into it).
 The register that holds the address for the stack is
called a stack pointer (SP) because its value
always points at the top in the stack.
12 Prepared By Haftom B. 05/01/2025
Cont..
 The two operations of a stack are the insertion and deletion
of items.
 The operation of the insertion is called PUSH (or push-down)
because it can be thought of as the result of pushing a new
item on top.
 The operation of deletion is called POP (or pop-up) because
it can be thought as the result of removing one item so that
the stack pops up.
 However, nothing is pushed or popped in a computer stack.
 In computers, these operations are simulated by
incrementing or decrementing the stack pointer register.
13 Prepared By Haftom B. 05/01/2025
Example
A new item is inserted with the push
operation as follows:
SP SP - 1
M[SP]DR
 the pop operation as follows:

DRM[SP]
SPSP + 1

14 Prepared By Haftom B. 05/01/2025


Cont..
 The two micro-operations needed for either the push or
pop are:

1. An access to memory through SP and

2. Updating SP.

15 Prepared By Haftom B. 05/01/2025


6.4 Instruction Formats
 A computer will usually have a variety of instruction code formats.
 The bits of the instruction are divided into groups called Fields.
 The most common fields found in instruction formats are:
1. An operation code field that specifies the operation to be
performed
2. An address field that designate a memory address or a processor
register
3. A mode field that specifies the way the operand or the effective
address is determined
16 Prepared By Haftom B. 05/01/2025
Cont..
 Computers may have instruction of several lengths containing
varying number of addresses.

 The number of address field in the instruction format of a computer


depends on the internal organization of its registers.

 Most computers fall into one of three types CPU organizations.

1. Single accumulator organization

2. General register organization

3. Stack organization

17 Prepared By Haftom B. 05/01/2025


Single accumulator organization
 In this organization all operations are performed with an implied accumulator register.

 The instruction format in this type of computer uses one address field.

 For example, the instruction that specifies an arithmetic addition is defined by an


assembly language:

 ADD X, where X is the address of the operand.

 Which results ACX+M(X)

 AC is the accumulator register and M[X] symbolizes the memory word located at
address X.
18 Prepared By Haftom B. 05/01/2025
General register organization
 The instruction format in a computer with a general register
organization type needs two or three register address fields.
 e.g. ADD R1, R2, R3 R1 R2 + R3.

e.g. ADD R1, R2 denotes R1 R1 + R2. Only register addresses for R1 and R2 need be
specified in this instruction.
e.g. ADD R1, X denotes R1 R1 + M[x]. It has two address fields, one for register R1 and
the other for the memory address X.

19 Prepared By Haftom B. 05/01/2025


Stack-organization
 Computers with stack-organization would have PUSH and POP
instructions which require an address field.
 E.g. PUSH X will push the word at address X to the top of the stack.

 Operation-type (e.g. ADD) instructions do not need an address field


in stack-organized computers.

 This is because the operation is performed on the two items that are
on top of the stack.

20 Prepared By Haftom B. 05/01/2025


Full examples using one, Two- Address and three
Instruction
 The program in assembly language that evaluates X = (A+B) * (C+D)
MOV R1, A R1 M[A]
ADD R1, A, B R1 M[A] + M[B]
ADD R1, B R1 R1 + M[B]
ADD R2, C, D R2 M[C] + M[D] MOV R2, C R2 M[C]
ADD R2, D R2 R2 + M[D]
MUL X, R1,R2 M[X] R1 * R2 MUL R1, R2 R1 R1 * R2
MOV X, R1 M[X] R1
LOAD A AC M[A]
ADD B AC AC + M[B]
STORE T M[T] AC
LOAD C AC M[C]
ADD D AC AC + M[D]
MUL T AC AC * M[T]
STORE X M[X] AC

21 Prepared By Haftom B. 05/01/2025


RISC Instructions

 RISC stands for reduced instruction set computer.

 A program for a RISC-type CPU consists of

 LOAD and STORE instructions that have one memory and one register
address and computational-type instructions that have three addresses
with all three specifying processor registers.

22 Prepared By Haftom B. 05/01/2025


The following is a program to evaluate X = (A+B) (C+D).
LOAD R1, A R1 M[A]
LOAD R2, B R2 M[B]
LOAD R3, C R3 M[C]
LOAD R4, D R4 M[D]
ADD R1, R1, R2 R1 R1 + R2
ADD R3, R3, R4 R3 R3 + R4
MUL R1, R1, R3 R1 R1* R3
STORE X, R1 M[X] R1

23 Prepared By Haftom B. 05/01/2025


6.5 Addressing Mode
 The way the operands are chosen during program execution is
dependent on the addressing mode of the instruction.
 The addressing mode specifies a rule for interpreting or
modifying the address field of the instruction before the
operand is actually referenced.
 Computers use addressing mode techniques for the purpose of
accommodating one or both of the following provisions.
1. To give programming versatility to the user by providing such
facilities as pointers to memory, counters for loop control, indexing
of data and program relocation.
2. To reduce the number of bits in the addressing field of the
instruction
24 Prepared By Haftom B. 05/01/2025
Cont..
 The availability of the addressing modes gives the experienced assembly
language programmer flexibility for writing programs that are more
efficient with respect to the number of instructions and execution time.

25 Prepared By Haftom B. 05/01/2025


Cont..
 The control unit of a computer is designed to go through an instruction
cycle that is divided into three major phases.

1. Fetch the instruction from memory (PC)


2. Decode the instruction
3. Execute the instruction

26 Prepared By Haftom B. 05/01/2025


Types of Addressing Modes
 Implied Mode
 operands are specified implicitly example complement accumulator
 Immediate Mode
 operand is specified in the instruction itself immediate value assigning
 Register Mode operands are in registers that reside within the CPU
 Register Indirect Mode
 Mode the instruction specifies a register in the CPU whose contents give the
address of the operand in memory

27 Prepared By Haftom B. 05/01/2025


Cont..
 Auto-increment and Auto-decrement Mode
 the register is incremented or decremented after (or before) its value is used to access memory.
 Direct Addressing Mode
 Direct addressing is a scheme in which the address specifies which memory word or register
contains the operand. Example: LOAD R1, 100
 Indirect Addressing Mode
 the address field of the instruction gives the address where the effective address is stored in memory
 Relative Addressing mode
 content of program counter is added to the address part of the instruction in
order to obtain the effective address.

28 Prepared By Haftom B. 05/01/2025


6.6 Data Transfer and Manipulation
 Computers provide an extensive set of instruction to give the user the
flexibility to carry out various computational tasks.
 Most computer instructions can be classified in to three categories.

1. Data transfer instruction.


2. Data manipulation instruction
3. Program control instruction

29 Prepared By Haftom B. 05/01/2025


1. Data transfer instruction:
 Data transfer instructions move data from place to place in the computer to
another without changing the data content.
 The most common transfers are between memory and processor registers,
between processor register and input or output, and between the
processor registers themselves.

30 Prepared By Haftom B. 05/01/2025


2. Data Manipulation:
 Data manipulation instructions perform operations on data and
provide the computational capabilities for the computer.

 The data manipulation instructions in a typical computer are usually


divided into three basic types.

1. Arithmetic instruction
2. Logical and bit manipulation
3. Shift instruction
31 Prepared By Haftom B. 05/01/2025
Cont..
 Arithmetic Instruction: The four basic arithmetic operations are
addition, subtraction, multiplication and division.
 Most computers provide instructions for all four operations.
 Some small computers have only addition and possibly subtraction
instructions.
 The multiplication and division must then be generated by means of
software subroutines.
 The four basic arithmetic operations are sufficient for formulating
solution to scientific problems when expressed in terms of numerical
analysis methods.

32 Prepared By Haftom B. 05/01/2025


Cont..
 Logical and Bit Manipulation Instructions: Logical instructions
perform binary operations on strings of bits stored in registers.
 They are useful for manipulating individual bits or a group of bits that
represent binary–coded information.
 The logical instructions consider each bit of the operands separately and
treat it as a Boolean variable.
 By proper application of the logical instructions it is possible to change
bit values, to clear a group of bits or to insert new bit values into the
operands stored in registers or memory words.

33 Prepared By Haftom B. 05/01/2025


Cont..
 Shift Instruction: Instructions to shift the content of an operand are quite
useful and are often provided in several variations.

 Shifts are operations in which the bits of a word are moved to the left or right.

 The bit shifted in at the end of the word determines the type of shift used.

 Shift instructions may specify either logical shifts, arithmetic shifts, or rotate
type operations.

 In either case the shift may be to the right or to the left.


34 Prepared By Haftom B. 05/01/2025
Reduced Instruction Set computer (RISC)
 The instruction set chosen for a particular computer determines the way
that machine language programs are constructed.
 Early computers had small and simple instruction sets, forced mainly by
the need to minimize the hardware to implement them.
 Many computers have instruction sets that include more than 100 and
sometimes even more than 200 instructions.
 These computers also employ a variety of data types and a large number
of addressing modes

35 Prepared By Haftom B. 05/01/2025


Cont..
 A computer with a large number of instructions is classified as a complex
instruction set computer, abbreviated as CISC.
 In the early 1980_s, a number of computer designers recommended that
computers use fewer instructions with simple constructs so they can be
executed much faster within the CPU without having to use memory as
often.
 This type of computer is classified as a Reduced Instruction Set
Computer (RISC).

36 Prepared By Haftom B. 05/01/2025


CISC characteristics
 Large number of instructions – typically from 100 to 250 instructions
 Some instructions that perform specialized tasks and are used infrequently
 A large variety of addressing modes – typically from 5 to 20 different modes
 Variable length instruction formats
 Instructions that manipulate operands in memory

37 Prepared By Haftom B. 05/01/2025


RISC characteristics
 Relatively few instructions
 Relatively few addressing modes
 Memory access limited to load and store instructions
 All operations done within the register of the CPU
 Fixed length, easily decoded instruction format
 Single cycle instruction execution
 Hard-wired rather than micro-programmed control
 A relatively large number of registers in the processor
 Use overlapped register windows to speed up procedure call and return
 Efficient instruction pipeline
 Compiler support for efficient transmission high-level language programs into machine language programs

38 Prepared By Haftom B. 05/01/2025


Thanks

The End

39 Prepared By Haftom B. 05/01/2025

You might also like