Professional Documents
Culture Documents
COMPUTER ARCHITECTURE ch-1
COMPUTER ARCHITECTURE ch-1
CHAPTER ONE
INTRODUCTION
What Is a Computer?
A computer is an electronic device, operating
under the control of instructions stored in its
own memory that can accept data (input),
process the data according to specified rules,
produce information (output), and store the
information for future use.
Cont’d…
Input Output
Processing
Peripherals Computer
Central Main
Processing Memory
Unit
Computer
Systems
Interconnection
Input
Output
Communication
lines
Structure - The CPU
CPU
Computer Arithmetic
Registers and
I/O Login Unit
System CPU
Bus
Internal CPU
Memory Interconnection
Control
Unit
Structure - The Control Unit
Control Unit
CPU
Sequencing
ALU Login
Control
Internal
Unit
Bus
Control Unit
Registers Registers and
Decoders
Control
Memory
Assignment-I(10%)
1.2 Computer Evolution and performance
Computer performance
Computer performance is the amount of work
accomplished by a computer system.
Performance analysis should help answering
questions such as how fast can a program be
executed using a given computer?
The word performance in computer performance
means “How well is the computer doing the work it
is supposed to do?”. It basically depends on
response time, throughput and execution time of a
computer system.
Cont’d…
• Response time is the time from start to
completion of a task. This also includes:
Operating system overhead.
Waiting for I/O and other processes
Accessing disk and memory
Time spent executing on the CPU or execution time. This is
also referred to as execution time.
Throughput is the total amount of work done in a
given time.
CPU execution time is the total time a CPU spends
computing on a given task(excludes time for I/O or
running other programs). This is also referred to as
simply CPU time.
Cont’d…
Performance is determined by execution time as performance
is inversely proportional to execution time.
Performance = (1 / Execution time)
(Performance of A / Performance of B) = (Execution Time of B
/ Execution Time of A)
Example –
Machine A runs a program in 100 seconds, Machine B runs the
same program in 125 seconds
(Performance of A / Performance of B) = (Execution Time of B /
Execution Time of A) = 125 / 100 = 1.25 That means machine A is
1.25 times faster than Machine B.
Computing CPU Time
The time to execute a given program can be computed as
CPU time = CPU clock cycles x clock cycle time „Since
clock cycle time and clock rate are reciprocals
CPU time = CPU clock cycles / clock rate „The number
of CPU clock cycles can be determined by
CPU clock cycles = (instructions/program) x (clock
cycles/instruction) = Instruction count x CPI(Cycles
per Instruction) which gives
CPI =CPU clock cycles for the program/
Instruction count
CPU time = Instruction count x CPI x clock cycle time
CPU time = Instruction count x CPI / clock rate „
CPU Time Example „
• Example 1: ‰ CPU clock rate is 1 MHz ‰Program
takes 45 million cycles to execute What’s the
CPU time?
45,000,000 * (1 / 1,000,000) = 45 seconds
Calculation of CPI (Cycles Per Instruction)
For the multi-cycle MIPS
Load 5 cycles
Store 4 cycles
R-type 4 cycles
Branch 3 cycles
Jump 3 cycles
If a program has
50% R-type instructions
10% load instructions
20% store instructions
8% branch instructions
2% jump instructions
then what is the CPI?
CPI = (4x50 + 5x10 + 4x20 + 3x8 + 3x2)/100 = 3.6
„
• MIPS : millions of instructions per second ‰
MIPS = instruction count / (execution time x
10^6 )
• MIPS =Instruction count/Execution time x
10^6 =Clock rate/CPI x 10^6
Examples
Solution
Cont’d…
Cont’d…
Cont’d…
Cont’d…
Cont’d…
Modeling a computer system
Computer modeling is the process of using a computer to
make model of plan or design, especially in order to discover
how to make or improve a product.
VON NEUMANN ARCHITECTURE MODEL
In Von-Neumann architecture, there is no separate
data and program memory. Instead, a single memory
connection is given to the CPU.
Speed of execution is slower since it cannot
fetch the data and instructions at the same
time.
Speed of execution is slower since it cannot
fetch the data and instructions at the same
time.
Eg PC intel architecture computers
Harvard architecture model
• The Harvard architecture is a computer architecture with
separate storage and signal pathways for instructions and data.
Speed of execution is faster because the processor
fetches data and instructions simultaneously .
Controlling becomes complex since data and
instructions are to be fetched simultaneously.
It results in wastage of space since if the space is left
in the data memory then the instructions memory
cannot use the space of the data memory and vice-
versa.
Difference between Harvard architecture and
von-Neumann architecture
Harvard architecture model Von Neumann architecture model
The name is originated from “Harvard Mark I” It is named after the mathematician and early
a relay based old computer. computer scientist John Von Neumann.
It required two memories for their instruction It required only one memory for their
and data. instruction and data.
Design of the von Neumann architecture is
Design of Harvard architecture is complicated.
simple.
Harvard architecture is required separate bus Von Neumann architecture is required only
for instruction and data. one bus for instruction and data.
Processor can complete an instruction in one Processor needs two clock cycles to complete
cycle an instruction.
Easier to pipeline, so high performance can be Low performance as compared to Harvard
achieve. architecture.
Comparatively high cost. It is cheaper.