SlideShare a Scribd company logo
1 of 143
Download to read offline
EC8552 COMPUTER ARCHITECTURE
AND ORGANISATION
Definition of Computer
• Computer is a programmable machine.
• Computer is a machine that manipulates data
according to a list of instructions.
• Computer is any device which aids humans in
performing various kinds of computations or
calculations
Earliest Computer
• Originally calculations were computed by humans
• Human computers were typically engaged in the
calculation of a mathematical expression
• The calculations of this period were specialized
and expensive, requiring years of training in
mathematics
• The first use of the word "computer" was
recorded in 1613, referring to a person who
carried out calculations, or computations, and the
word continued to be used in that sense until the
middle of the 20th century.
Generation of Computers
Computer Components
APPLICATION OF COMPUTERS
BLOCK DIAGRAM OF C0MPUTER
Ideas
• The eight ideas that the computer architects have
been invented for computer design are as follows:
1. Design for Moore’s law:
Moore’s law states that integrated circuit
resources double every year 18-24 months. As
computer designers may take years, the resources
available per chip can easily double or quadruple
between the start and the completion of the
design. For this reason, the computer architects
must anticipate where the technology will be at
the completion of design rather than at the start
of design.
2. Use abstraction to simplify design:
Computer architects must use abstractions to
represent the design at different levels to
representation instead of lower –levels details.
This reduces the design time considerably.
3. Make the common case fast:
In making a design a trade-off , it is better to
favor the frequent case over the infrequent case.
It makes design simple and can be done faster.
4. Performance via Parallelism:
It is known that we get more throughput by
performing operations in parallel
5. Performance via Pipelining:
A pipeline is a set of data processing elements
connected in series, where the output of one
element is the input of the next one. The
elements of pipeline are often executed in
parallel to improve performance.
6. Performance via Prediction:
In some cases it is better to predict and start
working rather than wait until we know for
sure assuming that the mechanisms to recover
from a mis-prediction is not too expensive and
our prediction is relatively accurate.
7. Hierarchy of memory:
Ideally, computer memory should be fast, large
and inexpensive. Unfortunately, it is
impossible to meet all the three of these
requirements using one type of memory
• Increased speed and size are achieved at increased
cost.
• The computer architects have found that they can
address these conflicting demands with a
hierarchy of memory with the fastest, smallest
and most expensive memory at the top of the
hierarchy and the slowest, largest and cheapest at
the bottom
8. Dependability via redundancy:
We know that computer should be fast and it also
should be dependable. In a computer system a
failure of any single component can shut down
the entire system. We can make system
dependable by including redundant components
that can take over the failure occurs.
Performance
• The performance is an important attribute of a
computer. It is an important criteria for
selection of a computer
• There are number of ways by which
performance of a computer can be measured.
Defining Performance
• When we say one computer is faster than another,
we compare their speeds and observes that the
faster computer runs a program in less time than
other computers
• The computer center manager running a large
server system may say a computer is faster when
it completes more jobs in an hour.
• The computer user is always interested in
reducing the time between the start and the
completion of the program or event i.e., reducing
the execution time
Contd..
• The execution time is also referred to as response time.
Reduction in response time increases the throughput ( the
total amount of work done in a given time). The
performance of the computer is directly related to
throughput and hence it is reciprocal of execution time.
• This means that for two components A and B is the
performance of A is greater than the Performance of B,
Contd..
•
EXAMPLE
• If Computer A runs a program in 10seconds
and computer B runs the same program in
25seconds, how much faster is A than B?
EXAMPLE
• If Computer A runs a program in 10seconds and
computer B runs the same program in 25seconds,
how much faster is A than B?
Measuring Performance
• One of the important measure of a computer
performance is a time.
• The computer that performs same task in a
least time is the fastest. Program execution
time is measured in seconds per program.
CPU TIME
• CPU time is the time the CPU spends
computing for particular task and does not
include time spend waiting for I/O or other
programs
• CPU time can be divided into the CPU time
spend in the program called user CPU time.
• CPU time spent in the operating system
performing tasks on behalf of the program
called system CPU time
• Differentiating between system and user CPU time is difficult to do
accurately
• Because it is often hard to assign responsibility for operating system
activities to one user program rather than other and because of the
functionality differences among operating systems.
• So performance is measured by CPU execution time
• CPU execution Time = CPU clock cycles for a program x Clock cycle time
or
• CPU execution Time = CPU clock cycles for a program / Clock Rate
Contd…
A simple formula relates the most
basic metrics to CPU time:
Power Wall
• Running a Processor at high clock speeds
allows for better performance.
• Processor runs at a higher speed, it generates
more heat and consumes more power
• Increase in clock rate increases the power
consumption
• Technology used for IC is CMOS. For CMOS the
dynamic power depends on the capacitive
loading of each transistor, voltage applied, and
the frequency that the transistor is switched.
• Power =Capacitive load x voltage^2 x Frequency
switched
• Example:
– If a new processor has 85% if the capacitive load of
old processor, it supply voltage is reduced by 20%
and new processor results in a 25% shrink in
frequency. What is the impact on power
consumption?
– Hence the new processor uses only 40.8% of the
power that the old processors
Power Consumption
• By lowering the power supply voltage it is
possible to reduce power consumption.
However, lowering supply voltage beyond
certain limit make the transistors too leaky
and it will increase power consumption due to
leakage
• By using large cooling device
• Turning off parts of chip that are not used in a
given clock cycle
Uniprocessor to Multiprocessor
• Due to limitation of power consumption there
is a change in the design approach of
microprocessor
• Instead of increasing speed of single
processor, designers came up with multiple
processor per chip.
• The intension was to increase throughput
rather than decrease response time
• Multicore processor support parallelism
concept
• Writing programs to support parallelism is not
a simple task for the following reasons
– It increases difficulty level of programming
– It is necessary to divide the programming task so
that each processor has roughly the same amount
to do at the same time. That is it needs load
balancing
– Need scheduling of sub task
• Needs to maintain coordination between
subtasks
• Needs to synchronize task
Advantages:
• Improves cost/performance ratio of the
system
• Several processors may be combined to fit the
needs of an application while avoiding the
expense of the unneeded capabilities of
centralized system. This system provide room
for expansion
• Tasks are divided among the modules. If
failure occurs, it sis easier and cheaper to find
and replace the malfunctioning processor
than replacing the failing part of complex
processor.
• In a multiprocessor systems, a failure or error
in one part has a limited effect on the rest of
the system. If fault occurs in one processor, a
second processor can take the responsibility
of performing the task of the failure processor.
This improves the reliability of the system at
the cost of some loss in the efficiency.
Addressing Mode
• Different kind of ways the programmer can
refer to data stored in the memory or I/O
devices
Types
• Register addressing mode
• Absolute or direct addressing mode
• Immediate addressing mode
• Indirect addressing mode
• Register indirect addressing mode
• Displacement addressing mode
• Relative addressing mode
• Base register addressing mode
• Index addressing mode
• Auto increment addressing mode
• Auto decrement addressing mode
• Stack addressing mode
Register Addressing mode
• The operand is the contents of processor
register. The name of register is specified in
the instruction
• Example; MOV R2,R1
• This instruction copies the content of register
R2 to R1
Absolute or direct addressing mode
• The address of the location of the operand is
given explicitly as a part of the instruction
• Example:
• MOV A, [2000]
• This instruction copies the content of memory
location 2000 in to register A.
Immediate Addressing mode
• The operand is given explicitly in the
instruction
• Example:
– MOV #20,A
This instruction copies operand 20 in the register A
The sign # in front of the value of an operand is used
to indicate that this value is an immediate
operand
Indirect Addressing Mode
• In this addressing mode, the instruction
contains the address of memory which refers
the address of the operand
• LOAD R1, @100
Register Indirect Addressing mode
• The effective address of the operand is the
contents of a register or the main memory
location whose address is given explicitly in
the instruction
• Example:
– MOV R0, A
Immediate addressing mode
• The addressing mode in which the data
operand is a part of the instruction itself is
known as immediate addressing mode.
• Example
• MOV CX, 4929 H,
• ADD AX, 2387 H,
• MOV AL, FFH
Register addressing mode
• It means that the register is the source of an
operand for an instruction.
• Example
• MOV CX, AX ; copies the contents of the 16-bit
AX register into ; the 16-bit CX register), ADD
BX, AX
Direct addressing mode
• The addressing mode in which the effective
address of the memory location is written
directly in the instruction.
• Example
• MOV AX, [1592H], MOV AL, [0300H]
Register indirect addressing mode
• This addressing mode allows data to be
addressed at any memory location through an
offset address held in any of the following
registers: BP, BX, DI & SI.
• Example
• MOV AX, [BX] ; Suppose the register BX
contains 4895H, then the contents ; 4895H are
moved to AX
Based addressing mode
• In this addressing mode, the offset address of
the operand is given by the sum of contents of
the BX/BP registers and 8-bit/16-bit
displacement.
• Example
• MOV DX, [BX+04], ADD CL, [BX+08]
Indexed addressing mode
• In this addressing mode, the operands offset
address is found by adding the contents of SI
or DI register and 8-bit/16-bit displacements.
• Example
• MOV BX, [SI+16], ADD AL, [DI+16]
A.Azhagu Jaisudhan M.E. (Ph.D)
Based-index addressing mode
• In this addressing mode, the offset address of
the operand is computed by summing the
base register to the contents of an Index
register.
• Example
• ADD CX, [BX+SI], MOV AX, [BX+DI]
Based indexed with displacement
mode
• In this addressing mode, the operands offset is
computed by adding the base register
contents. An Index registers contents and 8 or
16-bit displacement.
• Example
• MOV AX, [BX+DI+08], ADD CX, [BX+SI+16]
Auto Increment Addressing Mode
• The effective address of the operand is the contents
of a register specified in the instruction. After
accessing the operand, the contents of this register
are incremented to address the next location.
• Example: MOV R0,(R2)+
• The above instruction copies the content of register
R0 in to the memory location whose address is
specified by the content of register R2. After copy
operation, the contents of register R2 are
automatically incremented by 1
Auto decrement Addressing Mode
• The content of a register specified in the instruction
are decremented and then they are used as an
effective address to access a memory location.
Example: MOV -R0,(R1)
• This instruction, initially decrements the contents of
register R0 and then the decremented contents of
register R0 are used to address the memory location.
Finally, the contents from the addressed memory
location are copied in to the register R1.
Instructions
• The word of computers language are called
instructions.
• Instruction set of computers both in the form
of written by people and in the form read by
the computer.
• Language of computers would be as diverse as
those of people, but in reality computer
languages are quite similar.
• Many Instruction sets comes from MIPS
Technologies
Three popular instruction sets
• ARMv7 is similar to MIPS. More than 9 billion
chips with ARM processors were
manufactured in 2011, making it the most
popular instruction set in the world.
• The second example is the Intel x86, which
powers both the PC and the cloud of the post
PC era.
• The third example is ARMv8, which extends
the address size of the ARMv7 from32bits to
64bits. This instruction set is closed to MIPS
than ARMv7.
• This similarity of instruction sets occurs because
all computers are constructed from hardware
technologies based on similar underlying
principles.
• Computer designers have a common goal;
• To find a language that makes it easy to build the
hardware and the compiler while maximizing
performance and minimizing cost and energy.
• The simplicity of the equipment is as valuable a
consideration for today's computers as it was for
those of the 1950.
• This topic we discussed about showing both how it
is represented in hardware and the relationship
between high level language
Instruction Types
• According to operation
– Data Processing Instruction
– Data Storage Instruction
– Data movement Instruction
– Control Instruction
• According to number of addresses
– Three address instruction
– Two address instruction
– One address instruction
– Zero address instruction
According to operation
• Processor has a set of instruction that allows
the user to formulate any data processing ask.
• According to operations instruction are
classified
• Data Processing:
– Arithmetic and logic instruction – The arithmetic
instructions provide computational capabilities for
processing numeric data, whereas logic
instruction provide capabilities of performing
logical operations on the bits of a word
• Data Storage: Memory Instructions
– Arithmetic and logical operations are performed primarily on data
in CPU register. Therefore it is necessary to transfer data from
memory to CPU registers before operation and transfer data from
CPU registers to memory after operations.
– The instruction used for such function are belongs to data storage
instructions.
Data Movement:
Date movement instructions are the superset of data storage
instructions. These instructions include the instructions for
transfer of data between CPU register and transfer of data
between CPU registers and input/output devices.
Control:
Test and branch instructions- Test instructions are used to test the
value of a data word or the status of a computations. Branch
instruction are used to branch to a different set of instructions
depending on the decision made.
EXAMPLE
• Write a program to evaluate the arithmetic
statement : Y=(A+B)*(C+D) using three
address, two address, one address and zero
address instructions
Three address instruction
Y=(A+B)*(C+D)
Two Address Instruction
Y=(A+B)*(C+D)
One Address Instruction
Y=(A+B)*(C+D)
Zero Address Instruction
Y=(A+B)*(C+D)
TYPES OF OPERANDS
• Each instruction in a program specifies operation
to be performed and data to be processed. For
this reason, an instruction is divided into two
parts: Its operation code (opcode) and its operand
(data)
• Operand forms:
– Addresses
– Numbers
– Characters
– Logical data
Types of Operations
• Generally type of operations supported by
MIPS instruction set architecture can be
categorized as follows:
– Arithmetic
– Data Transfer
– Logical
– Conditional branch
– Unconditional jump
• MIPS assembly language simply refers to
the assembly language of the MIPS processor.
The term MIPS is an acronym which stands for
Microprocessor without Interlocked Pipeline
Stages, and it is a reduced-instruction set
architecture which was developed by an
organization called MIPS Technologies.
MIPS (RISC) Design Principles
• Simplicity favors regularity
– fixed size instructions
– small number of instruction formats
– opcode always the first 6 bits
• Smaller is faster
– limited instruction set
– limited number of registers in register file
– limited number of addressing modes
• Make the common case fast
– arithmetic operands from the register file (load-store
machine)
– allow instructions to contain immediate operands
• Good design demands good compromises
– three instruction formats
MIPS-32 ISA
• Instruction Categories
– Computational
– Load/Store
– Jump and Branch
– Floating Point
• coprocessor
– Memory Management
– Special
R0 - R31
PC
HI
LO
Registers
op
op
op
rs rt rd sa funct
rs rt immediate
jump target
3 Instruction Formats: all 32 bits wide
R format
I format
J format
MIPS Register File
Register File
src1 addr
src2 addr
dst addr
write data
32 bits
src1
data
src2
data
32
locations
32
5
32
5
5
32
• Holds thirty-two 32-bit registers
– Two read ports and
– One write port
 Registers are
 Faster than main memory
