SlideShare uma empresa Scribd logo
1 de 21
Computer Architecture
and Organization
Instructor: Col Dr. Khawar Mehmood
You can revolutionize the way computers are built, if you understand both the
hardware and the software and change each accordingly
Introduction
‱ Why Do We Have Computers?
‱ To Solve Problems
‱ How Does a Computer Solve Problems?
‱ Orchestrating Electrons
‱ How Do Problems Get Solved by Electrons?
Introduction - The Transformation Hierarchy
Micro-architecture
SW/HW Interface
Program/Language
Algorithm
Problem
Logic
Devices
System Software
Electrons
Computer Architecture
(narrow view)
Computer Architecture
(expanded view)
Computer Organization
vs.
Architecture
Computer Architecture vs. Organization
‱ Architecture:
—Logical aspects of computer hardware that are
visible to the programmer
– What instruction a computer understands!
– Instruction Set Architecture (ISA)
—Example: Architectural design issue is
whether a computer will have multiply
instruction or not.
5
Computer Organization vs. Architecture
‱ Organization:
—Physical aspects of computer hardware that
are invisible to the programmer
– How does the computer hardware carries out
instructions!
– Hardware details are transparent to the programmer
—For Example: Is there a special hardware
multiply unit for multiplication operation or is
it done by repeated addition?
6
7
Concept of the ISA
‱ ISA stands for Instruction Set Architecture,
and it could be viewed as a model for the
computer
‱ It includes the instruction set, memory space
and all the programmer-accessible registers
‱ It serves as the interface between the
program and the functional units of the
computer
Types of Computer Architectures
‱ Microcontrollers generally use two types of
Architecture.
—Von Neumann Architecture
—Harvard Architecture
8
Types of Computer Architectures
9
Differences
Von Neumann Harvard
Single Memory to be shared by
both code and data
Separate Memory for code and
data
Need two clock cycles to fetch
instruction and data
Single clock cycle is sufficient to
fetch instruction and data
Simple in design – requires less
hardware components
Complex in design
Types of Computer Architectures
10
Von Neumann CPU
Data
Instructions Data / Instruction Bus
Address Bus
Control Bus
Memory
Types of Computer Architectures
11
Harvard CPU
Instructions
Memory
Data
Memory
Instruction Bus
Address Bus
Control Bus
Data Bus
Address Bus
Control Bus
Why Learn Assembly
Language?
Why to learn Assembly Language
Why to learn Assembly Language
‱ There is a general impression that assembly
language is difficult to learn
‱ In fact if you are not an expert, you will learn
assembly language quickly, as non-experts see
things with simplicity and the basic beauty of
assembly language is that it is exceptionally
simple.
‱ Do not ever try to find a complication, as one will
not be there.
‱ In assembly language what is written in the
program is all that is there, no less and no more.
15
Why to learn Assembly Language
‱ Assembly language commands are a symbolic
representation of machine language commands
using “English like” keywords called “mnemonics”
‱ Using assembly language commands, its much
easier to program as compared to machine
language in the form of long strings of 1s and 0s
‱ Commands in assembly language have a one-to-
one correspondence with machine language
commands
16
Example
‱ Some assembly language instructions of the
x86 family of computers and their equivalent
machine language instructions
Assembly
Language
Machine Language
(Binary)
Machine
Language
(Hex)
Instruction
type
add cx, dx 0000 0001 1101 0001 01 D1 Arithmetic
mov alx, 34h 1011 1000 0011 0100 0000 0000 B8 34 00 Data transfer
xor ax, bx 0011 0001 1101 1000 31 D8 Logic
jmp alpha 1110 1011 1111 1100 EB FC Control
Why to learn Assembly Language
‱ Why should we learn assembly language when
there are higher level languages one better than
the other
—A translator translating from English to Japanese
—Think about a three-color picture scanned at 300 dots per inch
making 90000 pixels per square inch.
—Now a processing on this picture requires 270000 operations
per square inch, one operation for each color of each pixel.
—A few extra instructions placed by the translator can cost hours
of extra time.
—The only way to optimize this is to do it directly in assembly
language.
—IMPORTANT: This doesn’t mean that the whole application has
to be written in assembly language, which is almost never the
case. It’s only the performance critical part that is coded in
assembly language to save few extra cycles that matter at that
Why to learn Assembly Language
‱ Time Critical / Real time systems
—Real time systems have time bound responses
—For such precise timing requirement, we must keep
the instructions in our total control.
—In higher level languages we cannot even tell how
many computer instructions were actually used
—In assembly language we have precise control over
them
‱ No assembly language, no optimization
‱ Sometimes a useful application becomes
useless just because it is not optimized
Why to learn Assembly Language
‱ For reverse engineering –
—taking malware and figuring out what it does
‱ Vulnerability research
—Taking a program and finding flaws in it
‱ Exploit crafting
—Writing code to take advantage of a flaw in a program
‱ Some types of forensics, memory forensics in
particular
—Figuring out what happened during a cyber attack
‱ And many more.
Machine Language vs Assembly Language
Machine Language Assembly Language
Only understandable by the computers.
only understandable by humans not by
computers.
Represented in binary format(0s and 1s)
Represented with mnemonics such as Mov,
Add, Sub etc.
Difficult to understand by human beings. Easy to understand by the human being.
Error fixing is almost impossible
Error fixing can be done in assembly
language.
Difficult to memorize so difficult to learn
Easy to memorize (mnemonics) thus easy
to learn
Execution is fast as all data is already in
0s and 1s
Execution is slow as compared to machine
language.
There is no need of translator Assembler is used as translator
Machine language is hardware
dependent.
Assembly language is the machine
dependent and it is not portable.
computer architecture and organization.ppt

