SlideShare a Scribd company logo
+
Computer Architecture
CNE-301
Lecturer: Irfan Ali
Instruction Set Architecture (ISA)
Memory addressing, instructions, data types, memory architecture, interrupts,
exception handling, external I/O
+ Instruction Set Architecture (ISA)
• Serves as an interface between software and
hardware.
• Provides a mechanism by which the software tells
the hardware what should be done.
instruction set
High level language code : C, C++, Java, Fortran,
hardware
Assembly language code: architecture specific statements
Machine language code: architecture specific bit patterns
software
compiler
assembler
+
Well know ISA’s
 X86 (based on intel 8086 CPU in 1978, Intel family, also
followed by AMD)
 ARM (32-bit & 64-Bit, initially Acorn RISC machine)
 MIPS (32-bit & 64-bit by microprocessor without interlocked
pipeline stages)
 SPARC( 32-bit & 64-bit by sun microsystem)
 PIC (8-bit to 32-bit microchip)
 Z80( 8-bit)
+ Instruction Set Design Issues
Instruction set design issues include:
 Where are operands stored?
 registers, memory, stack, accumulator
 How many explicit operands are there?
 0, 1, 2, or 3
 How is the operand location specified?
 register, immediate, indirect, . . .
 What type & size of operands are supported?
 byte, int, float, double, string, vector. . .
 What operations are supported?
 add, sub, mul, move, compare . . .
+ Classifying ISAs
Accumulator (before 1960):
1-address add A acc ¬ acc +
mem[A]
Stack (1960s to 1970s):
0-address add tos ¬ tos + next
Memory-Memory (1970s to 1980s):
2-address add A, B mem[A] ¬
mem[A] + mem[B]
3-address add A, B, C mem[A] ¬
mem[B] + mem[C]
+
Register-Memory (1970s to present, e.g. 80x86):
2-address add R1, A R1 ¬ R1 + mem[A]
load R1, A R1 ¬ mem[A]
Register-Register (Load/Store) (1960s to present, e.g. MIPS):
3-address add R1, R2, R3 R1 ¬ R2 + R3
load R1, R2 R1 ¬ mem[R2]
store R1, R2 mem[R1] ¬ R2
+ Operand Locations in Four ISA
Classes GPR
+ Code Sequence C = A + B
for Four Instruction Sets
Stack Accumulator Register
(register-memory)
Register
(load-store)
Push A
Push B
Add
Pop C
Load A
Add B
Store C
Load R1, A
Add R1, B
Store C, R1
Load R1,A
Load R2, B
Add R3, R1, R2
Store C, R3
memory memory
acc = acc + mem[C] R1 = R1 + mem[C] R3 = R1 + R2
+ Stack Architectures
 Instruction set:
add, sub, mult, div, . . .
push A, pop A
 Example: A*B - (A+C*B)
push A
push B
mul
push A
push C
push B
mul
add
sub
A B
A
A*B
A*B
A*B
A*B
A
A
C
A*B
A A*B
A C B B*C A+B*C result
+ Stacks: Pros and Cons
– Pros
– Good code density (implicit top of stack)
– Low hardware requirements
– Easy to write a simpler compiler for stack
architectures
– Cons
– Stack becomes the bottleneck
– Little ability for parallelism or pipelining
– Data is not always at the top of stack when need, so
additional instructions like TOP and SWAP are needed
– Difficult to write an optimizing compiler for stack
architectures
Accumulator Architectures
 Instruction set:
add A, sub A, mult A, div A, . . .
load A, store A
 Example: A*B - (A+C*B)
 load B
 mul C
 add A
 store D
 load A
 mul B
 sub D
B B*C A+B*C AA+B*C A*B result
acc = acc +,-,*,/ mem[A]
Accumulators: Pros and Cons
●
Pros
 Very low hardware requirements
 Easy to design and understand
●
Cons
 Accumulator becomes the bottleneck
 Little ability for parallelism or
pipelining
 High memory traffic