- But register files with more locations are
slower (e.g., a 64 word file could be as much
as 50% slower than a 32 word file)
- Read/write port increase impacts speed quadratically
 Easier for a compiler to use
- e.g., (A*B) – (C*D) – (E*F) can do multiplies in any order vs. stack
 Can hold variables so that
- code density improves (since register are named with fewer bits than a
memory location)
write control
MIPS Register Convention
Name Register
Number
Usage
$zero 0 constant 0 (hardware)
$at 1 reserved for assembler
$v0 - $v1 2-3 returned values
$a0 - $a3 4-7 arguments
$t0 - $t7 8-15 temporaries
$s0 - $s7 16-23 saved values
$t8 - $t9 24-25 temporaries
$gp 28 global pointer
$sp 29 stack pointer
$fp 30 frame pointer
$ra 31 return addr (hardware)
MIPS Memory Access Instructions
• MIPS has two basic data transfer instructions for
accessing memory
lw $t0, 4($s3) #load word from
memory
sw $t0, 8($s3) #store word to
memory
• The data is loaded into (lw) or stored from (sw) a
register in the register file – a 5 bit address
 The memory address – a 32 bit address – is formed by adding
the contents of the base address register to the offset value
Chapter 2 — Instructions: Language of the Computer — 123
Arithmetic Example
• C code:
f = (g + h) - (i + j);
• Compiled MIPS code:
add t0, g, h # temp t0 = g + h
add t1, i, j # temp t1 = i + j
sub f, t0, t1 # f = t0 - t1
Register Operands
• Arithmetic instructions use register
operands
• MIPS has a 32 × 32-bit register file
– Use for frequently accessed data
– Numbered 0 to 31
– 32-bit data called a “word”
• Assembler names
– $t0, $t1, …, $t9 for temporary values
– $s0, $s1, …, $s7 for saved variables
– Design Principle 2: Smaller is faster
Register Operand Example
• C code:
f = (g + h) - (i + j);
– f, …, j in $s0, …, $s4
• Compiled MIPS code:
add $t0, $s1, $s2
add $t1, $s3, $s4
sub $s0, $t0, $t1
Memory Operands
• Main memory used for composite data
– Arrays, structures, dynamic data
• To apply arithmetic operations
– Load values from memory into registers
– Store result from register to memory
• Memory is byte addressed
– Each address identifies an 8-bit byte
• Words are aligned in memory
– Address must be a multiple of 4
• MIPS is Big Endian
– Most-significant byte at least address of a word
– Little Endian: least-significant byte at least address
Chapter 2 — Instructions: Language of the Computer — 128
Memory Operand Example 2
• C code:
A[12] = h + A[8];
– h in $s2, base address of A in $s3
• Compiled MIPS code:
– Index 8 requires offset of 32
lw $t0, 32($s3) # load word
add $t0, $s2, $t0
sw $t0, 48($s3) # store word
Chapter 2 — Instructions: Language of the Computer — 129
Registers vs. Memory
• Registers are faster to access than memory
• Operating on memory data requires loads and
stores
– More instructions to be executed
• Compiler must use registers for variables as
much as possible
– Only spill to memory for less frequently used
variables
– Register optimization is important!
Immediate Operands
• Constant data specified in an instruction
addi $s3, $s3, 4
• No subtract immediate instruction
– Just use a negative constant
addi $s2, $s1, -1
• Design Principle 3: Make the common case
fast
– Small constants are common
– Immediate operand avoids a load instruction
Chapter 2 — Instructions: Language of the Computer — 131
The Constant Zero
• MIPS register 0 ($zero) is the constant 0
– Cannot be overwritten
• Useful for common operations
– E.g., move between registers
add $t2, $s1, $zero
The C Code Translation Hierarchy
C program
compiler
assembly code
assembler
object code library routines
executable
linker
loader
memory
machine code
Unit 1 Computer organization and Instructions
Unit 1 Computer organization and Instructions