Mais conteĂșdo relacionado

Semelhante a computer architecture and organization.ppt

Introduction to computer programming
Introduction to computer programming Introduction to computer programming
Introduction to computer programming VanessaBuensalida
 
what is assembly language by faisal shahzad
what is assembly language by faisal shahzadwhat is assembly language by faisal shahzad
what is assembly language by faisal shahzadFaisal Shehzad
 
programming.pptx
programming.pptxprogramming.pptx
programming.pptxDarianElmyra
 
Assembly Langauge Assembly Langauge Assembly Langauge
Assembly Langauge Assembly Langauge Assembly LangaugeAssembly Langauge Assembly Langauge Assembly Langauge
Assembly Langauge Assembly Langauge Assembly Langaugemustafkhalid
 
Embedded programming Embedded programming (1).pptx
Embedded programming Embedded programming (1).pptxEmbedded programming Embedded programming (1).pptx
Embedded programming Embedded programming (1).pptxlematadese670
 
Programming languages,compiler,interpreter,softwares
Programming languages,compiler,interpreter,softwaresProgramming languages,compiler,interpreter,softwares
Programming languages,compiler,interpreter,softwaresNisarg Amin
 
introduction to assembly language by Faisal Shehzad
introduction to assembly language by Faisal Shehzadintroduction to assembly language by Faisal Shehzad
introduction to assembly language by Faisal ShehzadFaisal Shehzad
 
introduction to assembly language.
introduction to assembly language.introduction to assembly language.
introduction to assembly language.Faisal Shehzad
 
Programming languages.pptx
Programming languages.pptxProgramming languages.pptx
Programming languages.pptxChrist Association
 
Ch0 computer systems overview
Ch0 computer systems overviewCh0 computer systems overview
Ch0 computer systems overviewAboubakarIbrahima
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & LanguagesGaditek
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & LanguagesGaditek
 
Assembly language
Assembly languageAssembly language
Assembly languageArafat Hossan
 
Problem Solving and Program Design in C_1.pdf
Problem Solving and Program Design in C_1.pdfProblem Solving and Program Design in C_1.pdf
Problem Solving and Program Design in C_1.pdfjlu08167
 

Semelhante a computer architecture and organization.ppt (20)

