Module 1 - CO
Module 1 - CO
Module 1 - CO
(21EC52)
Where Add is the operation code, LOCA is the Memory operand and R0 is Register operand
This instruction adds the contents of memory location LOCA with the contents of Register R0 and
the result is stored in R0 Register.
The symbolic representation of this instruction is
R0 [LOCA] + [R0]
The contents of memory location LOCA and Register R0 before and after the execution of this
instruction is as follows
1
Computer Organization and Arm Microcontroller Module1
(21EC52)
Where R1 is Source Operand-1, R2 is the Source Operand-2 and R3 is the Destination. This
instruction adds the contents of Register R1 with the contents of R2 and the result is placed in R3
Register.
The symbolic representation of this instruction is
R3 [R1] + [R2]
The contents of Registers R1,R2,R3 before and after the execution of this instruction is as follows.
Before instruction execution After instruction execution
R1 = 24H R1 = 24H
R2 = 34H R2 = 34H
R3 = 38H R3 = 58H
2
Computer Organization and Arm Microcontroller Module1
(21EC52)
1. MAR
It establishes communication between Memory and Processor
It stores the address of the Memory Location as shown in the figure.
MAR
Memory
5000h 5000 23h
5001 43h
5002 78h
5003 65h
2. MDR
It also establishes communication between Memory and the Processor.
It stores the contents of the memory location (data or operand), written into or read from
memory as shown in the figure.
MDR
Memory
23h 23h 5000
43h 5001
78h 5002
65h 5003
3. CONTROL UNIT
It controls the data transfer operations between memory and the processor.
It controls the data transfer operations between I/O and processor.
It generates control signals for Memory and I/O devices.
3
Computer Organization and Arm Microcontroller Module1
(21EC52)
4. PC (PROGRAM COUNTER)
It is a special purpose register used to hold the address of the next instruction to be
executed.
The contents of PC are incremented by 1 or 2 or 4, during the execution of current
instruction.
The contents of PC are incremented by 1 for 8 bit CPU, 2 for 16 bit CPU and for 4 for 32
bit CPU.
R0
R1
R2
.
Rn-1
It consists of set of registers.
A register is defined as group of flip flops. Each flip flop is designed to store 1 bit of
data.
It is a storage element.
It is used to store the data temporarily during the execution of the program(eg: result).
It can be used as a pointer to Memory.
The Register size depends on the processing speed of the CPU
EX: Register size = 8 bits for 8 bit CPU
5. IR (INSTRUCTION REGISTER
It holds the instruction to be executed. It notifies the control unit, which generates timing
signals that controls various operations in the execution of that instruction.
4
Computer Organization and Arm Microcontroller Module1
(21EC52)
2. BUS STRUCTURE
Bus is defined as set of parallel wires used for data communication between different parts of
computer. Each wire carries 1 bit of data. There are 3 types of buses, namely
1. Address bus
2. Data bus and
3. Control bus1.
1. Address bus :
It is unidirectional.
The processor (CPU) sends the address of an I/O device or Memory device by means of
this bus.
2. Data bus
It is a bidirectional bus.
The CPU sends data from Memory to CPU and vice versa as well as from I/O to CPU
and vice versa by means of this bus.
3. Control bus:
This bus carries control signals for Memory and I/O devices. It generates control signals
for Memory namely MEMRD and MEMWR and control signals for I/O devices namely IORD
and IOWR.
The I/O devices, Memory and CPU are connected to this bus is as shown in the figure.
It establishes communication between two devices, at a time.
5
Computer Organization and Arm Microcontroller Module1
(21EC52)
between two devices, a buffer register is attached to each device. It holds the data temporarily
during the data transfer between two devices.
3. PERFORMANCE
Basic performance Equation
The performance of a Computer System is based on hardware design of the processor and
the instruction set of the processors.
To obtain high performance of computer system it is necessary to reduce the execution
time of the processor.
Execution time: It is defined as total time required executing one complete program.
The processing time of a program includes time taken to read inputs, display outputs,
system services, execution time etc.
The performance of the processor is inversely proportional to execution time of the
processor.
More performance = Less Execution time.
Less Performance = More Execution time.
CACHE MEMORY: It is defined as a fast access memory located in between CPU and
Memory. It is part of the processor as shown in the fig
The processor needs more time to read the data and instructions from main memory
because main memory is away from the processor as shown in the figure. Hence it slowdown the
performance of the system.
The processor needs less time to read the data and instructions from Cache Memory
because it is part of the processor. Hence it improves the performance of the system.
6
Computer Organization and Arm Microcontroller Module1
(21EC52)
PROCESSOR CLOCK: The processor circuits are controlled by timing signals called as Clock.
It defines constant time intervals and are called as Clock Cycles. To execute one instruction there
are 3 basic steps namely
1. Fetch
2. Decode
3. Execute.
The processor uses one clock cycle to perform one operation as shown in the figure
Clock Cycle → T1 T2 T3
Instruction → Fetch Decode Execute
The performance of the processor depends on the length of the clock cycle. To obtain high
performance reduce the length of the clock cycle. Let ‘ P ’ be the number of clock cycles generated
by the Processor and ‘ R ‘ be the Clock rate .
PERFORMANCE Measurement:
When we compare the performance of different computers say A, B, C, we may observe that some
programs run faster by computers say A, B, C, we may observe that some programs run faster by computer
A, some computer B and some by computer C. In this situation they present a confusing picture and we
cannot have a clear idea of which computer is faster. This happens because each computer has an ability to
execute faster than others.
When instruction has all its operands in CPU registers, it will run faster whereas the instruction which
7
Computer Organization and Arm Microcontroller Module1
(21EC52)
requires multiple memory accesses takes more time to execute. Let us consider two programs P1 and P2,
with instructions having all operands in the memory, respectively. Also consider two computers C1, and
C2. The clock speed of C1 is greater than the clock speed of C2; however the memory access time in C2 is
less than the memory access time in C1. In such situation it is difficult to decide which computer is faster.
Therefore, measures of instruction execution performance are based on average figures, which are usually
determined experimentally by measuring the run times of representative called benchmark programs.
The selected benchmark programs are compiled for the computer under test, and the running time on real
computer is measured. The same benchmark program is also compiled and run on the reference computer.
A non-profit organization called System Performance Evaluation Corporation (SPEC) specified the
benchmark programs and reference computers in 1995 and again in 2000. Foe SPEC95, the reference
computer is the SUN SPARC station 10/40 and for SPEC2000, the reference computer the Ultra-SPARC10
workstation with 300 MHz Ultra SPARC-II processor.
The running time of a benchmark program is compared under test and the reference computer to decide the
SPEC rating of the computer under test. The SPEC rating is given by
The SPEC rating for all selected programs is individually calculated and then the geometric mean of the
results is computed to determine the overall SPEC rating for the computer under test. It is given by
8
Computer Organization and Arm Microcontroller Module1
(21EC52)