Professional Documents
Culture Documents
Lesson Objective:
function of of CPU
Topics to be covered
• Top-Level View of Computer Function and Interconnection
• Computer arithmetic, Instruction sets, Instruction format and addressing
modes, CPU Structure, RISC and CISC, Pipelining, The Control Unit.
Learning outcomes:
Start
Model categories
Start
Model categories
Start
Model categories
Hardwired program
The result of the process of connecting the various components in the desired
configuration
Programming in
software
• Instead of rewiring
the hardware for
each new program,
the programmer
merely needs to
supply a new set of
control signals.
MAR
The program counter (PC) holds the address of the instruction to be fetched
next
The processor increments the PC after each instruction fetch so that it will fetch
the next instruction in sequence
The processor interprets the instruction and performs the required action
Processor- Processor-
memory I/O
Data
Control
processing
The number of lines determines how many bits can be transferred at a time
Interpret instruction
The instruction is decoded to determine what action is required
Fetch data
The execution of an instruction may require reading data from memory or an I/O module
Process data
The execution of an instruction may require performing some arithmetic or logical operation on data
Write data
The results of an execution may require writing data to memory or an I/O module
In order to do these things the processor needs to store some data temporarily and therefore
needs a small internal memory
Categories:
Referenced by means of •General purpose
the machine language •Can be assigned to a variety of functions by
the programmer
that the processor •Data
executes •May be used only to hold data and cannot be
employed in the calculation of an operand
address
•Address
•May be somewhat general purpose or may be
devoted to a particular addressing mode
•Examples: segment pointers, index registers,
stack pointer
•Condition codes
•Also referred to as flags
•Bits set by the processor hardware as the
result of operations
If interrupts are
Read the next enabled and an
Interpret the opcode
instruction from interrupt has occurred,
and perform the
memory into the save the current
indicated operation
processor process state and
service the interrupt
Also referred to
as a pipeline
bubble
Exceptions
Generated from software and is provoked by the execution of an instruction
Processor detected
Programmed
Interrupt 10 Invalid task state segment; segment describing a requested task is not initialized or not valid
11 Segment not present; required segment not present
Vector 12 Stack fault; limit of stack segment exceeded or stack segment not present
Table 13 General protection; protection violation that does not cause another exception (e.g., writing to a
read-only segment)
14 Page fault
15 Reserved
16 Floating-point error; generated by a floating-point arithmetic instruction
17 Alignment check; access to a word stored at an odd byte address or a doubleword stored at an
address not a multiple of 4
18 Machine check; model specific
19-31 Reserved
32-255 User interrupt vectors; provided when INTR signal is activated
A uniform fixed-length instruction of 32 bits for the standard set and 16 bits for the Thumb
instruction set
A small number of addressing modes with all load/store addresses determined from
registers and instruction fields
Auto-increment and auto-decrement addressing modes are used to improve the operation
of program loops
Most application
programs execute in
ARM user mode
architecture • While the processor is in
supports seven user mode the program
being executed is unable
execution to access protected
modes system resources or to
change mode, other than
by causing an exception
to occur
Examples include:
ADD Add
SUB Subtract
MUL Multiply
DIV Divide
LOAD Load data from memory
STOR Store data to memory
Data Data
processing storage
Data
Control
movement
• Test instructions are used to test the • I/O instructions are needed
value of a data word or the status of a to transfer programs and
computation data into memory and the
• Branch instructions are used to branch results of computations
to a different set of instructions back out to the user
depending on the decision made
Packed decimal
Each decimal digit is represented by a 4-bit code with two digits
stored per byte
To form numbers 4-bit codes are strung together, usually in multiples
of 8 bits
Another code used to encode characters is the Extended Binary Coded Decimal
Interchange Code (EBCDIC)
EBCDIC is used on IBM mainframes
An n-bit unit consisting of n 1-bit items of data, each item having the value 0 or 1
Must specify:
• Location of the source and
destination operands
Most fundamental type of • The length of data to be
machine instruction transferred must be indicated
• The mode of addressing for each
operand must be specified
An example of a
more complex
editing
instruction is the
An example EAS/390
is converting Translate (TR)
from instruction
decimal to
binary
Immediate
Direct
Indirect
Register
Register indirect
Displacement
Stack
Operand = A
This mode can be used to define and use constants or set initial values of
variables
Typically the number will be stored in twos complement form
The leftmost bit of the operand field is used as a sign bit
Advantage:
No memory reference other than the instruction fetch is required to obtain the
operand, thus saving one memory or cache cycle in the instruction cycle
Disadvantage:
The size of the number is restricted to the size of the address field, which, in most
instruction sets, is small compared with the word length
Address field
contains the
effective address of
the operand
Effective address
(EA) = address field
(A)
Was common in
earlier generations
of computers
Limitation is that it
provides only a
limited address
space
EA = (A)
Parentheses are to be interpreted as meaning contents of
Advantage:
For a word length of N an address space of 2N is now available
Disadvantage:
Instruction execution requires two memory references to fetch the operand
One to get its address and a second to get its value
Address field
refers to a
register rather EA = R
than a main
memory address
Advantages: Disadvantage:
• Only a small • The address space
address field is is very limited
needed in the
instruction
• No time-consuming
memory references
are required
EA = (R)
Address space limitation of the address field is overcome by having that field
refer to a word-length location containing an address
EA = A + (R)
Requires that the instruction have two address fields, at least one of which is
explicit
The value contained in one address field (value = A) is used directly
The other address field refers to a register whose contents are added to A to produce
the effective address
In others the programmer may choose a register to hold the base address of a
segment and the instruction must reference it explicitly
Autoindexing
Automatically increment or decrement the index register after each reference to it
EA = A + (R)
(R) (R) + 1
Postindexing
Indexing is performed after the indirection
EA = (A) + (R)
Preindexing
Indexing is performed before the indirection
EA = (A + (R))
Must include
Define the
an opcode For most
layout of the
and, implicitly instruction
bits of an
or explicitly, sets more than
instruction, in
indicate the one
terms of its
addressing instruction
constituent
mode for each format is used
fields
operand
Should be a multiple of the character length, which is usually 8 bits, and of the
length of fixed-point numbers
Execution sequencing
Semantic gap
• Determines the control and
pipeline organization • The difference between the
operations provided in HLLs
and those provided in computer
architecture
Operands used
• The types of operands and the Operations performed
frequency of their use
• Determine the functions to be
determine the memory
performed by the processor
organization for storing them
and its interaction with memory
and the addressing modes for
accessing them
Prepared by: Tayachew Fikire Computer architecture & organization 121
Implications
Software Solution
Hardware Solution
Requires sophisticated
program analysis
In addition, the linker must decide which global variables should be assigned to
registers
There is a trend to richer instruction sets which include a larger and more
complex number of instructions
Simple addressing • Simplifies the instruction set and the control unit
modes
Qualitative
Examine issues of high level language support and use of VLSI real estate