More Related Content

What's hot

Processor Organization and Architecture
Processor Organization and ArchitectureProcessor Organization and Architecture
Processor Organization and ArchitectureVinit Raut
 
Unit IV Memory and I/O Organization
Unit IV Memory and I/O OrganizationUnit IV Memory and I/O Organization
Unit IV Memory and I/O OrganizationBalaji Vignesh
 
Computer Organization and Architecture.
Computer Organization and Architecture.Computer Organization and Architecture.
Computer Organization and Architecture.CS_GDRCST
 
MULTILEVEL QUEUE SCHEDULING
MULTILEVEL QUEUE SCHEDULINGMULTILEVEL QUEUE SCHEDULING
MULTILEVEL QUEUE SCHEDULINGgarishma bhatia
 
Shared Memory Multi Processor
Shared Memory Multi ProcessorShared Memory Multi Processor
Shared Memory Multi Processorbabuece
 
Process synchronization in Operating Systems
Process synchronization in Operating SystemsProcess synchronization in Operating Systems
Process synchronization in Operating SystemsRitu Ranjan Shrivastwa
 
Multiprocessor
MultiprocessorMultiprocessor
MultiprocessorNeel Patel
 
Multithreading
MultithreadingMultithreading
MultithreadingA B Shinde
 
Accessing I/O Devices
Accessing I/O DevicesAccessing I/O Devices
Accessing I/O DevicesSlideshare
 