sege.pdf
sege.pdfsege.pdf
sege.pdf
 
Introduction to computer programming
Introduction to computer programming Introduction to computer programming
Introduction to computer programming
 
what is assembly language by faisal shahzad
what is assembly language by faisal shahzadwhat is assembly language by faisal shahzad
what is assembly language by faisal shahzad
 
programming.pptx
programming.pptxprogramming.pptx
programming.pptx
 
Introduction to Computer Programming
Introduction to Computer ProgrammingIntroduction to Computer Programming
Introduction to Computer Programming
 
Assembly Langauge Assembly Langauge Assembly Langauge
Assembly Langauge Assembly Langauge Assembly LangaugeAssembly Langauge Assembly Langauge Assembly Langauge
Assembly Langauge Assembly Langauge Assembly Langauge
 
Language processors
Language processorsLanguage processors
Language processors
 
Embedded programming Embedded programming (1).pptx
Embedded programming Embedded programming (1).pptxEmbedded programming Embedded programming (1).pptx
Embedded programming Embedded programming (1).pptx
 
Programming languages,compiler,interpreter,softwares
Programming languages,compiler,interpreter,softwaresProgramming languages,compiler,interpreter,softwares
Programming languages,compiler,interpreter,softwares
 
introduction to assembly language by Faisal Shehzad
introduction to assembly language by Faisal Shehzadintroduction to assembly language by Faisal Shehzad
introduction to assembly language by Faisal Shehzad
 
introduction to assembly language.
introduction to assembly language.introduction to assembly language.
introduction to assembly language.
 
System softare
System softareSystem softare
System softare
 
Programming languages.pptx
Programming languages.pptxProgramming languages.pptx
Programming languages.pptx
 
Ch0 computer systems overview
Ch0 computer systems overviewCh0 computer systems overview
Ch0 computer systems overview
 
Csc240 lecture 1
Csc240   lecture 1Csc240   lecture 1
Csc240 lecture 1
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
 
Programming Paradigm & Languages
Programming Paradigm & LanguagesProgramming Paradigm & Languages
Programming Paradigm & Languages
 
Assembly language
Assembly languageAssembly language
Assembly language
 
Problem Solving and Program Design in C_1.pdf
Problem Solving and Program Design in C_1.pdfProblem Solving and Program Design in C_1.pdf
Problem Solving and Program Design in C_1.pdf
 
01CHAP_1.PPT
01CHAP_1.PPT01CHAP_1.PPT
01CHAP_1.PPT
 

Último

Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 

Último (20)

Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