Memory-Memory Architectures
• Instruction set:
(3 operands) add A, B, C sub A, B, C mul A, B, C
(2 operands) add A, B sub A, B mul A, B
• Example: A*B - (A+C*B)
– 3 operands 2 operands
– mul D, A, B mov D, A
– mul E, C, B mul D, B
– add E, A, E mov E, C
– sub E, D, E mul E, B
– add E, A
– sub E, D
Memory-Memory: Pros and
Cons
• Pros
– Requires fewer instructions (especially if 3 operands)
– Easy to write compilers for (especially if 3 operands)
• Cons
– Very high memory traffic (especially if 3 operands)
– Variable number of clocks per instruction
– With two operands, more data movements are required
Register-Memory Architectures
• Instruction set:
add R1, A sub R1, A mul R1, B
load R1, A store R1, A
• Example: A*B - (A+C*B)
load R1, A
mul R1, B /* A*B */
store R1, D
load R2, C
mul R2, B /* C*B */
add R2, A /* A + CB */
sub R2, D /* AB - (A + C*B) */
R1 = R1 +,-,*,/ mem[B]
Memory-Register: Pros and Cons
●
Pros
● Some data can be accessed without loading first
● Instruction format easy to encode
● Good code density
●
Cons
● Operands are not equivalent
● May limit number of registers
Load-Store Architectures
• Instruction set:
add R1, R2, R3 sub R1, R2, R3 mul R1, R2, R3
load R1, &A store R1, &A move R1, R2
• Example: A*B - (A+C*B)
load R1, &A
load R2, &B
load R3, &C
mul R7, R3, R2 /* C*B */
add R8, R7, R1 /* A + C*B */
mul R9, R1, R2 /* A*B */
sub R10, R9, R8 /* A*B - (A+C*B) */
R3 = R1 +,-,*,/ R2
Load-Store: Pros and Cons
Pros
●
Simple, fixed length instruction encodings
●
Instructions take similar number of cycles
●
Relatively easy to pipeline and make superscalar
Cons
●
Higher instruction count
●
Not all instructions need three operands
●
Dependent on good compiler
+
Classification of instructions
4-address instructions
3-address instructions
2-address instructions
1-address instructions
0-address instructions
+
Classification of instructions
(continued…)
The 4-address instruction specifies the two
source operands, the destination operand and
the address of the next instruction
op code source 2destination next addresssource 1
+
Classification of instructions
(continued…)
A 3-address instruction specifies addresses for
both operands as well as the result
op code source 2destination source 1
+Classification of instructions
(continued…)
A 2-address instruction overwrites one operand
with the result
One field serves two purposes
op code destination
source 1
source 2
• A 1-address instruction has a dedicated CPU register,
called the accumulator, to hold one operand & the
result –No address is needed to specify the
accumulator
op code source 2
+
Classification of instructions
(continued…)
A 0-address instruction uses a stack to hold
both operands and the result. Operations are
performed between the value on the top of the
stack TOS) and the second value on the stack
(SOS) and the result is stored on the TOS
op code
+
Comparison of
instruction formats
As an example assume:
that a single byte is used for the op code
the size of the memory address space is 16
Mbytes
a single addressable memory unit is a byte
Size of operands is 24 bits
Data bus size is 8 bits
+
Comparison of
instruction formats
We will use the following two
parameters to compare the five
instruction formats mentioned before
Code size
 Has an effect on the storage requirements
Number of memory accesses
 Has an effect on execution time
+
4-address instruction
Code size = 1+3+3+3+3 = 13 bytes
No of bytes accessed from memory
13 bytes for instruction fetch +
6 bytes for source operand fetch +
3 bytes for storing destination operand
Total = 22 bytes
op code source 2destination next addresssource 1
1 byte 3 bytes 3 bytes 3 bytes3 bytes
+
3-address instruction
Code size = 1+3+3+3 = 10 bytes
No of bytes accessed from memory
10 bytes for instruction fetch +
6 bytes for source operand fetch +
3 bytes for storing destination operand
Total = 19 bytes
1 byte 3 bytes 3 bytes3 bytes
op code source 2destination source 1
+
2-address instruction
Code size = 1+3+3 = 7 bytes
No of bytes accessed from memory
7 bytes for instruction fetch +
6 bytes for source operand fetch +
3 bytes for storing destination operand
Total = 16 bytes
op code destination
source 1
source 2
1 byte 3 bytes3 bytes
+
1-address instruction
Code size = 1+3= 4 bytes
No of bytes accessed from memory
4 bytes for instruction fetch +
3 bytes for source operand fetch +
0 bytes for storing destination operand
Total = 7 bytes
1 byte 3 bytes
op code source 2
+
0-address instruction
Code size = 1= 1 bytes
# of bytes accessed from memory
1 bytes for instruction fetch +
6 bytes for source operand fetch +
3 bytes for storing destination operand
Total = 10 bytes
1 byte
op code
+
Summary
Instruction Format Code
size
Number of
memory bytes
4-address instruction 13 22
3-address instruction 10 19
2-address instruction 7 16
1-address instruction 4 7
0-address instruction 1 10
+
Example 2.1 text
expression evaluation a = (b+c)*d
- e
3-Address 2-Address 1-Address 0-Address
add a, b, c
mpy a, a, d
sub a, a, e
load a, b
add a, c
mpy a, d
sub a, e
lda b
add c
mpy d
sub e
sta a
push b
push c
add
push d
mpy
push e
sub
pop a