Functional units of computer
Functional units of computerFunctional units of computer
Functional units of computergaurav jain
 
Input Output Organization
Input Output OrganizationInput Output Organization
Input Output OrganizationKamal Acharya
 
Pipeline hazard
Pipeline hazardPipeline hazard
Pipeline hazardAJAL A J
 
Disk Scheduling Algorithm in Operating System
Disk Scheduling Algorithm in Operating SystemDisk Scheduling Algorithm in Operating System
Disk Scheduling Algorithm in Operating SystemMeghaj Mallick
 
Code optimization in compiler design
Code optimization in compiler designCode optimization in compiler design
Code optimization in compiler designKuppusamy P
 

What's hot (20)

Processor Organization and Architecture
Processor Organization and ArchitectureProcessor Organization and Architecture
Processor Organization and Architecture
 
Unit IV Memory and I/O Organization
Unit IV Memory and I/O OrganizationUnit IV Memory and I/O Organization
Unit IV Memory and I/O Organization
 
Computer Organization and Architecture.
Computer Organization and Architecture.Computer Organization and Architecture.
Computer Organization and Architecture.
 
MULTILEVEL QUEUE SCHEDULING
MULTILEVEL QUEUE SCHEDULINGMULTILEVEL QUEUE SCHEDULING
MULTILEVEL QUEUE SCHEDULING
 
Shared Memory Multi Processor
Shared Memory Multi ProcessorShared Memory Multi Processor
Shared Memory Multi Processor
 
Compilers
CompilersCompilers
Compilers
 
Interrupts
InterruptsInterrupts
Interrupts
 
Control unit
Control  unitControl  unit
Control unit
 
Process synchronization in Operating Systems
Process synchronization in Operating SystemsProcess synchronization in Operating Systems
Process synchronization in Operating Systems
 
Modes of transfer
Modes of transferModes of transfer
Modes of transfer
 
Multiprocessor
MultiprocessorMultiprocessor
Multiprocessor
 
Multithreading
MultithreadingMultithreading
Multithreading
 
Accessing I/O Devices
Accessing I/O DevicesAccessing I/O Devices
Accessing I/O Devices
 
Evolution of os
Evolution of osEvolution of os
Evolution of os
 
Functional units of computer
Functional units of computerFunctional units of computer
Functional units of computer
 
Input Output Organization
Input Output OrganizationInput Output Organization
Input Output Organization
 
Memory mapping
Memory mappingMemory mapping
Memory mapping
 
Pipeline hazard
Pipeline hazardPipeline hazard
Pipeline hazard
 
Disk Scheduling Algorithm in Operating System
Disk Scheduling Algorithm in Operating SystemDisk Scheduling Algorithm in Operating System
Disk Scheduling Algorithm in Operating System
 
Code optimization in compiler design
Code optimization in compiler designCode optimization in compiler design
Code optimization in compiler design
 

Similar to Unit 1 Computer organization and Instructions

Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...
Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...
Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...Abhishekn84
 
