Académique Documents
Professionnel Documents
Culture Documents
1. Both program instructions and data are stored together in the same memory
What are the special registers required for implementing the Von Neumann architecture?
1. PC – Program counter
2. CIR – Current instruction register
3. MAR – Memory address register
4. MDR – Memory data register
5. Accumulator
1. Program counter – Holds the memory address of the next instruction to be processed. It is
altered to allow for Jump instructions.
2. Current instruction register – Holds the instruction that is currently being executed. CIR splits
the binary code into operation code and address
3. Memory address register – Contents of PC is copied into MAR. Holds the memory address of
the next program instruction to be processed.
Operand part of the instruction is copied into MAR from CIR. Holds the address of the data
needed to complete the processing of that cycle.
4. Memory data register – Holds a program instruction or a piece of data copied from the
memory. MDR acts as the buffer between the memory and the central processing unit.
The processor divides into two areas called central processing unit and the main memory. Main
memory is also known as the memory unit. The central processing unit contains the arithmetic
and logic unit and the control unit.
2
Arithmetic and logic unit carries out the arithmetic operations (addition, subtraction, division and
multiplication) and logic operations (comparison of two pieces of data to determine whether one
is greater than, smaller than or equal to the other).
Control unit controls the timing and routing of signals inside the processor. It also decodes the
instruction which is held in the current instruction register.
This is the set of repetitive tasks always being carried out by the processor when it is switched on.
Fetch phase
What is “fetch”?
This is “decode”?
This is the process of analyzing a machine code instruction by the control unit to determine its
function.
What is “execute”?
op code operand
What is operand?
The operand is the data that the op code of an assembly language instruction will operate on.
Assembly language instructions have the format where op code is followed by operand.
Example: LDA 100 (100 is the operand on which the operator LDA will operate on)
How the operand will be treated as, depends on the addressing mode.
ALU
Accumulator ADD 220
PC 160
Control Unit
CIR
MDR
2500 150
160
2501
180
2502
4
1. Addressing mode is the method that a machine language instruction uses to tell the processor
the address of the data.
2. Addressing mode forms part of the instruction set architecture of the processor.
3. The addressing mode specifies how to calculate the effective memory address of an operand by
using information held in registers and/or constants contained within a machine instruction.
Under direct addressing mode operand is treated as the address of the data.
Under indirect addressing mode operand is treated as the address of the address of the data.
Under indexed addressing the operand is added to the value in the indexed register to calculate
the address of the data. Here that operand is called as the base address.
This is used to access the areas of memory, which are not otherwise accessible using the space
available for the address in the instruction code.
5
If the operand is only 1 byte in size, the maximum address that the operand can contain is 255.
If the program needs to access the memory address 2500, it can do this by using the instruction
ADD 220 with indirect addressing mode. This is because the address 220 can be accommodated
by the one byte operand.
Indexed addressing allows a set of contiguous data (array) to be accessed without altering
instruction.
Using this mode of addressing, the address of the operand can be modified by operating on the
contents of the index register.
Suppose that the current instruction is the one that is at the memory location 110 which is ADD
210.
Suppose that there is an array containing three pieces of data in the memory locations 2500, 2501
and 2502 and these data have to be added to the accumulator.
Here since the current instruction is the instruction ADD 210, this operation can be performed by
using the indexed addressing mode and setting the index register to 2290 and executing a loop
where IR will be increased by 1 in each round of the loop.
At the end of the loop the execution of the program will fall back to the instruction at the base
address which is the memory location 110.
Steps involved in a linear sequence of fetch-execute cycle for the LDA 200 instruction
Steps involved in a linear sequence of fetch-execute cycle for the ADD 200 instruction
Increasing the speed of the fetch-execute cycle through pipelining the instructions
Processor is split into three parts. Each part handles one of the three phases of the fetch-execute
cycle. This results in the instructions being pipelined to the processor as shown in the figure given
below:
The effect of pipelining is that there are three instructions being dealt with at the same time. This
reduces the execution times considerably to approximately 1/3 of the regular time.
Pipelining can increase the speed of the fetch-execute cycle only with the execution of a linear
program i.e. as long as there is no Jump instruction exists in the program.
7
Suppose the instruction 2 is a jump to instruction 10. Then the instructions 3, 4 and 5 are needed
to be removed from the pipe and instruction 10 needs to be loaded into the fetch part of the pipe.
Therefore the pipe has to be cleared and restarted. The result is shown in the figure given below.
Parallel Processing
In this architecture many processors are used simultaneously where each processor carries out an
individual instruction through a separate fetch-execute cycle.
1. Weather forecasting where large amount of data have to be produced and the results are time
sensitive (results need to be produced within a specified time period).
Why some applications need parallel processing rather than serial processing?
2. The results of those calculations are required immediately (means that they are time sensitive)
1. An array of processors
3. Application software which has been developed to carry out parallel processing