Module 3
Syllabus
Computer abstractions and technology - Introduction,
Computer architecture -8 Design features, Application
program - layers of abstraction, Five key components of a
computer, Technologies for building processors and
memory, Performance, Instruction set principles –
Introduction, Classifying instruction set architectures,
Memory addressing, Encoding an instruction set.
Computer Architecture
• Architecture describes what the computer
does
• Computer Architecture helps us to understand
the functionalities of a system.
• A programmer can view architecture in terms
of instructions, addressing modes and registers
• Computer Architecture deals with high-level
design issues.
Computer Organization
• It refers to the operational units and their
interconnections that realize the architectural
specifications.
• E.g. Interfaces, Memory Used,…
• An organization is done on the basis of architecture.
• Computer Organization deals with low-level design
issues.
• Organization involves Physical Components (Circuit
design, Adders, Signals, Peripherals)
Computer-Definition
• It is a fast electronic calculating machine that
– accepts digitized input information
– process it according to a list of internally stored
information and
– produces the resulting output information
Types of Computers
• Desktop
• Servers
• Supercomputers
• Embedded Computers
DESKTOP COMPUTERs
• It has
– Processing & Storage units(e.g. Hard disks, CD‐ROMs),
– visual display &audio output units,
– Input units ( keyboard, mouse, etc)
• It can be easily located on a home or office desk
• It is designed for use by an individual
• Used in homes, schools, business offices,…
Servers
• Contain big database storage units.
• Handles large volumes of data requests
• A computer used for running larger programs for
multiple users
• Requests and responses are transported via Internet
• They are widely accessible to all.
Supercomputers
• A class of computers with high performance and cost; they are
configured as servers and cost around millions to hundreds of
millions of dollars
• At the present it consist of hundreds to thousands of processors
and many terabytes of memory and petabytes of storage
• Helps in high end scientific and engineering calculations
• Used for aircraft design and testing, military application, weather
forecasting, etc.
Embedded Computers
• A computer inside another device used for running one
predetermined application or collection of softwares.
• Embedded computers include the microprocessors
found in your car, the computers in a television set, cell
phones and the networks of processors that control a
modern airplane or cargo ship
• They are designed to run one application or one set of
related applications that are normally integrated with
the hardware and delivered as a single system
Functional Units
Arithmetic
Input and
logic
Memory
Output Control
I/O Processor
Figure 1.1. Basic functional units of a computer.
Information Handled by a Computer
• Instructions/machine instructions
Govern the transfer of information within a computer as well as
between the computer and its I/O devices
Specify the arithmetic and logic operations to be performed
• Data
Numbers and encoded characters used as operands by the
instructions
Used to represent digital information
• Encoded in binary code 0 and 1
Input Unit
• Computer accepts coded information through
input units,which reads the data
• Different input devices are
– Keyboard
– Mouse
– Joysticks
– Trackballs
– Microphones (Audio input)
Memory Unit
It Store programs and data
• Two classes of storage
Primary storage
Fast
Programs must be stored in memory while they are
being executed
Large number of semiconductor storage cells
Processed in words
Address
RAM and memory access time
Secondary storage – larger and cheaper
Memory
• Main memory Also called Primary memory.
– Memory used to hold programs while they are
running; typically consists of DRAM in today’s Computers.
• Secondary memory
– Nonvolatile memory used to store programs and
data between runs;
– Typically consists of flash memory in PMDs and
magnetic disks in servers.
Secondary Memory
• magnetic disk Also called hard disk.
– A form of nonvolatile secondary memory composed
of rotating platters coated with a magnetic recording
material.
– Access times are about 5 to 20 milliseconds
• flash memory
– A nonvolatile semiconductor memory.
– It is cheaper and slower than DRAM but more
expensive per bit and faster than magnetic disks.
– Access times are about 5 to 50 microseconds
Memory Hierarchy
Arithmetic and Logic Unit (ALU)
• Most computer operations are executed in ALU of the
processor.
• Load the operands into memory – bring them to the
processor – perform operation in ALU – store the result back
to memory or retain in the processor.
• In Processor, operands are stored in Registers, each registers
can store one word of data
• Fast control of ALU
Control Unit
• All computer operations are controlled by the control
unit.
• The timing signals that govern the I/O transfers are also
generated by the control unit.
• Control unit is usually distributed throughout the
machine instead of standing alone.
• A large set of control lines carries the signals used for
timing and synchronization of events
Output Unit
• It sends processed results to the outside world
• Different output devices are
– Printers
– Monitors
Operations of a computer
Accept information in the form of programs and data through
an input unit and store it in the memory
Fetch the information stored in the memory, under program
control, into an ALU, where the information is processed
Output the processed information through an output unit
Control all activities inside the machine through a control unit
Organization of Computer -5 basic Elements
1. Input
2. Output
3. Memory
4. Datapath
5. Control
• Datapath and Control are
sometimes combined and
called the Processor
• The datapath performs the arithmetic operation
• Control tells the datapath,memory, and I/O devices what to do according to the
instruction of the program
Layers of Abstraction
• In computing,an abstraction layer or abstraction level is a way of hiding the
working details of a subsystem
• The hardware in a computer can only execute extremely simple low-level
instructions
• The hardware and software of the computer can be arranged as
hierarchical layers,with applications being the outermost ring and a variety
of systems soft wares sitting between the hardware and applications soft
ware.
Systems software
• System software is software designed to provide a platform for other
software.
• It provide services that are commonly useful,
including operating systems, compilers, loaders, and assemblers.
• Operating system- Supervising program that manages the resources of a
computer for the benefit of the programs that run on that computer
■ Handling basic input and output operations
■ Allocating storage and memory
■ Providing for protected sharing of the computer among multiple applications
• Examples of operating systems in use today are Linux, MacOS, and Windows.
System Softwares
• Compiler -A program that translates high-level language
statements into assembly language Statements
• Assembler -A program that translates a symbolic version of
instructions into the binary version.
• Loader – Loader is the program for loading program into
memory for execution
System software & Application Software
• System software is general purpose software which is used to
operate computer hardware. It provides platform to run
application softwares.
• Application software is specific purpose software which is used
by user for performing specific task.
System Software Application Software
1 It is used for operating computer It is used by user to perform a specific task
hardware
2 It is usually installed when OS is It is installed according to user’s
installed requirements
3 User does not interact with system User interacts with application softwares
software.It works in the background
4 It can run independently, It provides It can’t run independently.They can’t run
platform for running application without the presence of system softwares
softwares
5 Some examples of system softwares Some examples are word processor,
are compiler,debugger,assembler,OS spreadsheets,media player etc.
etc
From a High-Level Language to the
Language of Hardware
Eight Great Ideas in Computer
Architecture
• Design for Moore’s Law
• Use Abstraction to Simplify Design
• Make the Common Case Fast
• Performance via Parallelism
• Performance via Pipelining
• Performance via Prediction
• Hierarchy of Memories
• Dependability via Redundancy
8 Great Ideas in Computer
Architecture
1. Moores Law
• Gordon Moore (one of the founders of Intel ) observed that
the number of transistors on a computer chip was doubling
about every 18–24 months.
• The speed and capability of computers can be expected to
double every two years, as a result of increases in the number
of transistors a microchip can contain.
8 Great Ideas
2. Use Abstraction to Simplify Design
• major productivity technique for hardware and software is to
use abstractions to represent the design at different levels of
representation;
• lower-level details are hidden to offer a simpler model at
higher levels.
3. Make the common case fast
Making the common case fast will tend to enhance performance better
than optimizing the rare case.
Ironically, the common case is often simpler than the rare case and hence
is often easier to enhance
For example, when adding two numbers in the processor, we can expect
overflow to be a rare circumstance and can therefore improve performance by
optimizing the more common case of no overflow. This emphasis may slow
down the case when overflow occurs, but if that is rare then overall
performance will be improved by optimizing for the normal case.
8 Great Ideas
4.Performance via Parallelism
• Computer architects have offered designs that get more
performance by performing operations in parallel i.e A
form of computation in which many calculations are
carried out simultaneously
– To improve Parallelism at system level, multiple
processors or multiple disks can be used
– Set-associative caches use multiple banks of memory
that are typically searched in parallel to find a desired
item.
– Modern ALUs (arithmetic-logical units) use carry-
lookahead, which uses parallelism to speed the process
of computing sums
8 Great Ideas
5.Performance via Pipelining: The basic idea of
pipelining is to overlap instruction execution
to reduce the total time to complete an
instruction.A set of data Processing elements
connected in series,so that the output of one
element is The input of the next one.
6.Performance via Prediction
It can be faster on average to guess and start
Working rather than wait. until you know for
sure,assuming that the mechanism to
recover from a misprediction is not too
expensive and your prediction is relatively
accurate.
7.Hierarchy of Memories:
• Programmers want memory to be fast,large,and cheap
• As memory speed often shapes performance and the
cost of memory to day is Often the majority of
computer cost.
• Architects have found that they can Address these
conflicting demands with a hierarchy of memories,
• with the fastest,smallest,and most expensive memory
per bit at the top of the hierarchy And the
slowest,largest,and cheapest per bit at the bottom.
8.Dependability via Redundancy:
Computers not only need to be fast;they need to Be
dependable.
Since any physical device can fail,we make systems
dependable By including redundant components that can
take over when a failure occurs And to help detect failures.
Technologies for Building Processors
and Memory
Transistor :It is simply an on/off switch controlled by
electricity.
The integrated circuit (IC) : It combined dozens to hundreds of
transistors into a single chip.
VLSI: A device containing hundreds of thousands to millions of
transistors.
Performance
Measure of Performance
• Response time/Execution Time—the time between the start
and completion of a task
• Throughput /Bandwidth : It is the number of tasks completed
per unit time.
To maximize performance, we want to minimize response time
or execution time for some task.
Performance
Thus, we can relate performance and execution time for a
computerX
Relative Performance
• If computer A runs a program in 10 seconds and
computer B runs the same program in 15 seconds,
how much faster is A than B?
Measuring Performance
• Time is the measure of computer performance:
• The computer that performs the same amount of work in the least time is the
fastest.
• Program execution time is measured in seconds per program.
• It is the total time to complete a task -including disk accesses, memory
accesses, input/output (I/O)activities, operating system overhead—everything.
• CPU time:-It is the time the CPU spends computing for a task and does not
include time spent waiting for I/O or running other programs
• We will use the term system performance to refer to elapsed time on an
unloaded system and CPU performance to refer to user CPU time.
• CPU time can be further divided into
– user CPU time :the CPU time spent in the program itself
– system CPU time: It is the CPU time spent in the operating system performing tasks on
behalf of the program
Clock Cycle
• All computers are constructed using a clock that determines
when events take place in the hardware.
• These discrete time intervals are called clock cycles (or ticks,
clock ticks, clock periods, clocks, cycles).
• Clock period :Time for a complete clock cycle (e.g., 250
picoseconds, or 250 ps)
• Clock rate: It is the inverse of the clock period (e.g., 4
gigahertz, or 4 GHz)
Relative Performance
• Computer C’s performance is 4 times as fast as the
performance of computer B, which runs a given application in
28 seconds. How long will computer C take to run that
application?
• If a particular desktop runs a program in 60 seconds and a
laptop runs the same program in 75 seconds, how much
faster is the desktop than the laptop?
CPU Execution time
Hardware designer can improve performance by reducing the
number of clock cycles required for a program or the length of
the clock cycle
Improving Performance
Improving Performance
Improving Performance
Instruction Performance
• CPU clock cycles =Instructions for a program * Average clock cycles per
instruction
• Suppose we have two implementations of the same instruction set
architecture. Computer A has a clock cycle time of 250ps and a CPI of 2.0
for some program,and computer B has a clock cycle time of 500ps and a
CPI of 1.2 for the same program. Which computer is faster for this
program and by how much?
Instruction Performance
CPU Performance Equation
Comparing Performance
Comparing Performance
Performance
Instruction Set Architecture(ISA)
• The portion of the computer visible to the
programmer or compiler writer
Classifying ISA
• The type of internal storage in a processor is the
most basic differentiation of ISA Classification
• The 3 most common types of ISAs are:
• Stack - The operands are implicitly on top of the
stack.
• Accumulator - One operand is implicitly the
accumulator.
• General Purpose Register (GPR) - All operands are
explicitly mentioned, they are either registers or
memory locations.
GPR Architecture
• There are really two classes of register
computers.
• One class can access memory as part of any
instruction, called register-memory
architecture,
• Other can access memory only with load and
store instructions, called load-store
architecture.
ISAs
Operand locations for four instruction set architecture classes. The arrows indicate whether the operand is an input or the result of
the arithmetic-logical unit (ALU) operation, or both an input and result. Lighter shades indicate inputs, and the dark shade indicates
the result. In (a), a Top Of Stack register (TOS) points to the top input operand, which is combined with the operand below. The first
operand is removed from the stack, the result takes the place of the second operand, and TOS is updated to point to the result. All
operands are implicit. In (b), the Accumulator is both an implicit input operand and a result. In (c), one input operand is a register, one
is in memory, and the result goes to a register. All operands are registers in (d) and, like the stack architecture, can be transferred to
memory only via separate instructions: push or pop for (a) and load or store for (d).
ISAs
GPR Architecture
• The first concerns whether an ALU instruction has two or three
operands.
– In the three-operand format, the instruction contains one
result operand and two source operands. ADD R1, R2,R3
– In the two-operand format, one of the operands is both a source and a result
for the operation. ADD R1, R2
• The second distinction among GPR architectures concerns how many
of the operands may be memory addresses in ALU instructions.
• The number of memory operands supported by a typical ALU
instruction may vary from none to three
– ADD C, A, B
– ADD R1, A,
– ADD C, R2, B
Connection Between the Processor and the
Memory
Memory
MAR MDR
Control
PC R0
R1
Processor
IR
ALU
Rn - 1
n general purpose
registers
Figure 1.2. Connections between the processor and the memory.
Memory Addressing
n bits
• Memory consists of first word
second word
many millions of
storage cells, each of
which can store 1 bit. •
•
• Data is usually •
accessed in n-bit i th word
groups. n is called
word length.
•
•
•
last word
Figure 2.5. Memory words.
Memory Location, Addresses, and
Operation
• 32-bit word length example
32 bits
b 31 b 30 b1 b0
•
•
•
Sign bit: b 31= 0 for positive numbers
b 31= 1 for negative numbers
(a) A signed integer
8 bits 8 bits 8 bits 8 bits
ASCII ASCII ASCII ASCII
character character character character
(b) Four characters
Memory Addressing
• To retrieve information from memory, either for one word
or one byte (8-bit), addresses for each location are
needed.
• A k-bit address memory has 2k memory locations, namely
0 – 2k-1, called memory space.
• 24-bit memory: 224 = 16,777,216 = 16M (1M=220)
• 32-bit memory: 232 = 4G (1G=230)
Memory Location, Addresses, and
Operation
• It is impractical to assign distinct addresses to individual bit
locations in the memory.
• The most practical assignment is to have successive addresses
refer to successive byte locations in the memory –
Byte-addressable memory.
• Byte locations have addresses 0, 1, 2, … If word length is 32
bits, the successive words are located at addresses 0, 4, 8,…
• Most of the instruction sets are byte addressed and provide
access for bytes (8 bits), half words (16 bits), and words (32
bits). Most of the computers also provide access for double
words (64 bits).
Big-Endian and Little-Endian Assignments
Big-Endian: lower byte addresses are used for the most significant bytes of
the word.
Little-Endian: opposite ordering. lower byte addresses are used for the less
significant bytes of the word
Word
address Byte address Byte address
0 0 1 2 3 0 3 2 1 0
4 4 5 6 7 4 7 6 5 4
• •
• •
• •
k k k k k k k k k k
2 -4 2 -4 2 -3 2- 2 2 - 1 2 - 4 2- 1 2 - 2 2 -3 2 -4
(a) Big-endian assignment (b) Little-endian assignment
Figure 2.7. Byte and word addressing.
Big-Endian and Little-Endian Assignments
• Little Endian byte order puts the byte whose address is
“x...x000” at the least-significant position in the double word
(the little end). The bytes are numbered:
• 7 6 5 4 3 2 1 0
• Big Endian byte order puts the byte whose address is “x...x000”
at the most-significant position in the double word (the big
end). The bytes are numbered:
• 0 1 2 3 4 5 6 7
Memory Location, Addresses, and
Operation
• Word alignment
– Words are said to be aligned in memory if they begin
at a byte address that is a multiple of the num of
bytes in a word.
• 16-bit word: word addresses: 0, 2, 4,….
• 32-bit word: word addresses: 0, 4, 8,….
• 64-bit word: word addresses: 0, 8,16,….
• An access to an object of size s bytes at byte
address A is aligned if A mod s =0
• Misalignment causes hardware complications, it
take multiple aligned memory references
Aligned & Misaligned memory access
Addressing Modes
• The different ways in which the location of an
operand is specified in an instruction are
referred to as addressing modes.
Addressing Modes
Instruction Encoding
• It means how the instructions are encoded into a binary
representation for execution by the processor.
• The address specifier tells what addressing mode is used to
access the operand.
• When encoding the instructions, the number of registers
and the number of addressing modes both have a significant
impact on the size of instructions
• Three types of Instruction Encodings
• Fixed Length Encoding
• Variable Length Encoding
• Hybrid Encoding
Instruction Encoding
Instruction Encoding
• Variable length Encoding
• The variable format can support any number of operands, with each
address specifier determining the addressing mode and the length of
the specifier for that operand.
• It generally enables the smallest code representation, since unused
fields need not be included.
• Uses different numbers of bits to encode the instructions in the
instruction set architecture, depending on the number of inputs to the
instruction, the addressing modes used, and other factors
• Program length in memory is less when a limited number of operands
are used in most instructions
• Each instruction takes only as much space in memory as it requires
Instruction Encoding
Fixed length Encoding
• The fixed format always has the same number of operands, with the
addressing modes (if options exist) specified as part of the opcode
• It generally results in the largest code size.
• Uses the same number of bits to encode each instruction in the
instruction set architectures
• Simple to decode
• Reducing the amount of decode logic
• Easily predict the location of the next instruction to be executed
• This makes it easier for the processor to use pipelining
Hybrid Encoding
• The hybrid approach has multiple formats specified by the opcode
• Adding one or two fields to specify the addressing mode and one or
two fields to specify the operand address