More Related Content

What's hot

DMA and DMA controller
DMA and DMA controllerDMA and DMA controller
DMA and DMA controller
nishant upadhyay
 
Computer architecture pipelining
Computer architecture pipeliningComputer architecture pipelining
Computer architecture pipelining
Mazin Alwaaly
 
Booth’s algorithm.(a014& a015)
Booth’s algorithm.(a014& a015)Booth’s algorithm.(a014& a015)
Booth’s algorithm.(a014& a015)
Piyush Rochwani
 
Computer architecture control unit
Computer architecture control unitComputer architecture control unit
Computer architecture control unit
Mazin Alwaaly
 
Instruction codes
Instruction codesInstruction codes
Instruction codes
pradeepa velmurugan
 
Unit 4 memory system
Unit 4   memory systemUnit 4   memory system
Unit 4 memory system
chidabdu
 
Computer architecture and organization
Computer architecture and organizationComputer architecture and organization
Computer architecture and organization
Tushar B Kute
 
CO By Rakesh Roshan
CO By Rakesh RoshanCO By Rakesh Roshan
CO By Rakesh Roshan
Rakesh Roshan
 
Instruction Set Architecture
Instruction Set ArchitectureInstruction Set Architecture
Instruction Set Architecture
Jaffer Haadi
 
Register transfer and micro-operation
Register transfer and micro-operationRegister transfer and micro-operation
Register transfer and micro-operation
Nikhil Pandit
 
Basic Computer Organization and Design
Basic Computer Organization and DesignBasic Computer Organization and Design
Basic Computer Organization and Design
Kamal Acharya
 
04 cache memory.ppt 1
04 cache memory.ppt 104 cache memory.ppt 1
04 cache memory.ppt 1
Anwal Mirza
 
Instruction Set Architecture
Instruction Set ArchitectureInstruction Set Architecture
Instruction Set Architecture
Dilum Bandara
 
Micro programmed control
Micro programmed  controlMicro programmed  control
Micro programmed control
Shashank Singh
 
Microprogrammed Control Unit
Microprogrammed Control UnitMicroprogrammed Control Unit
Microprogrammed Control Unit
PreethiSureshkumar1
 
Computer Organisation & Architecture (chapter 1)
Computer Organisation & Architecture (chapter 1) Computer Organisation & Architecture (chapter 1)
Computer Organisation & Architecture (chapter 1)
Subhasis Dash
 
Pipeline hazard
Pipeline hazardPipeline hazard
Pipeline hazard
AJAL A J
 
Computer architecture addressing modes and formats
Computer architecture addressing modes and formatsComputer architecture addressing modes and formats
Computer architecture addressing modes and formats
Mazin Alwaaly
 
Addressing mode
Addressing modeAddressing mode
Addressing mode
ilakkiya
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
karthiga selvaraju
 

What's hot (20)

DMA and DMA controller
DMA and DMA controllerDMA and DMA controller
DMA and DMA controller
 
Computer architecture pipelining
Computer architecture pipeliningComputer architecture pipelining
Computer architecture pipelining
 
Booth’s algorithm.(a014& a015)
Booth’s algorithm.(a014& a015)Booth’s algorithm.(a014& a015)
Booth’s algorithm.(a014& a015)
 
Computer architecture control unit
Computer architecture control unitComputer architecture control unit
Computer architecture control unit
 
Instruction codes
Instruction codesInstruction codes
Instruction codes
 
Unit 4 memory system
Unit 4   memory systemUnit 4   memory system
Unit 4 memory system
 
Computer architecture and organization
Computer architecture and organizationComputer architecture and organization
Computer architecture and organization
 
CO By Rakesh Roshan
CO By Rakesh RoshanCO By Rakesh Roshan
CO By Rakesh Roshan
 
Instruction Set Architecture
Instruction Set ArchitectureInstruction Set Architecture
Instruction Set Architecture
 
Register transfer and micro-operation
Register transfer and micro-operationRegister transfer and micro-operation
Register transfer and micro-operation
 
Basic Computer Organization and Design
Basic Computer Organization and DesignBasic Computer Organization and Design
Basic Computer Organization and Design
 
