Unit 1
Unit 1
The graph represents the concept: “up and to the right”, which means that the
technology changes rapidly.
It is performed by predicting the outcome of the condition test and then start
executing the indicated instruction rather than waiting for correct answer.
Performance is improved if the guesses are reasonably accurate and the
penalty of wrong guesses is not too severe.
ALU
Control unit
Overview And Instruction 1.7
[Link] Input Unit
They are electromechanical devices that allow the user to provide information
into the computer for analysis and storage inside the CPU.
Input device captures information and translates it into a form that can be processed
by the CPU.
Computer accepts input in two ways. They are,
o Manual entry the information is entered using keyboard or mouse.
o Direct entry the information is fed into the computer automatically
from a source document like barcode.
Examples for Input devices: Keyboard, pointing devices like Mouse, Joystick.
Whenever a key is pressed, the corresponding letter or digit is automatically
translated into its corresponding binary code
It is then transmitted over a cable to either the computer memory or the processor.
[Link] Central Processing Unit (CPU)
It is referred as ‘the brain of a computer system’.
It converts data (input) into meaningful information (output).
It is a highly complex, extensive set of electronic circuitry which executes stored
program instructions called software.
It controls all internal and external devices and performs arithmetic and logic
operations
It controls the usage of main memory to store data and instructions and controls the
sequence of operations.
It consists of three main subsystems.
o Arithmetic and Logic Unit (ALU)
o Memory Unit
o Control Unit (CU)
Arithmetic Unit
Contains the circuitry that is responsible for performing the actual computing and
carrying out the arithmetic calculations (+, -, *, /).
To perform these operations, operands from the main memory is bought into processor
After performing the operation results are stored in the memory location
It can perform these operations at very high speed.
Logic Unit
It enables the CPU to perform logical operations based on the instructions provided
to it.
Example: Logical comparison between data. ( Logical Operations : =, <, > conditions)
[Link] Memory Unit
Memory refers to the electronic holding place for instructions and data.
Memory also stores the intermediate results and output.
Memory is mainly classified into two categories: primary and secondary.
Primary Memory
It is also knows as main memory/ internal memory/ in-built memory.
It stores data and instructions for processing.
It is an integral component of CPU.
It is a fast memory that operates at electronic speeds.
The memory contains large no of semiconductor storage cells.
Each cell carries 1 bit of information.
The Cells are processed in a group of fixed size called Words.
To provide easy access to any word in a memory, a distinct address is associated
with each word location.
Addresses are numbers that identify successive locations.
The number of bits in each word is called the word length.
The word length ranges from 16 to 64 bits.
It can be classified as random access memory (RAM) and Read only memory (ROM).
Overview And Instruction 1.9
Volatility RAM is volatilei.e. its contents It is non-volatile i.e. its contents are
are lost when the device is retained even when the device is
powered off. powered off.
Types The two main types of RAM are The types of ROM include PROM,
static RAM and dynamic RAM. EPROM and EEPROM.
Use RAM allows the computer to ROM stores the program required
read data quickly to run to initially boot the computer.
applications. It allows reading It only allows reading.
and writing.
Secondary Memory
It is less expensive and stores huge volume of data than primary memory.
The data and instructions stored on such devices are permanent in nature.
Example: Pen drive, Floppy Disk, Compact Disk, External hard disk, etc.
1.10 Computer Architecture
Differences between primary and secondary memory
Sl. No. Primary Memory Secondary Memory
4. Due to its locality, it transfers data Since it is outside the CPU, it is slower
faster. when compared to primary memory.
Cache memory
Cache is a high speed memory located in between RAM and the CPU.
It increases the speed of processing since it holds the most frequently used data.
It is highly expensive and smaller in size.
It is present in two or three forms in a system – L1, L2 L3 cache memories.
The memory ranges from 256 KB to 2 MB.
Register memory
Registers are special-purpose, high speed temporary memory units
It holds various types of information such as data, instructions, addresses and the
intermediate result of calculations.
It holds the information that the CPU is currently working on.
It is said to be “CPU’s working memory” or an additional storage location that
offers the advantage of speed.
Overview And Instruction 1.11
Registers are of two types: general purpose and special purpose registers.
These are a set of registers that store temporary data and addresses
by the programmer.
These are registers that are meant for performing special purposes
by the CPU.
MBR stores the temporary data and MDR stores the operands
of the expression processed.
Control Unit
o Supervises and controls the path of information that runs over the
processor.
o Organizes the various activities of those units that lie inside it.
o Guides the flow of data through the different parts of the computer.
o Interprets the instructions.
o Regulates the time controls of the processor.
o Sends and receives control signals from various peripheral devices.
Output Devices take the machine-coded output results from the CPU and convert
them into a form that is easily readable by human beings.
Types
System Software
Application Software
Operating System
An operating system (OS) is a collection of software that manages computer
hardware resources and provides common services for computer programs.
The operating system is a vital component of the system software in a computer
system. Application programs require an operating system to function.
The functions of OS include Disk Access, Memory Management, Task Scheduling,
and User Interfacing.
Provides a software platform on top of which other programs run.
Example: MS –DOS, WINDOWS, LINUX, UNIX.
Device Drivers
These are system programs which are responsible for proper functioning of
devices.
Whenever a new device is added to a computer system the driver must be installed
before the device is used.
It acts as a translator between the device and the program that uses the device.
It is not an independent program; it assists or is assisted by the OS for proper
functioning.
Example: printer, monitor, mouse, keyboard.
1.14 Computer Architecture
Interpreter
Interpreters translate the source code into object code in line-by-line
manner, without looking at the entire program.
Programs produced by compilers run much faster than interpreter.
It is easier to modify the source code.
Example: Basic.
Assembler
Assemblers translate assembly language program into machine language.
System Utility
They are used to support, enhance and secure existing programs and data in the
computer system.
Word Processors
A word processor is software used to compose, format, edit and print electronic
documents.
We can include pictures, graphs, and charts and allows changes in alignments,
margins, font, and color and also allows spell checking.
Example: Microsoft word, word perfect
Spreadsheets
A spreadsheet application is a rectangular grid, which allows text, numbers and
complex functions to be entered into a matrix of thousands of individual cells.
Applications include payroll processing, financial record maintenance.
Example: Microsoft Excel, Lotus 1-2-3.
Image Editors
Image editor programs are designed specifically for capturing, creating, editing
and manipulating images.
The programs provide a variety of special features for creating and altering images.
They also enable the user to create and superimpose layers, import and export
graphic files, adjust an image and improve its appearance
Example: Adobe Photoshop, Adobe Corel Draw.
It controls the security and integrity of the database from unauthorized access.
Presentation Applications
A Presentation is a means of assessment, which requires presentation providers
to present their work orally in the presence of an audience.
It combines both visual and verbal elements.
Presentation software allows the user to create presentations by producing
slides/hand-outs for the presentation of projects.
Example: Microsoft PowerPoint.
This allows two or more transfers to be carried out at the same time, concurrently.
The V generation computers being dependent on the Ultra Large Scale Integration
(ULSI) technology that possesses several millions of transistors on a chip.
1965 Transistor 35
Network technology
In order to provide communication from one computer to another, LAN (Local
Area Network) like Ethernet, MAN (Metropolitan Area Network), WAN (Wide
Area Network) like internet and Wireless Network like Wi-Fi, Bluetooth were
introduced.
Networking technologies allow data sharing, communication
Although technology improves continuously, the impact of these improvements
can be in distinct leaps.
1.20 Computer Architecture
1.5 PERFORMANCE
The prime factors of the success of a computer are the speed and cost.
Performance depends on how fast machine instructions can be brought into
the processor for execution and how fast they can be executed.
The performance of a computer is dependent on
o the design of the compiler
o the machine instruction set
o the hardware
Terminologies
Response time
It is the time between the start and completion of a task.
It refers the execution time of a set of instructions.
The faster execution of instructions leads to reduction in response time, thus
increases throughput.
Throughput
It is the total work done in a unit time period.
Elapsed Time
The total time required to execute the program is called the elapsed time.
It depends on all the units in computer system.
Processor Time
The period in which the processor is active is called the processor time.
Clock
Bandwidth
The amount of data that can be transferred from one point to another in a given
time period is called bandwidth.
It is expressed in bits per second (bps).
Execution of an Instruction
At the start of execution all program instructions and the required data are stored
in the main memory.
As execution proceeds, instructions are fetched one by one over the bus into the
processor, and a copy is placed in the cache.
When the execution of an instruction calls for data located in the main memory,
the data are fetched and a copy is placed in the cache.
A Program will be executed faster if the movement of instruction and data between
the main memory and the processor is minimized, which is achieved by using the
Cache.
To execute a machine instruction, the processor divides the action to be performed
into a sequence of basic steps; each step can be completed in one clock cycle.
Clock Rate, R =1/P (measured in cycles per second)
where, P Length of one clock cycle
Pipelining
A considerable improvement in performance can be achieved by overlapping the execution
of successive instructions. This technique is called pipelining.
Superscalar Operation
Multiple instruction pipelines can be implemented in the processor that allows several
instructions can be executed in parallel by creating parallel paths. This mode of operation is
called the Superscalar execution.
Clock Rate
There are 2 possibilities to increase the clock rate(R).They are,
Reducing the amount of processing done in one basic step also helps to reduce
the clock period P.
Performance Improvement
To maximize the performance, minimize the response time or execution time
for some task.
The performance of the computer is directly related to performance and
execution time for computer, X.
Overview And Instruction 1.23
1
Performance X
Execution Time X
For two computers X and Y, the performance of X is greater than Y then we
have
PerformanceX PerformanceY
1 1
ExecutionTimeX ExecutionTimeY
Example
Time taken to run a program = 10s on A, 15s on B
Relative performance =Execution TimeB / Execution TimeA
=15s/10s
=1.5
So A is 1.5 times faster than B
Measuring Performance
Measured in terms of seconds per program
Defined as the total time taken to complete a task. The task includes
o disk access
o memory access
o I/O activities
o Execution of Instructions
This time taken is known as wall-clock time / response time.
CPU Time
Time the CPU spends computing for particular task and does not include the
time waiting for I/O.
This is also called as CPU execution time
1.24 Computer Architecture
Formula
Example
Let
User CPU time = 90.7 seconds
System CPU time = 12.9 seconds
Elapsed time = 2 minutes and 39 seconds (159 seconds)
CPU time
90.7 12.9
CPU Time 0.65
159
Performance Equation I
CPU execution time for a program CPU clock cycles for a program Clock cycle time
Performance is improved by reducing the length of the clock cycle or number of clock
cycle required for a program
Execution time depends on the number of instructions in a program
Number of clock cycles
CPU clock cycles Instructions for a program Average clock cycles per instruction
Clock cycles per instruction (CPI)
o Average number of clock cycles in which each instruction takes to execute
Overview And Instruction 1.25
Performance Equation II
CPU Execution Time in terms of instruction count, CPI and clock cycle
time
(OR)
Instruction Count CPI
CPU Execution Time
Clock Rate
Pdynamic = CV2F
where,
P is Power
C is capacitive loading
V is voltage applied
F is frequency running
1.26 Computer Architecture
Mobile devices care about battery life more than power, so energy is the proper
metric to be considered.
Energy is measured in joules.
Energydynamic = Capacitive load x Voltage2
In CMOS, static power is becoming an important issue because leakage current
flows even when a transistor is off.
Thus, increasing the number of transistors increases power even if they are turned
off, and leakage current increases in processors with smaller transistor sizes.
As a result, very low power systems are even gating the voltage to inactive modules
to control loss due to leakage.
Example
1.7.1 Multi-Processor
Computers that contain several processor units are called multiprocessor
system.
These systems either execute a number of different application tasks in
parallel or execute subtasks of a single large task in parallel.
All processors have access to all memory locations and they are called
shared memory multiprocessor systems.
The high performance of these systems comes with much increased
complexity and cost.
1.7.2 Advantage of Multiprocessor System
If failure occurs, it is cheaper and easier to find and replace the malfunctioning
processor.
If fault occurs in one processor, the others processor can take the responsibility
of performing the task of failure processor.
1.28 Computer Architecture
1.8 INSTRUCTIONS
An instruction is a piece of a program that performs an operation issued by
the computer processor.
Every instruction is defined by the instruction set of the processor.
Example
Arithmetic instructions Add, Subtract, Multiply and Divide
Logic instructions And (Conjunction) , Or (Disjunction), Not (negation)
Control flow instructions Goto, if ... goto, call, and return
Data handling and memory instructions Read, Write, Copy, Set, Load,
Store
Format
Mode Field specifies the way the operand or effective address is determined.
LOAD R1,A
LOAD R1, A
LOAD R2, B
ADD R1, B or
ADD R1, R2
STORE C, R1
STORE C, R1
Advantage
o Makes code generation easy.
Disadvantage
o All operands must be named leading to longer instructions.
3 - Operand instruction
These instructions contain three address fields.
They are also called as three address instructions or general
purpose register instruction.
Register address field may be a processor register or a memory
operand.
Syntax
Operation Source1_Location, Source2_location,
Destination_Location
Example: To perform C = A + B, the code is
R - Format
o Opcode = 0
o Three register operands: rs, rt, and rd
rs and rt - sources
rd - destination
o shamt field - used only for shifts
o funct field - The ALU function (add, sub, and, or, and slt) and
is decoded by the ALU control design
Overview And Instruction 1.33
000 AND
001 OR
010 Add
110 Subtract
I - Format
J – Format
1.34 Computer Architecture
o Opcode = 2
o The destination address is computed as
Target address = PC [31-28] (offset address << 2)
An instruction that directs the computer to another part of the program based on the
results of a comparison is called conditional branching.
The instruction checks if the two register values are equal. If so, it branches to
the specified offset.
Syntax
Operation source1, source2, offset
Example
BEQ R1, R2, OFFSET // Equivalent to
if (R1==R2) goto L1;
a=b+c;
L1: a=b-c;
[Link] BNE Instruction
The instruction performs branching if the two registers values are not equal.
Syntax
Operation source1, source2, offset
Example
BNE R1, R2, OFFSET // Equivalent to
if (R1 != R2) goto L1;
a=b+c;
L1: a=b-c;
1.10.2 Unconditional Branch
An instruction that directs the computer to another part of the program without any
test/condition operation is called unconditional branching.
1.38 Computer Architecture
[Link] J Instruction
:
1.40 Computer Architecture
Example
The address of the operand is the sum of the immediate and the value in a register
(rs). 16-bit immediate is a two’s complement number
Examples:
Overview And Instruction 1.41
1.42 Computer Architecture
For relative addressing, the implicitly referenced register is the program counter (PC).
PC-relative addressing is used for conditional branches. The address is the sum of
the program counter and a constant in the [Link]
Direct Addressing: the address is “the immediate”. 32-bit address cannot be embedded in a 32-
bit instruction.
Pseudodirect addressing: 26 bits of the address is embedded as the immediate, and is used as
the instruction offset within the current 256MB (64MWord) region defined by the MS 4 bits of
the PC.
Example: j Label