Parallel Algorithms Advantages and Disadvantages
Parallel Algorithms Advantages and DisadvantagesParallel Algorithms Advantages and Disadvantages
Parallel Algorithms Advantages and DisadvantagesMurtadha Alsabbagh
 
UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...
UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...
UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...LeahRachael
 
Memory Management Strategies - I.pdf
Memory Management Strategies - I.pdfMemory Management Strategies - I.pdf
Memory Management Strategies - I.pdfHarika Pudugosula
 
L-2 (Computer Performance).ppt
L-2 (Computer Performance).pptL-2 (Computer Performance).ppt
L-2 (Computer Performance).pptImranKhan997082
 
ehhhhhhhhhhhhhhhhhhhhhhhhhjjjjjllaye.pptx
ehhhhhhhhhhhhhhhhhhhhhhhhhjjjjjllaye.pptxehhhhhhhhhhhhhhhhhhhhhhhhhjjjjjllaye.pptx
ehhhhhhhhhhhhhhhhhhhhhhhhhjjjjjllaye.pptxEliasPetros
 
Basics of micro controllers for biginners
Basics of  micro controllers for biginnersBasics of  micro controllers for biginners
Basics of micro controllers for biginnersGerwin Makanyanga
 
introduction COA(M1).pptx
introduction COA(M1).pptxintroduction COA(M1).pptx
introduction COA(M1).pptxBhavanaMinchu
 
Unit 5 Advanced Computer Architecture
Unit 5 Advanced Computer ArchitectureUnit 5 Advanced Computer Architecture
Unit 5 Advanced Computer ArchitectureBalaji Vignesh
 
Uni Processor Architecture
Uni Processor ArchitectureUni Processor Architecture
Uni Processor ArchitectureAshish KC
 
Unit 2_OS process management
Unit 2_OS process management Unit 2_OS process management
Unit 2_OS process management JayeshGadhave1
 
Performance Tuning by Dijesh P
Performance Tuning by Dijesh PPerformance Tuning by Dijesh P
Performance Tuning by Dijesh PPlusOrMinusZero
 
Parallel Computing - Lec 6
Parallel Computing - Lec 6Parallel Computing - Lec 6
Parallel Computing - Lec 6Shah Zaib
 
Evolution, Strutcture and Operations.pptx
Evolution, Strutcture and Operations.pptxEvolution, Strutcture and Operations.pptx
Evolution, Strutcture and Operations.pptxssuser000e54
 

Similar to Unit 1 Computer organization and Instructions (20)

Co m1-1
Co m1-1Co m1-1
Co m1-1
 
Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...
Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...
Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...
 
13009690.ppt
13009690.ppt13009690.ppt
13009690.ppt
 
Parallel Algorithms Advantages and Disadvantages
Parallel Algorithms Advantages and DisadvantagesParallel Algorithms Advantages and Disadvantages
Parallel Algorithms Advantages and Disadvantages
 
UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...
UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...
UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...
 
Lecture1
Lecture1Lecture1
Lecture1
 
Memory Management Strategies - I.pdf
Memory Management Strategies - I.pdfMemory Management Strategies - I.pdf
Memory Management Strategies - I.pdf
 
L-2 (Computer Performance).ppt
L-2 (Computer Performance).pptL-2 (Computer Performance).ppt
L-2 (Computer Performance).ppt
 
ehhhhhhhhhhhhhhhhhhhhhhhhhjjjjjllaye.pptx
ehhhhhhhhhhhhhhhhhhhhhhhhhjjjjjllaye.pptxehhhhhhhhhhhhhhhhhhhhhhhhhjjjjjllaye.pptx
ehhhhhhhhhhhhhhhhhhhhhhhhhjjjjjllaye.pptx
 
Basics of micro controllers for biginners
Basics of  micro controllers for biginnersBasics of  micro controllers for biginners
Basics of micro controllers for biginners
 
introduction COA(M1).pptx
introduction COA(M1).pptxintroduction COA(M1).pptx
introduction COA(M1).pptx
 
Chap2 slides
Chap2 slidesChap2 slides
Chap2 slides
 
Unit 5 Advanced Computer Architecture
Unit 5 Advanced Computer ArchitectureUnit 5 Advanced Computer Architecture
Unit 5 Advanced Computer Architecture
 
Uni Processor Architecture
Uni Processor ArchitectureUni Processor Architecture
Uni Processor Architecture
 
Code Optimization
Code OptimizationCode Optimization
Code Optimization
 
Os notes 1_5
Os notes 1_5Os notes 1_5
Os notes 1_5
 
Unit 2_OS process management
Unit 2_OS process management Unit 2_OS process management
Unit 2_OS process management
 
Performance Tuning by Dijesh P
Performance Tuning by Dijesh PPerformance Tuning by Dijesh P
Performance Tuning by Dijesh P
 
Parallel Computing - Lec 6
Parallel Computing - Lec 6Parallel Computing - Lec 6
Parallel Computing - Lec 6
 
Evolution, Strutcture and Operations.pptx
Evolution, Strutcture and Operations.pptxEvolution, Strutcture and Operations.pptx
Evolution, Strutcture and Operations.pptx
 

Recently uploaded

Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 

Recently uploaded (20)

Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 

