UNIT-1 PART-1Basic Structure and Machine Ins
UNIT-1 PART-1Basic Structure and Machine Ins
UNIT-1 PART-1Basic Structure and Machine Ins
AND
ARCHITECTURE
E. Ilavarasan
What is a computer?
• A computer is a sophisticated electronic calculating machine
that:
– Accepts input information,
– Processes the information according to a list of internally
stored instructions (program) and
– Produces the resulting output information.
2
Block Diagram of Computer with Functional Units
COMPUTER COMPUTER
S.NO ARCHITECTURE ORGANIZATION
14
Memory unit (contd..)
• Random Access Memory (RAM) provides fixed access time
independent of the location of the word.
– Access time is known as “Memory Access Time”.
• Memory and processor have to “communicate” with each
other in order to read/write information.
– To reduce “communication time”, a small amount of RAM
(known as Cache) is tightly coupled with the processor.
• Modern computers have three to four levels of RAM units
with different speeds and sizes:
– Fastest, smallest known as Cache
– Slowest, largest known as Main memory.
15
Memory unit (contd..)
• Primary storage is insufficient to store large amounts of data
and programs. We can increase capacity, but it is expensive.
• To retain data/information permanently, secondary storage
devices are required
• We Store large amounts of data on secondary storage devices:
– Magnetic disks and tapes,
– Optical disks (CD-ROMs).
– Access to the data stored in secondary storage in slower,
compared to the primary memory
• Cost of a memory unit depends on its access time, lesser
access time implies higher cost.
16
Input unit
Binary information must be presented to a computer in a specific
format. This task is performed by the input unit:
- Interfaces with input devices.
- Accepts binary information from the input devices.
- Presents this binary information in a format expected by the
computer.
- Transfers this information to the memory or processor.
Processor
17
Output unit
- Interface with output devices.
- Accept processed results provided by the computer in specific
binary form.
- Convert the information in binary form to a form understood by
an output device.
Computer
Memory
Real world
Output Unit
Printer
Graphics display
Processor Speakers
……
18
How are the functional units connected?
•For a computer to achieve its operation, the functional units need
to communicate with each other.
•In order to communicate, they need to be connected.
26
Data
• Data are the “operands” upon which instructions operate.
• Data could be:
– Numbers,
– Encoded characters.
• Data, in a broad sense means any digital information.
• Computers use data that is encoded as a string of binary digits
called bits.
27
Basic Operational Concepts: Instruction Execution
Assembly Program
Add R0, R1
Move #10, R0
Main Memory
Address Content
1000 Add / Op-code
1001 Move / Op-code
1002 10 / Data
1003 -
Execution of typical Instruction
• (PC) (MAR)
- The contents of PC transferred to MAR
• (MAR) (Address bus)
- Select a particular memory location
• CU issues RD control signal
• Reads instruction present in memory and loaded into MDR
• MDR content will be placed in IR ( MDR IR )
• Instruction code in IR is decoded by CPU to understand the
type of operation it has to perform
• Increments the contents of PC by 1 (to point next instruction)
• Perform the operation, if data is available in register (CPU)
Execution of typical Instruction contd..
• If data is present in memory following sequence is performed
• Address of the data in PC MAR
• MAR Address bus
• Select memory location based on MAR and generated RD signal
• Reads data via data bus MDR
• From MDR data can be directly routed to ALU or it can be
placed in register and then operation can be performed
• Results of the operation can be directed towards output device,
memory or register
• One or more steps are performed in one clock pulse
Example : Add R1, R2
T1 Enable R1
T2 Enable R2
T4
•Control unit works with a reference
signal called processor clock
T1
•Processor divides the operations
T2 into basic steps
R1 R2
R2
Evolution of Computers
FIRST GENERATION (1945 – 1955)
• Program and data reside in the same memory (stored program
concepts – John von Neumann)
• First generation computers relied on ‘machine language’ which
is the most fundamental programming language that can be
understood by computers
• Vacuum tubes were used to implement (ALU & CU design)
• Magnetic core and magnetic tape storage devices are used
• Using electronic vacuum tubes, as the switching components
• The two eminent machines of this era were the UNIVAC
(Universal Automatic Computer) and ENIAC (Electronic
Numerical Integrator and Computer) machines
SECOND GENERATION (1955 – 1965)
• Transistor were used to design ALU & CU
• Computers moved from machine language to symbolic, or
assembly languages, which allowed programmers to specify
instructions in words. (ADD, SUB, INR.. etc)
• Symbolic (‘assembly’) languages were used to write programs
• High-level Programming languages (early versions of COBOL
and FORTRAN) were being developed
• To convert HLL to ML compiler were used
• Separate I/O processor were developed to operate in parallel
with CPU, thus improving the performance
• Invention of the transistor which was faster, smaller and
required considerably less power to operate
• Consume less electricity and generate less heat
THIRD GENERATION (1965-1975)
• IC technology improved
• Improved IC technology helped in designing low cost, high
speed processor and memory modules
• First computers where users interacted utilizing keyboards and
monitors with the help of operating systems (OS)
• OS- system program controls the resources of computers
• Multiprogramming, pipelining concepts were incorporated
• Cache and virtual memory concepts were developed
• More than one circuit on a single silicon chip became available
FOURTH GENERATION (1975-1985)
• The microprocessor brought the fourth generation of
computers, as thousands of integrated circuits were built onto a
single silicon chip using VLSI technology
• INTEL, MOTOROLA, TEXAS,NATIONAL semiconductors
started developing microprocessor (CPU /Processor)
• Workstations, microprocessor (PC) & Notebook computers
were developed
• Different computers are interconnected for better
communication by LAN, MAN,WAN
• Fourth generation computers also saw the development
of GUIs, the mouse and handheld devices.
• Processors like Digital Signal Processor were also developed
BEYOND THE FOURTH GENERATION
(1985 – TILL DATE)
• Fifth generation computing devices, based on artificial
intelligence, are still in development, though there are some
applications, such as voice recognition, that are being used
today
• The goal of fifth-generation computing is to develop devices
that respond to natural language input and are capable of
learning and self-organization
• E-Commerce, E- banking, home office
• ARM, AMD, INTEL, MOTOROLA
• High speed processor - GHz speed
COMPUTER TYPES
NOTEBOOK COMPUTER
• Compact form of personal computer (laptop)
• Advantage is portability
WORK STATIONS
• More computational power than PC
• Costlier
• Used to solve complex problems which arises in
engineering application (graphics, CAD/CAM etc)
SUPER COMPUTERS
• Faster than mainframes
• Helps in calculating large scale numerical and algorithm
calculation in short span of time
• Used for aircraft design and testing, military application
and weather forecasting
HANDHELD
• Also called a PDA (Personal
Digital Assistant).
• A computer that fits into a
pocket, runs on batteries,
and is used while holding
the unit in your hand.
• Typically used as an
appointment book, address
book, calculator, and
notepad.
• Can be synchronized with a
personal microcomputer as
a backup.
Basic Terminology
• Computer • Software
– A device that accepts input, – A computer program that
processes data, stores tells the computer how to
data, and produces output, perform particular tasks.
all according to a series of
stored instructions.
• Network
– Two or more computers
• Hardware
and other devices that are
– Includes the electronic and connected, for the purpose
mechanical devices that of sharing data and
process the data; refers to programs.
the computer as well as
peripheral devices.
• Peripheral devices
– Used to expand the
computer’s input, output
and storage capabilities.
Basic Terminology
Interpreter
Converts HLL to MLL, does this job statement by
statement
System software
Program routines which aid the user in the
execution of programs eg: Assemblers,
Compilers
Operating system
Collection of routines responsible for controlling
and coordinating all the activities in a computer
system
Clock
• Synchronizes Processor and Bus operations
• Clock cycle = Clock period = 1 / Clock rate
Solution
N =1000
25% of N = 250 instructions require 4 clock cycles
40% of N = 400 instructions require 5 clock cycles
35% of N = 350 instructions require 3 clock cycles
T = (N x S) R
= (250*4+400*5+350*3) / 1x109
= (1000+2000+1050) / 1x109
= 4.05 μs
Performance Measurement
• Computer designer use performance estimates to evaluate the
effectiveness of new features
– Practice is to use benchmarks available to all manufacturers
e.g. SPEC benchmark (www.spec.org)
– SPEC rating of 2 means that the computer under test is
2 times faster than the reference computer.
– The test is repeated for various programs in the SPEC suite.
The overall rating for the computer is given by
Running time on the reference computer
SPEC rating
Running time on the computer under test
n 1
SPEC rating ( SPEC i ) n
i 1
where n is the number of programs
50
Instruction Execution Cycle
• Fetch PC program
• Decode
I-1 I-2 I-3 I-4
• Fetch operands
• Execute memory fetch
• Store output op1
read
op2
registers registers
instruction
I-1 register
decode
write
write
flags ALU
execute
(output)
51
Instruction pipelining
• Instruction pipelining is a technique that implements a
form of parallelism called instruction-level
parallelism within a single processor.
• It therefore allows faster CPU throughput (the number of
instructions that can be executed in a unit of time
• The basic instruction cycle is broken up into a series
called a pipeline. Rather than processing each instruction
sequentially,each instruction is split up into a sequence of
dependent steps so different steps can be executed
in parallel and instructions can be processed
concurrently (starting one instruction before finishing the
previous one).
A non-pipelined processor. Many wasted cycles.
Stages
S1 S2 S3 S4 S5 S6
1 I-1
2 I-1
3 I-1
4 I-1
5 I-1
Cycles
6 I-1
7 I-2
8 I-2
9 I-2
10 I-2
11 I-2
12 I-2
53
Pipelined Execution
• More efficient use of cycles, greater throughput of instructions:
S ta g e s
S1 S2 S3 S4 S5 S6
1 I-1
2 I-2 I-1
Cycles
3 I-2 I-1
4 I-2 I-1
5 I-2 I-1
6 I-2 I-1
7 I-2
Distributed Systems 60
Architecture of Distributed Systems
Distributed Systems 61
Distributed Operating System
Distributed Systems 63
MEMORY LOCATIONS AND ADDRESSES
m bits n bits
65
10-address lines, 16-data lines
Address space
• The total number of uniquely identifiable locations in
memory is called the address space.
Example 2
A computer has 128 MB of memory.
memory. Each word in this computer
is eight bytes.
bytes. How many bits are needed to address any single
word in memory?
Solution
The memory address space is 128 MB, which means 227.
However, each word is eight (23) bytes, which means that we
have 224 words
words.. This means that we need log2 224, or 24 bits
bits,, to
address each word
word..
Memory: Contents of a Word (I)
Here is an example of a 32-bit word.
b31 b30 b1 b0
• 8000 54
• 8001 96
• 8002 78
• 8003
46
• 8004
|
Big Endian
• Big Endian (e.g., in IBM, Motorolla, Sun, HP)
» high order byte stored at lowest address
» byte 3 byte 2 byte 1 byte 0
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
• R2 [LOCN]
• R4 [R3] +[R2]
ASSEMBLY LANGUAGE NOTATION (ALN)
• RTN is easy to understand and but cannot be
used to represent machine instructions
• Mnemonics can be converted to machine
language, which processor understands using
assembler
Eg:
1. MOVE LOCN, R2
2. ADD R3, R2, R4
3. ADD B A= A + B
4. MOV A, B A=B
A Typical Instruction
• Add LOCA, R0
• Add the operand at memory location LOCA to the
operand in a register R0 in the processor.
• Place the sum into register R0.
• The original contents of LOCA are preserved.
• The original contents of R0 is overwritten.
• Instruction is fetched from the memory into the processor
– the operand at LOCA is fetched and added to the
contents of R0 – the resulting sum is stored in register R0.
TYPE OF INSTRUCTION
Three address instruction
• Syntax: Operation source 1, source 2, destination
• Eg: ADD D, E, F where D,E,F are memory location
• Advantage: Single instruction can perform the complete
operation
• Disadvantage : Instruction code will be too large to fit in
one word location in memory
TWO ADDRESS INSTRUCTION
•Syntax : Operation source, destination
ADD D, F F = F+D
ADD A, B B = A+ B
A
.
.
.
C
• PC – Program counter: hold the address of the
next instruction to be executed
• Straight line sequencing: If fetching and
executing of instructions is carried out one by
one from successive addresses of memory, it is
called straight line sequencing.
• Major two phase of instruction execution
• Instruction fetch phase: Instruction is fetched
form memory and is placed in instruction register
IR
• Instruction execute phase: Contents of IR is
decoded and processor carries out the
operation either by reading data from memory or
registers.
BRANCHING
• Immediate Addressing
• Direct Addressing
• Indirect Addressing
• Register Addressing
• Register Indirect Addressing
• Relative Addressing
• Indexed Addressing
• Auto Increment Mode
• Auto Decrement Mode
Implementation of Variables and Constants
• In assembly language, a variable is represented by allocating a
register or a memory location to hold its value.
• We access an operand by specifying the name of the register or
the address of the memory location
Instruction
Opcode Address LOC
Memory
Operand / 200
Pointer to operand
Operand
Indirect Addressing
• Add (R1), R0 Add (A), R0
Main Memory Main Memory
Add (R1), R2 Add (A), R2
- -
- -
B Operand /20 A B (Memory Address)
B Operand /20
Registers Registers
R1 B (Memory Address) R1
R2 10 R2 10
R2 30 R2 30
Through a general purpose register Through a memory location
Register Addressing
• The instruction which uses processor registers to represent
operands is the instruction in register addressing mode.
• The effective address is a register where the value of the
operand is present. i.e. EA=R
• Advantage: In the register addressing mode there are no
memory references as the value to be operated is present in the
register.
• Very fast execution
• Disadvantage: Registers have limited address space. So, it has
a limit on the size of value that can be stored.
Register Addressing
• ADD R4, R3 R3 = R4+R3
Instruction
Indexed Addressing
• The effective address of the operand is generated by
adding a constant value to the contents of a index
register / GP register
• EA = X + [R]
• Address field hold two values
– X = constant value (offset) / displacement
– R = register that holds address of memory locations
– or vice versa
(Offset given as constant or in the index register)
Add 20(R1),R2 or Add 1000(R1),R2
Indexed Addressing Diagram
Instruction
Opcode Register R Constant Value
Memory
Registers