computer architecture and organization.ppt

  • 1. Computer Architecture and Organization Instructor: Col Dr. Khawar Mehmood You can revolutionize the way computers are built, if you understand both the hardware and the software and change each accordingly
  • 2. Introduction ‱ Why Do We Have Computers? ‱ To Solve Problems ‱ How Does a Computer Solve Problems? ‱ Orchestrating Electrons ‱ How Do Problems Get Solved by Electrons?
  • 3. Introduction - The Transformation Hierarchy Micro-architecture SW/HW Interface Program/Language Algorithm Problem Logic Devices System Software Electrons Computer Architecture (narrow view) Computer Architecture (expanded view)
  • 5. Computer Architecture vs. Organization ‱ Architecture: —Logical aspects of computer hardware that are visible to the programmer – What instruction a computer understands! – Instruction Set Architecture (ISA) —Example: Architectural design issue is whether a computer will have multiply instruction or not. 5
  • 6. Computer Organization vs. Architecture ‱ Organization: —Physical aspects of computer hardware that are invisible to the programmer – How does the computer hardware carries out instructions! – Hardware details are transparent to the programmer —For Example: Is there a special hardware multiply unit for multiplication operation or is it done by repeated addition? 6
  • 7. 7 Concept of the ISA ‱ ISA stands for Instruction Set Architecture, and it could be viewed as a model for the computer ‱ It includes the instruction set, memory space and all the programmer-accessible registers ‱ It serves as the interface between the program and the functional units of the computer
  • 8. Types of Computer Architectures ‱ Microcontrollers generally use two types of Architecture. —Von Neumann Architecture —Harvard Architecture 8
  • 9. Types of Computer Architectures 9 Differences Von Neumann Harvard Single Memory to be shared by both code and data Separate Memory for code and data Need two clock cycles to fetch instruction and data Single clock cycle is sufficient to fetch instruction and data Simple in design – requires less hardware components Complex in design
  • 10. Types of Computer Architectures 10 Von Neumann CPU Data Instructions Data / Instruction Bus Address Bus Control Bus Memory
  • 11. Types of Computer Architectures 11 Harvard CPU Instructions Memory Data Memory Instruction Bus Address Bus Control Bus Data Bus Address Bus Control Bus
  • 13. Why to learn Assembly Language
  • 14. Why to learn Assembly Language ‱ There is a general impression that assembly language is difficult to learn ‱ In fact if you are not an expert, you will learn assembly language quickly, as non-experts see things with simplicity and the basic beauty of assembly language is that it is exceptionally simple. ‱ Do not ever try to find a complication, as one will not be there. ‱ In assembly language what is written in the program is all that is there, no less and no more.
  • 15. 15 Why to learn Assembly Language ‱ Assembly language commands are a symbolic representation of machine language commands using “English like” keywords called “mnemonics” ‱ Using assembly language commands, its much easier to program as compared to machine language in the form of long strings of 1s and 0s ‱ Commands in assembly language have a one-to- one correspondence with machine language commands
  • 16. 16 Example ‱ Some assembly language instructions of the x86 family of computers and their equivalent machine language instructions Assembly Language Machine Language (Binary) Machine Language (Hex) Instruction type add cx, dx 0000 0001 1101 0001 01 D1 Arithmetic mov alx, 34h 1011 1000 0011 0100 0000 0000 B8 34 00 Data transfer xor ax, bx 0011 0001 1101 1000 31 D8 Logic jmp alpha 1110 1011 1111 1100 EB FC Control
  • 17. Why to learn Assembly Language ‱ Why should we learn assembly language when there are higher level languages one better than the other —A translator translating from English to Japanese —Think about a three-color picture scanned at 300 dots per inch making 90000 pixels per square inch. —Now a processing on this picture requires 270000 operations per square inch, one operation for each color of each pixel. —A few extra instructions placed by the translator can cost hours of extra time. —The only way to optimize this is to do it directly in assembly language. —IMPORTANT: This doesn’t mean that the whole application has to be written in assembly language, which is almost never the case. It’s only the performance critical part that is coded in assembly language to save few extra cycles that matter at that
  • 18. Why to learn Assembly Language ‱ Time Critical / Real time systems —Real time systems have time bound responses —For such precise timing requirement, we must keep the instructions in our total control. —In higher level languages we cannot even tell how many computer instructions were actually used —In assembly language we have precise control over them ‱ No assembly language, no optimization ‱ Sometimes a useful application becomes useless just because it is not optimized
  • 19. Why to learn Assembly Language ‱ For reverse engineering – —taking malware and figuring out what it does ‱ Vulnerability research —Taking a program and finding flaws in it ‱ Exploit crafting —Writing code to take advantage of a flaw in a program ‱ Some types of forensics, memory forensics in particular —Figuring out what happened during a cyber attack ‱ And many more.
  • 20. Machine Language vs Assembly Language Machine Language Assembly Language Only understandable by the computers. only understandable by humans not by computers. Represented in binary format(0s and 1s) Represented with mnemonics such as Mov, Add, Sub etc. Difficult to understand by human beings. Easy to understand by the human being. Error fixing is almost impossible Error fixing can be done in assembly language. Difficult to memorize so difficult to learn Easy to memorize (mnemonics) thus easy to learn Execution is fast as all data is already in 0s and 1s Execution is slow as compared to machine language. There is no need of translator Assembler is used as translator Machine language is hardware dependent. Assembly language is the machine dependent and it is not portable.