Unit 1 Computer organization and Instructions

  • 2. Definition of Computer • Computer is a programmable machine. • Computer is a machine that manipulates data according to a list of instructions. • Computer is any device which aids humans in performing various kinds of computations or calculations
  • 3. Earliest Computer • Originally calculations were computed by humans • Human computers were typically engaged in the calculation of a mathematical expression • The calculations of this period were specialized and expensive, requiring years of training in mathematics • The first use of the word "computer" was recorded in 1613, referring to a person who carried out calculations, or computations, and the word continued to be used in that sense until the middle of the 20th century.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 24.
  • 25.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32. BLOCK DIAGRAM OF C0MPUTER
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44. Ideas • The eight ideas that the computer architects have been invented for computer design are as follows: 1. Design for Moore’s law: Moore’s law states that integrated circuit resources double every year 18-24 months. As computer designers may take years, the resources available per chip can easily double or quadruple between the start and the completion of the design. For this reason, the computer architects must anticipate where the technology will be at the completion of design rather than at the start of design.
  • 45. 2. Use abstraction to simplify design: Computer architects must use abstractions to represent the design at different levels to representation instead of lower –levels details. This reduces the design time considerably. 3. Make the common case fast: In making a design a trade-off , it is better to favor the frequent case over the infrequent case. It makes design simple and can be done faster.
  • 46. 4. Performance via Parallelism: It is known that we get more throughput by performing operations in parallel 5. Performance via Pipelining: A pipeline is a set of data processing elements connected in series, where the output of one element is the input of the next one. The elements of pipeline are often executed in parallel to improve performance.
  • 47. 6. Performance via Prediction: In some cases it is better to predict and start working rather than wait until we know for sure assuming that the mechanisms to recover from a mis-prediction is not too expensive and our prediction is relatively accurate. 7. Hierarchy of memory: Ideally, computer memory should be fast, large and inexpensive. Unfortunately, it is impossible to meet all the three of these requirements using one type of memory
  • 48. • Increased speed and size are achieved at increased cost. • The computer architects have found that they can address these conflicting demands with a hierarchy of memory with the fastest, smallest and most expensive memory at the top of the hierarchy and the slowest, largest and cheapest at the bottom 8. Dependability via redundancy: We know that computer should be fast and it also should be dependable. In a computer system a failure of any single component can shut down the entire system. We can make system dependable by including redundant components that can take over the failure occurs.
  • 49. Performance • The performance is an important attribute of a computer. It is an important criteria for selection of a computer • There are number of ways by which performance of a computer can be measured.
  • 50. Defining Performance • When we say one computer is faster than another, we compare their speeds and observes that the faster computer runs a program in less time than other computers • The computer center manager running a large server system may say a computer is faster when it completes more jobs in an hour. • The computer user is always interested in reducing the time between the start and the completion of the program or event i.e., reducing the execution time
  • 51. Contd.. • The execution time is also referred to as response time. Reduction in response time increases the throughput ( the total amount of work done in a given time). The performance of the computer is directly related to throughput and hence it is reciprocal of execution time. • This means that for two components A and B is the performance of A is greater than the Performance of B,
  • 53. EXAMPLE • If Computer A runs a program in 10seconds and computer B runs the same program in 25seconds, how much faster is A than B?
  • 54. EXAMPLE • If Computer A runs a program in 10seconds and computer B runs the same program in 25seconds, how much faster is A than B?
  • 55. Measuring Performance • One of the important measure of a computer performance is a time. • The computer that performs same task in a least time is the fastest. Program execution time is measured in seconds per program.
  • 56. CPU TIME • CPU time is the time the CPU spends computing for particular task and does not include time spend waiting for I/O or other programs • CPU time can be divided into the CPU time spend in the program called user CPU time. • CPU time spent in the operating system performing tasks on behalf of the program called system CPU time
  • 57. • Differentiating between system and user CPU time is difficult to do accurately • Because it is often hard to assign responsibility for operating system activities to one user program rather than other and because of the functionality differences among operating systems. • So performance is measured by CPU execution time • CPU execution Time = CPU clock cycles for a program x Clock cycle time or • CPU execution Time = CPU clock cycles for a program / Clock Rate
  • 58. Contd… A simple formula relates the most basic metrics to CPU time:
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66. Power Wall • Running a Processor at high clock speeds allows for better performance. • Processor runs at a higher speed, it generates more heat and consumes more power • Increase in clock rate increases the power consumption • Technology used for IC is CMOS. For CMOS the dynamic power depends on the capacitive loading of each transistor, voltage applied, and the frequency that the transistor is switched.
  • 67. • Power =Capacitive load x voltage^2 x Frequency switched • Example: – If a new processor has 85% if the capacitive load of old processor, it supply voltage is reduced by 20% and new processor results in a 25% shrink in frequency. What is the impact on power consumption?
  • 68. – Hence the new processor uses only 40.8% of the power that the old processors
  • 69. Power Consumption • By lowering the power supply voltage it is possible to reduce power consumption. However, lowering supply voltage beyond certain limit make the transistors too leaky and it will increase power consumption due to leakage • By using large cooling device • Turning off parts of chip that are not used in a given clock cycle
  • 70. Uniprocessor to Multiprocessor • Due to limitation of power consumption there is a change in the design approach of microprocessor • Instead of increasing speed of single processor, designers came up with multiple processor per chip. • The intension was to increase throughput rather than decrease response time
  • 71. • Multicore processor support parallelism concept • Writing programs to support parallelism is not a simple task for the following reasons – It increases difficulty level of programming – It is necessary to divide the programming task so that each processor has roughly the same amount to do at the same time. That is it needs load balancing – Need scheduling of sub task
  • 72. • Needs to maintain coordination between subtasks • Needs to synchronize task Advantages: • Improves cost/performance ratio of the system • Several processors may be combined to fit the needs of an application while avoiding the expense of the unneeded capabilities of centralized system. This system provide room for expansion
  • 73. • Tasks are divided among the modules. If failure occurs, it sis easier and cheaper to find and replace the malfunctioning processor than replacing the failing part of complex processor. • In a multiprocessor systems, a failure or error in one part has a limited effect on the rest of the system. If fault occurs in one processor, a second processor can take the responsibility of performing the task of the failure processor. This improves the reliability of the system at the cost of some loss in the efficiency.
  • 74. Addressing Mode • Different kind of ways the programmer can refer to data stored in the memory or I/O devices
  • 75. Types • Register addressing mode • Absolute or direct addressing mode • Immediate addressing mode • Indirect addressing mode • Register indirect addressing mode • Displacement addressing mode • Relative addressing mode • Base register addressing mode • Index addressing mode
  • 76. • Auto increment addressing mode • Auto decrement addressing mode • Stack addressing mode
  • 77. Register Addressing mode • The operand is the contents of processor register. The name of register is specified in the instruction • Example; MOV R2,R1 • This instruction copies the content of register R2 to R1
  • 78. Absolute or direct addressing mode • The address of the location of the operand is given explicitly as a part of the instruction • Example: • MOV A, [2000] • This instruction copies the content of memory location 2000 in to register A.
  • 79. Immediate Addressing mode • The operand is given explicitly in the instruction • Example: – MOV #20,A This instruction copies operand 20 in the register A The sign # in front of the value of an operand is used to indicate that this value is an immediate operand
  • 80. Indirect Addressing Mode • In this addressing mode, the instruction contains the address of memory which refers the address of the operand • LOAD R1, @100
  • 81. Register Indirect Addressing mode • The effective address of the operand is the contents of a register or the main memory location whose address is given explicitly in the instruction • Example: – MOV R0, A
  • 82. Immediate addressing mode • The addressing mode in which the data operand is a part of the instruction itself is known as immediate addressing mode. • Example • MOV CX, 4929 H, • ADD AX, 2387 H, • MOV AL, FFH
  • 83. Register addressing mode • It means that the register is the source of an operand for an instruction. • Example • MOV CX, AX ; copies the contents of the 16-bit AX register into ; the 16-bit CX register), ADD BX, AX
  • 84. Direct addressing mode • The addressing mode in which the effective address of the memory location is written directly in the instruction. • Example • MOV AX, [1592H], MOV AL, [0300H]
  • 85. Register indirect addressing mode • This addressing mode allows data to be addressed at any memory location through an offset address held in any of the following registers: BP, BX, DI & SI. • Example • MOV AX, [BX] ; Suppose the register BX contains 4895H, then the contents ; 4895H are moved to AX
  • 86. Based addressing mode • In this addressing mode, the offset address of the operand is given by the sum of contents of the BX/BP registers and 8-bit/16-bit displacement. • Example • MOV DX, [BX+04], ADD CL, [BX+08]
  • 87. Indexed addressing mode • In this addressing mode, the operands offset address is found by adding the contents of SI or DI register and 8-bit/16-bit displacements. • Example • MOV BX, [SI+16], ADD AL, [DI+16] A.Azhagu Jaisudhan M.E. (Ph.D)
  • 88. Based-index addressing mode • In this addressing mode, the offset address of the operand is computed by summing the base register to the contents of an Index register. • Example • ADD CX, [BX+SI], MOV AX, [BX+DI]
  • 89. Based indexed with displacement mode • In this addressing mode, the operands offset is computed by adding the base register contents. An Index registers contents and 8 or 16-bit displacement. • Example • MOV AX, [BX+DI+08], ADD CX, [BX+SI+16]
  • 90.
  • 91.
  • 92.
  • 93.
  • 94. Auto Increment Addressing Mode • The effective address of the operand is the contents of a register specified in the instruction. After accessing the operand, the contents of this register are incremented to address the next location. • Example: MOV R0,(R2)+ • The above instruction copies the content of register R0 in to the memory location whose address is specified by the content of register R2. After copy operation, the contents of register R2 are automatically incremented by 1
  • 95. Auto decrement Addressing Mode • The content of a register specified in the instruction are decremented and then they are used as an effective address to access a memory location. Example: MOV -R0,(R1) • This instruction, initially decrements the contents of register R0 and then the decremented contents of register R0 are used to address the memory location. Finally, the contents from the addressed memory location are copied in to the register R1.
  • 96.
  • 97.
  • 98. Instructions • The word of computers language are called instructions. • Instruction set of computers both in the form of written by people and in the form read by the computer. • Language of computers would be as diverse as those of people, but in reality computer languages are quite similar. • Many Instruction sets comes from MIPS Technologies
  • 99. Three popular instruction sets • ARMv7 is similar to MIPS. More than 9 billion chips with ARM processors were manufactured in 2011, making it the most popular instruction set in the world. • The second example is the Intel x86, which powers both the PC and the cloud of the post PC era. • The third example is ARMv8, which extends the address size of the ARMv7 from32bits to 64bits. This instruction set is closed to MIPS than ARMv7.
  • 100. • This similarity of instruction sets occurs because all computers are constructed from hardware technologies based on similar underlying principles. • Computer designers have a common goal; • To find a language that makes it easy to build the hardware and the compiler while maximizing performance and minimizing cost and energy. • The simplicity of the equipment is as valuable a consideration for today's computers as it was for those of the 1950. • This topic we discussed about showing both how it is represented in hardware and the relationship between high level language
  • 101.
  • 102.
  • 103. Instruction Types • According to operation – Data Processing Instruction – Data Storage Instruction – Data movement Instruction – Control Instruction • According to number of addresses – Three address instruction – Two address instruction – One address instruction – Zero address instruction
  • 104. According to operation • Processor has a set of instruction that allows the user to formulate any data processing ask. • According to operations instruction are classified • Data Processing: – Arithmetic and logic instruction – The arithmetic instructions provide computational capabilities for processing numeric data, whereas logic instruction provide capabilities of performing logical operations on the bits of a word
  • 105. • Data Storage: Memory Instructions – Arithmetic and logical operations are performed primarily on data in CPU register. Therefore it is necessary to transfer data from memory to CPU registers before operation and transfer data from CPU registers to memory after operations. – The instruction used for such function are belongs to data storage instructions. Data Movement: Date movement instructions are the superset of data storage instructions. These instructions include the instructions for transfer of data between CPU register and transfer of data between CPU registers and input/output devices. Control: Test and branch instructions- Test instructions are used to test the value of a data word or the status of a computations. Branch instruction are used to branch to a different set of instructions depending on the decision made.
  • 106.
  • 107.
  • 108. EXAMPLE • Write a program to evaluate the arithmetic statement : Y=(A+B)*(C+D) using three address, two address, one address and zero address instructions
  • 113. TYPES OF OPERANDS • Each instruction in a program specifies operation to be performed and data to be processed. For this reason, an instruction is divided into two parts: Its operation code (opcode) and its operand (data) • Operand forms: – Addresses – Numbers – Characters – Logical data
  • 114. Types of Operations • Generally type of operations supported by MIPS instruction set architecture can be categorized as follows: – Arithmetic – Data Transfer – Logical – Conditional branch – Unconditional jump
  • 115. • MIPS assembly language simply refers to the assembly language of the MIPS processor. The term MIPS is an acronym which stands for Microprocessor without Interlocked Pipeline Stages, and it is a reduced-instruction set architecture which was developed by an organization called MIPS Technologies.
  • 116. MIPS (RISC) Design Principles • Simplicity favors regularity – fixed size instructions – small number of instruction formats – opcode always the first 6 bits • Smaller is faster – limited instruction set – limited number of registers in register file – limited number of addressing modes • Make the common case fast – arithmetic operands from the register file (load-store machine) – allow instructions to contain immediate operands • Good design demands good compromises – three instruction formats
  • 117. MIPS-32 ISA • Instruction Categories – Computational – Load/Store – Jump and Branch – Floating Point • coprocessor – Memory Management – Special R0 - R31 PC HI LO Registers op op op rs rt rd sa funct rs rt immediate jump target 3 Instruction Formats: all 32 bits wide R format I format J format
  • 118.
  • 119.
  • 120. MIPS Register File Register File src1 addr src2 addr dst addr write data 32 bits src1 data src2 data 32 locations 32 5 32 5 5 32 • Holds thirty-two 32-bit registers – Two read ports and – One write port  Registers are  Faster than main memory - But register files with more locations are slower (e.g., a 64 word file could be as much as 50% slower than a 32 word file) - Read/write port increase impacts speed quadratically  Easier for a compiler to use - e.g., (A*B) – (C*D) – (E*F) can do multiplies in any order vs. stack  Can hold variables so that - code density improves (since register are named with fewer bits than a memory location) write control
  • 121. MIPS Register Convention Name Register Number Usage $zero 0 constant 0 (hardware) $at 1 reserved for assembler $v0 - $v1 2-3 returned values $a0 - $a3 4-7 arguments $t0 - $t7 8-15 temporaries $s0 - $s7 16-23 saved values $t8 - $t9 24-25 temporaries $gp 28 global pointer $sp 29 stack pointer $fp 30 frame pointer $ra 31 return addr (hardware)
  • 122. MIPS Memory Access Instructions • MIPS has two basic data transfer instructions for accessing memory lw $t0, 4($s3) #load word from memory sw $t0, 8($s3) #store word to memory • The data is loaded into (lw) or stored from (sw) a register in the register file – a 5 bit address  The memory address – a 32 bit address – is formed by adding the contents of the base address register to the offset value
  • 123. Chapter 2 — Instructions: Language of the Computer — 123 Arithmetic Example • C code: f = (g + h) - (i + j); • Compiled MIPS code: add t0, g, h # temp t0 = g + h add t1, i, j # temp t1 = i + j sub f, t0, t1 # f = t0 - t1
  • 124. Register Operands • Arithmetic instructions use register operands • MIPS has a 32 × 32-bit register file – Use for frequently accessed data – Numbered 0 to 31 – 32-bit data called a “word” • Assembler names – $t0, $t1, …, $t9 for temporary values – $s0, $s1, …, $s7 for saved variables – Design Principle 2: Smaller is faster
  • 125. Register Operand Example • C code: f = (g + h) - (i + j); – f, …, j in $s0, …, $s4 • Compiled MIPS code: add $t0, $s1, $s2 add $t1, $s3, $s4 sub $s0, $t0, $t1
  • 126. Memory Operands • Main memory used for composite data – Arrays, structures, dynamic data • To apply arithmetic operations – Load values from memory into registers – Store result from register to memory • Memory is byte addressed – Each address identifies an 8-bit byte • Words are aligned in memory – Address must be a multiple of 4 • MIPS is Big Endian – Most-significant byte at least address of a word – Little Endian: least-significant byte at least address
  • 127.
  • 128. Chapter 2 — Instructions: Language of the Computer — 128 Memory Operand Example 2 • C code: A[12] = h + A[8]; – h in $s2, base address of A in $s3 • Compiled MIPS code: – Index 8 requires offset of 32 lw $t0, 32($s3) # load word add $t0, $s2, $t0 sw $t0, 48($s3) # store word
  • 129. Chapter 2 — Instructions: Language of the Computer — 129 Registers vs. Memory • Registers are faster to access than memory • Operating on memory data requires loads and stores – More instructions to be executed • Compiler must use registers for variables as much as possible – Only spill to memory for less frequently used variables – Register optimization is important!
  • 130. Immediate Operands • Constant data specified in an instruction addi $s3, $s3, 4 • No subtract immediate instruction – Just use a negative constant addi $s2, $s1, -1 • Design Principle 3: Make the common case fast – Small constants are common – Immediate operand avoids a load instruction
  • 131. Chapter 2 — Instructions: Language of the Computer — 131 The Constant Zero • MIPS register 0 ($zero) is the constant 0 – Cannot be overwritten • Useful for common operations – E.g., move between registers add $t2, $s1, $zero
  • 132.
  • 133.
  • 134.
  • 135.
  • 136.
  • 137.
  • 138.
  • 139.
  • 140.
  • 141. The C Code Translation Hierarchy C program compiler assembly code assembler object code library routines executable linker loader memory machine code