M-Mushtaq Hussain 1.4.1 CPU Architecture Von Neumann model Von Neumann introduced the idea of the stored program. Previously data and programs were stored in separate memories.von Neumann realized that data and programs are indistinguishable and can therefore use the same memory. Von Neumann architecture uses a single processor. It follows a linear sequence of fetch- decode-execute operations for sequence of instructions which makeup the program. In order to do this a processor has to use some special registers. A register is simply a location that can store extremely limited amount of instruction or data only immediately before or after processing. The registers are outside the immediate access store and consequently allow faster access to the data they store. Processor uses a group of special purpose registers to execute a program Program counter (PC): Program counter is sometimes called sequence control register. It stores the address of the next instruction to be fetched. Memory address register (MAR): When the next instruction is needed, its address is copied from the PC and placed in the memory address register. Memory data registers (MDR): It is sometime called the memory buffer register (MBR) because it acts like a buffer, temporarily storing a data value before passing it on to e.g. CIR. Index register (IR): An index register in a computer's CPU is a processor register used for modifying operand addresses during the run of a program, typically for doing vector/array operations. If the address is an indexed address, add the address to the contents of the index register to form the address of actual data. Current instruction register (CIR): Holds the instruction that is about to be executed. Status register: A status register, flag register, or condition code register is a collection of status flag bits for a processor. The status register is a hardware register which contains information about the state of the processor. Role of arithmetic logic unit (ALU), control unit (CU) and system clock Arithmetic logic unit In digital electronics, an arithmetic logic unit (ALU) is a digital circuit that performs arithmetic and bitwise logical operations on integer binary numbers. It is a fundamental building block of the central processing unit (CPU) found in many computers. An ALU performs basic arithmetic and logic operations. Examples of arithmetic operations are addition, subtraction, multiplication, and division. Examples of logic operations are comparisons of values such as NOT, AND, and OR. Control unit The control unit is a component of a computer's central processing unit (CPU) that directs operation of the processor. It tells the computer's memory, arithmetic/logic unit and input and output devices how to respond to a program's instructions. It directs the operation of the other units by providing timing and control signals. All computer resources are managed by the CU (Control Unit).It directs the flow of data between the Central Processing Unit (CPU) and the other devices. Control unit: The Control Unit makes decisions and sends the appropriate signal down its lines to other parts of the computer. It controls the timing of operations in the computer and controls the instructions sent to the processor and the peripheral devices. Contact the teacher: 03215275281
15
Embed
Hussain M-Mushtaq · 1.4.2 The fetch-execute cycle . An instruction cycle (sometimes called fetch-and-execute cycle, fetch-decode-execute cycle, or FDX) is the basic operation cycle
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
M-Mush
taq H
ussain
1.4.1 CPU Architecture
Von Neumann model
Von Neumann introduced the idea of the stored
program. Previously data and programs were stored
in separate memories.von Neumann realized that
data and programs are indistinguishable and can
therefore use the same memory.
Von Neumann architecture uses a single processor. It follows a linear sequence of fetch-
decode-execute operations for sequence of instructions which makeup the program. In
order to do this a processor has to use some special registers.
A register is simply a location that can store extremely limited amount of instruction or
data only immediately before or after processing. The registers are outside the immediate
access store and consequently allow faster access to the data they store.
Processor uses a group of special purpose registers to execute a program
Program counter (PC): Program counter is sometimes called sequence control
register. It stores the address of the next instruction to be fetched.
Memory address register (MAR): When the next instruction is needed, its address is
copied from the PC and placed in the memory address register.
Memory data registers (MDR): It is sometime called the memory buffer register
(MBR) because it acts like a buffer, temporarily storing a data value before passing it
on to e.g. CIR.
Index register (IR): An index register in a computer's CPU is a processor
register used for modifying operand addresses during the run of a program, typically
for doing vector/array operations. If the address is an indexed address, add the
address to the contents of the index register to form the address of actual data.
Current instruction register (CIR): Holds the instruction that is about to be executed.
Status register: A status register, flag register, or condition code register is a
collection of status flag bits for a processor. The status register is a hardware
register which contains information about the state of the processor.
Role of arithmetic logic unit (ALU), control unit (CU) and system clock
Arithmetic logic unit
In digital electronics, an arithmetic logic unit (ALU) is a digital circuit that
performs arithmetic and bitwise logical operations on integer binary numbers. It is a
fundamental building block of the central processing unit (CPU) found in many computers. An ALU performs basic arithmetic and logic operations. Examples of arithmetic operations
are addition, subtraction, multiplication, and division. Examples of logic operations are
comparisons of values such as NOT, AND, and OR.
Control unit
The control unit is a component of a computer's central processing unit (CPU) that directs
operation of the processor. It tells the computer's memory, arithmetic/logic unit and input
and output devices how to respond to a program's instructions.
It directs the operation of the other units by providing timing and control signals. All
computer resources are managed by the CU (Control Unit).It directs the flow of data
between the Central Processing Unit (CPU) and the other devices.
This is a very simple way of addressing memory - direct addressing means the code refers
directly to a location in memory
For example SUB (3001)
In this instance the value held at the absolute location 3001 in RAM is subtracted from the
accumulator. The good thing about direct addressing is that it is fast (but not as fast as
immediate addressing) the bad thing about direct addressing is that the code depends on
the correct data always being present at same location.
It is generally a good idea to avoid referring to absolute memory addresses in order to have
'relocatable code' i.e. code that does not depend on specific locations in memory.
You could use direct addressing on computers that are only running a single program. For
example an engine management computer only ever runs the code the car engineers
programmed into it, and so direct memory addressing is excellent for fast memory access.
Contact the teacher: 03215275281
M-Mush
taq H
ussain
Indirect addressing
Contact the teacher: 03215275281
M-Mush
taq H
ussain
Indexed addressing
The address is formed by the operand plus the number in the index register.
Index addressing is fast and is excellent for manipulating data structures such as arrays as
all you need to do is set up a base address (e.g. 10 in CIR) then use the index in your code
to access individual elements. Another advantage of indexed addressing is that if the array
is re-located in memory at any point then only the base address needs to be changed. The
code making use of the index can remain exactly the same.
Relative addressing
Quite often a program only needs to jump a little bit in order to jump to the next
instruction. Maybe just a few memory locations away from the current instruction. A very
efficient way of doing this is to just add a small offset to the current address in the program
counter. (Remember that the program counter always points to the next instruction to be
executed).This is called 'relative addressing'
DEFINITION:
Relative addressing means that the next instruction to be carried out is an offset number of
locations away, relative to the address of the current instruction.
Consider this bit of pseudo-code:
jmp +3 if accumulator == 2 Code executed if accumulator is NOT = 2 jmp +5 (unconditional relative jump to avoid the next line of code) acc: Code executed if accumulator is = 2) Carry on:
In the code snippet above, the first line of code is checking to see if the accumulator has the
value of 2 in it. If it is has, then the next instruction is 3 lines away. This is called a
conditional jump and it is making use of relative addressing.
Another example of relative addressing can be seen in the jmp +5 instructions. This is
telling the CPU to effectively avoid the next instruction and go straight to the 'carryon' point.