04 cache memory.ppt 1
04 cache memory.ppt 104 cache memory.ppt 1
04 cache memory.ppt 1
 
Instruction Set Architecture
Instruction Set ArchitectureInstruction Set Architecture
Instruction Set Architecture
 
Micro programmed control
Micro programmed  controlMicro programmed  control
Micro programmed control
 
Microprogrammed Control Unit
Microprogrammed Control UnitMicroprogrammed Control Unit
Microprogrammed Control Unit
 
Computer Organisation & Architecture (chapter 1)
Computer Organisation & Architecture (chapter 1) Computer Organisation & Architecture (chapter 1)
Computer Organisation & Architecture (chapter 1)
 
Pipeline hazard
Pipeline hazardPipeline hazard
Pipeline hazard
 
Computer architecture addressing modes and formats
Computer architecture addressing modes and formatsComputer architecture addressing modes and formats
Computer architecture addressing modes and formats
 
Addressing mode
Addressing modeAddressing mode
Addressing mode
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 

Similar to Instruction Set Architecture

Ch-4.pptx
Ch-4.pptxCh-4.pptx
Ch-4.pptx
mayur970057
 
05 instruction set design and architecture
05 instruction set design and architecture05 instruction set design and architecture
05 instruction set design and architecture
Waqar Jamil
 
LECTURE2 td 2 sue les theories de graphes
LECTURE2 td 2 sue les theories de graphesLECTURE2 td 2 sue les theories de graphes
LECTURE2 td 2 sue les theories de graphes
AhmedMahjoub15
 
UNIT-3.pptx
UNIT-3.pptxUNIT-3.pptx
UNIT-3.pptx
TirthPatel479872
 
ISA.pptx
ISA.pptxISA.pptx
ISA.pptx
FarrukhMuneer2
 
(246431835) instruction set principles (2) (1)
(246431835) instruction set principles (2) (1)(246431835) instruction set principles (2) (1)
(246431835) instruction set principles (2) (1)
Alveena Saleem
 
other-architectures.ppt
other-architectures.pptother-architectures.ppt
other-architectures.ppt
Jaya Chavan
 
10 Instruction Sets Characteristics
10  Instruction  Sets Characteristics10  Instruction  Sets Characteristics
10 Instruction Sets Characteristics
Jeanie Delos Arcos
 
Lec02
Lec02Lec02
Al2ed chapter2
Al2ed chapter2Al2ed chapter2
Al2ed chapter2
Abdullelah Al-Fahad
 
Introduction to Processor Design and ARM Processor
Introduction to Processor Design and ARM ProcessorIntroduction to Processor Design and ARM Processor
Introduction to Processor Design and ARM Processor
Darling Jemima
 
11_ InstructionSetsAddressingModes .pdf
11_ InstructionSetsAddressingModes .pdf11_ InstructionSetsAddressingModes .pdf
11_ InstructionSetsAddressingModes .pdf
WilliamTom9
 
Address/Thread/Memory Sanitizer
Address/Thread/Memory SanitizerAddress/Thread/Memory Sanitizer
Address/Thread/Memory Sanitizer
Platonov Sergey
 
Ch8_CENTRAL PROCESSING UNIT Registers ALU
Ch8_CENTRAL PROCESSING UNIT Registers ALUCh8_CENTRAL PROCESSING UNIT Registers ALU
Ch8_CENTRAL PROCESSING UNIT Registers ALU
RNShukla7
 
Lec05
Lec05Lec05
COA_mod2.ppt
COA_mod2.pptCOA_mod2.ppt
COA_mod2.ppt
singleps47
 
Instruction set (prasenjit dey)
Instruction set (prasenjit dey)Instruction set (prasenjit dey)
Instruction set (prasenjit dey)
Prasenjit Dey
 
CO_Chapter2.ppt
CO_Chapter2.pptCO_Chapter2.ppt
CO_Chapter2.ppt
Pranav726214
 
Instruction set.pptx
Instruction set.pptxInstruction set.pptx
Instruction set.pptx
ssuser000e54
 
Session01_Intro.pdf
Session01_Intro.pdfSession01_Intro.pdf
Session01_Intro.pdf
RahnerJames
 

Similar to Instruction Set Architecture (20)

Ch-4.pptx
Ch-4.pptxCh-4.pptx
Ch-4.pptx
 
05 instruction set design and architecture
05 instruction set design and architecture05 instruction set design and architecture
05 instruction set design and architecture
 
LECTURE2 td 2 sue les theories de graphes
LECTURE2 td 2 sue les theories de graphesLECTURE2 td 2 sue les theories de graphes
LECTURE2 td 2 sue les theories de graphes
 
UNIT-3.pptx
UNIT-3.pptxUNIT-3.pptx
UNIT-3.pptx
 
ISA.pptx
ISA.pptxISA.pptx
ISA.pptx
 
(246431835) instruction set principles (2) (1)
(246431835) instruction set principles (2) (1)(246431835) instruction set principles (2) (1)
(246431835) instruction set principles (2) (1)
 
other-architectures.ppt
other-architectures.pptother-architectures.ppt
other-architectures.ppt
 
10 Instruction Sets Characteristics
10  Instruction  Sets Characteristics10  Instruction  Sets Characteristics
10 Instruction Sets Characteristics
 
Lec02
Lec02Lec02
Lec02
 
Al2ed chapter2
Al2ed chapter2Al2ed chapter2
Al2ed chapter2
 
Introduction to Processor Design and ARM Processor
Introduction to Processor Design and ARM ProcessorIntroduction to Processor Design and ARM Processor
Introduction to Processor Design and ARM Processor
 
11_ InstructionSetsAddressingModes .pdf
11_ InstructionSetsAddressingModes .pdf11_ InstructionSetsAddressingModes .pdf
11_ InstructionSetsAddressingModes .pdf
 
Address/Thread/Memory Sanitizer
Address/Thread/Memory SanitizerAddress/Thread/Memory Sanitizer
Address/Thread/Memory Sanitizer
 
Ch8_CENTRAL PROCESSING UNIT Registers ALU
Ch8_CENTRAL PROCESSING UNIT Registers ALUCh8_CENTRAL PROCESSING UNIT Registers ALU
Ch8_CENTRAL PROCESSING UNIT Registers ALU
 
Lec05
Lec05Lec05
Lec05
 
COA_mod2.ppt
COA_mod2.pptCOA_mod2.ppt
COA_mod2.ppt
 
Instruction set (prasenjit dey)
Instruction set (prasenjit dey)Instruction set (prasenjit dey)
Instruction set (prasenjit dey)
 
CO_Chapter2.ppt
CO_Chapter2.pptCO_Chapter2.ppt
CO_Chapter2.ppt
 
Instruction set.pptx
Instruction set.pptxInstruction set.pptx
Instruction set.pptx
 
Session01_Intro.pdf
Session01_Intro.pdfSession01_Intro.pdf
Session01_Intro.pdf
 

More from Haris456

Hazards Computer Architecture
Hazards Computer ArchitectureHazards Computer Architecture
Hazards Computer Architecture
Haris456
 
Pipelining of Processors Computer Architecture
Pipelining of  Processors Computer ArchitecturePipelining of  Processors Computer Architecture
Pipelining of Processors Computer Architecture
Haris456
 
Computer Architecture Vector Computer
Computer Architecture Vector ComputerComputer Architecture Vector Computer
Computer Architecture Vector Computer
Haris456
 
Multithreading computer architecture
 Multithreading computer architecture  Multithreading computer architecture
Multithreading computer architecture
Haris456
 
Graphics processing uni computer archiecture
Graphics processing uni computer archiectureGraphics processing uni computer archiecture
Graphics processing uni computer archiecture
Haris456
 
Computer Memory Hierarchy Computer Architecture
Computer Memory Hierarchy Computer ArchitectureComputer Memory Hierarchy Computer Architecture
Computer Memory Hierarchy Computer Architecture
Haris456
 
Computer Architecture Instruction-Level paraallel processors
Computer Architecture Instruction-Level paraallel processorsComputer Architecture Instruction-Level paraallel processors
Computer Architecture Instruction-Level paraallel processors
Haris456
 
Pipeline Computer Architecture
Pipeline Computer ArchitecturePipeline Computer Architecture
Pipeline Computer Architecture
Haris456
 
Addressing mode Computer Architecture
Addressing mode  Computer ArchitectureAddressing mode  Computer Architecture
Addressing mode Computer Architecture
Haris456
 
Ca lecture 03
Ca lecture 03Ca lecture 03
Ca lecture 03
Haris456
 
Computer Architecture
Computer ArchitectureComputer Architecture
Computer Architecture
Haris456
 

More from Haris456 (11)

Hazards Computer Architecture
Hazards Computer ArchitectureHazards Computer Architecture
Hazards Computer Architecture
 
Pipelining of Processors Computer Architecture
Pipelining of  Processors Computer ArchitecturePipelining of  Processors Computer Architecture
Pipelining of Processors Computer Architecture
 
Computer Architecture Vector Computer
Computer Architecture Vector ComputerComputer Architecture Vector Computer
Computer Architecture Vector Computer
 
Multithreading computer architecture
 Multithreading computer architecture  Multithreading computer architecture
Multithreading computer architecture
 
Graphics processing uni computer archiecture
Graphics processing uni computer archiectureGraphics processing uni computer archiecture
Graphics processing uni computer archiecture
 
Computer Memory Hierarchy Computer Architecture
Computer Memory Hierarchy Computer ArchitectureComputer Memory Hierarchy Computer Architecture
Computer Memory Hierarchy Computer Architecture
 
Computer Architecture Instruction-Level paraallel processors
Computer Architecture Instruction-Level paraallel processorsComputer Architecture Instruction-Level paraallel processors
Computer Architecture Instruction-Level paraallel processors
 
Pipeline Computer Architecture
Pipeline Computer ArchitecturePipeline Computer Architecture
Pipeline Computer Architecture
 
Addressing mode Computer Architecture
Addressing mode  Computer ArchitectureAddressing mode  Computer Architecture
Addressing mode Computer Architecture
 
Ca lecture 03
Ca lecture 03Ca lecture 03
Ca lecture 03
 
Computer Architecture
Computer ArchitectureComputer Architecture
Computer Architecture
 

Recently uploaded

Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Codeigniter VS Cakephp Which is Better for Web Development.pdf
Codeigniter VS Cakephp Which is Better for Web Development.pdfCodeigniter VS Cakephp Which is Better for Web Development.pdf
Codeigniter VS Cakephp Which is Better for Web Development.pdf
Semiosis Software Private Limited
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
lorraineandreiamcidl
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
Gerardo Pardo-Castellote
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
mz5nrf0n
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 

Recently uploaded (20)

Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Codeigniter VS Cakephp Which is Better for Web Development.pdf
Codeigniter VS Cakephp Which is Better for Web Development.pdfCodeigniter VS Cakephp Which is Better for Web Development.pdf
Codeigniter VS Cakephp Which is Better for Web Development.pdf
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 

Instruction Set Architecture

  • 2. Instruction Set Architecture (ISA) Memory addressing, instructions, data types, memory architecture, interrupts, exception handling, external I/O
  • 3. + Instruction Set Architecture (ISA) • Serves as an interface between software and hardware. • Provides a mechanism by which the software tells the hardware what should be done. instruction set High level language code : C, C++, Java, Fortran, hardware Assembly language code: architecture specific statements Machine language code: architecture specific bit patterns software compiler assembler
  • 4. + Well know ISA’s  X86 (based on intel 8086 CPU in 1978, Intel family, also followed by AMD)  ARM (32-bit & 64-Bit, initially Acorn RISC machine)  MIPS (32-bit & 64-bit by microprocessor without interlocked pipeline stages)  SPARC( 32-bit & 64-bit by sun microsystem)  PIC (8-bit to 32-bit microchip)  Z80( 8-bit)
  • 5. + Instruction Set Design Issues Instruction set design issues include:  Where are operands stored?  registers, memory, stack, accumulator  How many explicit operands are there?  0, 1, 2, or 3  How is the operand location specified?  register, immediate, indirect, . . .  What type & size of operands are supported?  byte, int, float, double, string, vector. . .  What operations are supported?  add, sub, mul, move, compare . . .
  • 6. + Classifying ISAs Accumulator (before 1960): 1-address add A acc ¬ acc + mem[A] Stack (1960s to 1970s): 0-address add tos ¬ tos + next Memory-Memory (1970s to 1980s): 2-address add A, B mem[A] ¬ mem[A] + mem[B] 3-address add A, B, C mem[A] ¬ mem[B] + mem[C]
  • 7. + Register-Memory (1970s to present, e.g. 80x86): 2-address add R1, A R1 ¬ R1 + mem[A] load R1, A R1 ¬ mem[A] Register-Register (Load/Store) (1960s to present, e.g. MIPS): 3-address add R1, R2, R3 R1 ¬ R2 + R3 load R1, R2 R1 ¬ mem[R2] store R1, R2 mem[R1] ¬ R2
  • 8. + Operand Locations in Four ISA Classes GPR
  • 9. + Code Sequence C = A + B for Four Instruction Sets Stack Accumulator Register (register-memory) Register (load-store) Push A Push B Add Pop C Load A Add B Store C Load R1, A Add R1, B Store C, R1 Load R1,A Load R2, B Add R3, R1, R2 Store C, R3 memory memory acc = acc + mem[C] R1 = R1 + mem[C] R3 = R1 + R2
  • 10. + Stack Architectures  Instruction set: add, sub, mult, div, . . . push A, pop A  Example: A*B - (A+C*B) push A push B mul push A push C push B mul add sub A B A A*B A*B A*B A*B A A C A*B A A*B A C B B*C A+B*C result
  • 11. + Stacks: Pros and Cons – Pros – Good code density (implicit top of stack) – Low hardware requirements – Easy to write a simpler compiler for stack architectures – Cons – Stack becomes the bottleneck – Little ability for parallelism or pipelining – Data is not always at the top of stack when need, so additional instructions like TOP and SWAP are needed – Difficult to write an optimizing compiler for stack architectures
  • 12. Accumulator Architectures  Instruction set: add A, sub A, mult A, div A, . . . load A, store A  Example: A*B - (A+C*B)  load B  mul C  add A  store D  load A  mul B  sub D B B*C A+B*C AA+B*C A*B result acc = acc +,-,*,/ mem[A]
  • 13. Accumulators: Pros and Cons ● Pros  Very low hardware requirements  Easy to design and understand ● Cons  Accumulator becomes the bottleneck  Little ability for parallelism or pipelining  High memory traffic
  • 14. Memory-Memory Architectures • Instruction set: (3 operands) add A, B, C sub A, B, C mul A, B, C (2 operands) add A, B sub A, B mul A, B • Example: A*B - (A+C*B) – 3 operands 2 operands – mul D, A, B mov D, A – mul E, C, B mul D, B – add E, A, E mov E, C – sub E, D, E mul E, B – add E, A – sub E, D
  • 15. Memory-Memory: Pros and Cons • Pros – Requires fewer instructions (especially if 3 operands) – Easy to write compilers for (especially if 3 operands) • Cons – Very high memory traffic (especially if 3 operands) – Variable number of clocks per instruction – With two operands, more data movements are required
  • 16. Register-Memory Architectures • Instruction set: add R1, A sub R1, A mul R1, B load R1, A store R1, A • Example: A*B - (A+C*B) load R1, A mul R1, B /* A*B */ store R1, D load R2, C mul R2, B /* C*B */ add R2, A /* A + CB */ sub R2, D /* AB - (A + C*B) */ R1 = R1 +,-,*,/ mem[B]
  • 17. Memory-Register: Pros and Cons ● Pros ● Some data can be accessed without loading first ● Instruction format easy to encode ● Good code density ● Cons ● Operands are not equivalent ● May limit number of registers
  • 18. Load-Store Architectures • Instruction set: add R1, R2, R3 sub R1, R2, R3 mul R1, R2, R3 load R1, &A store R1, &A move R1, R2 • Example: A*B - (A+C*B) load R1, &A load R2, &B load R3, &C mul R7, R3, R2 /* C*B */ add R8, R7, R1 /* A + C*B */ mul R9, R1, R2 /* A*B */ sub R10, R9, R8 /* A*B - (A+C*B) */ R3 = R1 +,-,*,/ R2
  • 19. Load-Store: Pros and Cons Pros ● Simple, fixed length instruction encodings ● Instructions take similar number of cycles ● Relatively easy to pipeline and make superscalar Cons ● Higher instruction count ● Not all instructions need three operands ● Dependent on good compiler
  • 20. + Classification of instructions 4-address instructions 3-address instructions 2-address instructions 1-address instructions 0-address instructions
  • 21. + Classification of instructions (continued…) The 4-address instruction specifies the two source operands, the destination operand and the address of the next instruction op code source 2destination next addresssource 1
  • 22. + Classification of instructions (continued…) A 3-address instruction specifies addresses for both operands as well as the result op code source 2destination source 1
  • 23. +Classification of instructions (continued…) A 2-address instruction overwrites one operand with the result One field serves two purposes op code destination source 1 source 2 • A 1-address instruction has a dedicated CPU register, called the accumulator, to hold one operand & the result –No address is needed to specify the accumulator op code source 2
  • 24. + Classification of instructions (continued…) A 0-address instruction uses a stack to hold both operands and the result. Operations are performed between the value on the top of the stack TOS) and the second value on the stack (SOS) and the result is stored on the TOS op code
  • 25. + Comparison of instruction formats As an example assume: that a single byte is used for the op code the size of the memory address space is 16 Mbytes a single addressable memory unit is a byte Size of operands is 24 bits Data bus size is 8 bits
  • 26. + Comparison of instruction formats We will use the following two parameters to compare the five instruction formats mentioned before Code size  Has an effect on the storage requirements Number of memory accesses  Has an effect on execution time
  • 27. + 4-address instruction Code size = 1+3+3+3+3 = 13 bytes No of bytes accessed from memory 13 bytes for instruction fetch + 6 bytes for source operand fetch + 3 bytes for storing destination operand Total = 22 bytes op code source 2destination next addresssource 1 1 byte 3 bytes 3 bytes 3 bytes3 bytes
  • 28. + 3-address instruction Code size = 1+3+3+3 = 10 bytes No of bytes accessed from memory 10 bytes for instruction fetch + 6 bytes for source operand fetch + 3 bytes for storing destination operand Total = 19 bytes 1 byte 3 bytes 3 bytes3 bytes op code source 2destination source 1
  • 29. + 2-address instruction Code size = 1+3+3 = 7 bytes No of bytes accessed from memory 7 bytes for instruction fetch + 6 bytes for source operand fetch + 3 bytes for storing destination operand Total = 16 bytes op code destination source 1 source 2 1 byte 3 bytes3 bytes
  • 30. + 1-address instruction Code size = 1+3= 4 bytes No of bytes accessed from memory 4 bytes for instruction fetch + 3 bytes for source operand fetch + 0 bytes for storing destination operand Total = 7 bytes 1 byte 3 bytes op code source 2
  • 31. + 0-address instruction Code size = 1= 1 bytes # of bytes accessed from memory 1 bytes for instruction fetch + 6 bytes for source operand fetch + 3 bytes for storing destination operand Total = 10 bytes 1 byte op code
  • 32. + Summary Instruction Format Code size Number of memory bytes 4-address instruction 13 22 3-address instruction 10 19 2-address instruction 7 16 1-address instruction 4 7 0-address instruction 1 10
  • 33. + Example 2.1 text expression evaluation a = (b+c)*d - e 3-Address 2-Address 1-Address 0-Address add a, b, c mpy a, a, d sub a, a, e load a, b add a, c mpy a, d sub a, e lda b add c mpy d sub e sta a push b push c add push d mpy push e sub pop a

Editor's Notes

  1. <number>
  2. <number>
  3. An instruction set, or instruction set architecture (ISA), is the part of the computer architecture related to programming, including the native data types, instructions, registers, addressing modes, memory architecture, interrupt and exception handling, and external I/O. An ISA includes a specification of the set of opcodes (machine language), and the native commands implemented by a particular processor
  4. Microprocessor without Interlocked Pipeline Stages
  5. A stack is a group of registers organized as a last-in-first-out (LIFO) structure. In such a structure, the operands stored first, through the push operation, can only be accessed last, through a pop operation; the order of access to the operands is reverse of the storage operation. An analogy of the stack is a “plate-dispenser” found in several self-service cafeterias. Arithmetic and logic operations successively pick operands from the top-ofthe-stack (TOS), and push the results on the TOS at the end of the operation. In stack based machines, operand addresses need not be specified during the arithmetic or logical operations. Therefore, these machines are also called 0-address machines
  6. Accumulator based machines use special registers called the accumulators to hold one source operand and also the result of the arithmetic or logic operations performed. Thus the accumulator registers collect (or „accumulate‟) data. Since the accumulator holds one of the operands, one more register may be required to hold the address of another operand. The accumulator is not used to hold an address. So accumulator based machines are also called 1-address machines. Accumulator machines employ a very small number of accumulator registers, generally only one. These machines were useful at the time when memory was quite expensive; as they used one register to hold the source operand as well as the result of the operation. However, now that the memory is relatively inexpensive, these are not considered very useful, a
  7. <number>
  8. <number> 4-address instructions are not very common because the next instruction to be executed is sequentially stored next to the current instruction in the memory. Therefore, specifying its address is redundant. Used in encoding microinstructions in a micro-coded control unit (to be studied later)
  9. <number> The address of the next instruction is in the PC
  10. <number> As you can see, the size of the instruction reduces when the addresses reduce. The length of each field will be much smaller for CPU registers as compared to memory locations because there are a lot more memory locations compared to CPU registers
  11. <number>
  12. <number> A single byte, or an 8-bit, op code can be used to encode up to 256 instructions. A 16-Mbyte memory address space will require 24-bit memory addresses. We will assume a byte wide memory organization to make this example different from the example in the book. The size of the address bus will be 24 bits and the size of the data bus will be 8-bits.
  13. <number>
  14. <number> There is no need to fetch the operand corresponding to the next instruction since it has been brought into the CPU during instruction fetch.
  15. <number>
  16. <number>
  17. <number>
  18. <number>