SlideShare a Scribd company logo
1 of 12
Download to read offline
1
High-level vs. Assembly language
Consider the following statements
1. a = x + y – z
2. if x > y
then x:= x + y
else x:= x - y
How does a processor execute these?
HLL (High Level Language) programs are machine
independent. They are easy to learn, easy to use,
and convenient for managing complex tasks.
Assembly language programs are machine
specific. It is the language that the processor
directly understands.
2
Understanding Assembly Language
Let us begin with data representation. How to
represent
• Signed integers
• Fractions
• Alphanumeric characters Review
• Floating point numbers
• Pictures?
Memory
0 1 0 0 1 0 1 1
1 1 0 1 1 0 1 0
1 00 1 1 0 0 0
0o00
Can you read
the contents
of these
memory
cells?
3
Visualizing instruction execution
(The main concept is register-transfer operation.
registers
Memory
0 x r0
1 y r1 ALU
2 z r2
3 a r3
Address data processor
A register is a fast storage within the CPU
load x into r1
load y into r2
a = x + y - z load z into r0
r3 ¨ r1 + r2
r0 ¨ r3 – r0
store r0 into a
500
24
-32
0
4
Assembly language instructions for a
hypothetical machine (not MIPS)
Load x, r1
Load y, r2
Load z, r0
Add r3, r1, r2
Sub r0, r3, r0
Store r0, a
Each processor has a different set of registers, and
different assembly language instructions. The assembly
language instructions of Intel Pentium and MIPS are
completely different.
Motorola 68000 has 16 registers r0-r15
MIPS has 32 registers r0-r31
Pentium has 8 general purpose & 6 segment registers.
5
Binary or Machine Language program
Both program and data are represented using
only 0’s and 1’s inside a computer. Here is a
sample:
0 31
Load address of x
0 31
Add r3 r1 r2 unused
These are instruction formats. Each instruction
has a specific format.
0 1 0 1 0 0 1 1 0 0 1 1 0 0 … 0 0 0
0
1 1 0 0 1 0 1 1 0 1 1 0
Operation
code
6
Can we distinguish program from data?
Both are bit strings.
Indistinguishable.
MEMORY
Normally, the programmer has to tell the machine
(or use some convention) to specify the address of
the first instruction. Incorrect specification will
lead to errors, and the program is most likely to
crash.
Program
Data
7
Bits, bytes, words
Bit: 0, 1
Byte: string of 8 bits. Each byte has an address.
Word: one or more bytes (usually 2 or 4 or 8).
0
1 word 0
2
3
4
5 word 1
6
7
01010000
11110000
0000000
11111111
00001111
10111011
00111100
00000111
8
0
4
8
12
Byte order in a word
Big Endian order [byte 0, byte 1, byte 2, byte 3]
Little Endian order [byte 3, byte2, byte 1, byte 0]
Word 0
Word 1
Word 2
Word 3
9
Registers vs. memory
Data can be stored in registers or memory
locations. Memory access is slower (takes
approximately 50 ns) than register access (takes
approximately 1 ns or less).
To increase the speed of computation it pays to
keep the variables in registers as long as possible.
However, due to technology limitations, the number
of registers is quite limited (typically 8-64).
MIPS registers
MIPS has 32 registers r0-r31. The conventional
use of these registers is as follows:
10
register assembly name Comment
r0
r1
r2-r3
r4-r7
r8-r15
r16-r23
r24-r25
r26-r27
r28
r29
r30
r31
$zero
$at
$v0-$v1
$a0-$a3
$t0-$t7
$s0-$s7
$t8-$t9
$k0-$k1
$gp
$sp
$fp
$ra
Always 0
Reserved for assembler
Stores results
Stores arguments
Temporaries, not saved
Contents saved for later use
More temporaries, not saved
Reserved by operating system
Global pointer
Stack pointer
Frame pointer
Return address
11
Example assembly language programs
Example 1 f = g + h – i
Assume that f, g, h, i are assigned to $s0, $s1, $s2, $s3
add $t0, $s1, $s2 # register $t0 contains g + h
sub $s0, $t0, $s3 # f = g + h – i
Example 2. g = h + A[8]
Assume that g, h are in $s1, $s2. A is an array of words,
the elements are stored in consecutive locations of the
memory. The base address is stored in $s3.
lw t0, 32($s3) # t0 gets A[8], 32= 4x 8
add $s1, $s2, $t0 # g = h + A[8]
12
Machine language representations
Instruction “add” belongs to the R-type format.
6 5 5 5 5 6
src src dst
add $s1, $s2, $t0 will be coded as
6 5 5 5 5 6
The function field is an extension of the opcode, and
they together determine the operation.
Note that “sub” has a similar format.
opcode rs rt rd shift amt function
0 18 8 17 0 32

More Related Content

What's hot

Instruction Set and Assembly Language Programming
Instruction Set and Assembly Language ProgrammingInstruction Set and Assembly Language Programming
Instruction Set and Assembly Language ProgrammingBrenda Debra
 
Register introduction
Register introductionRegister introduction
Register introductionmaamir farooq
 
Introduction to Python Part-1
Introduction to Python Part-1Introduction to Python Part-1
Introduction to Python Part-1Devashish Kumar
 
Compiler Construction | Lecture 15 | Memory Management
Compiler Construction | Lecture 15 | Memory ManagementCompiler Construction | Lecture 15 | Memory Management
Compiler Construction | Lecture 15 | Memory ManagementEelco Visser
 
Symbolic instructions for 8086 micro processor
Symbolic instructions for 8086 micro processorSymbolic instructions for 8086 micro processor
Symbolic instructions for 8086 micro processorSaurabh Mehta
 
Code Conversion in 8085 Microprocessor
Code Conversion in 8085 MicroprocessorCode Conversion in 8085 Microprocessor
Code Conversion in 8085 MicroprocessorMOHIT AGARWAL
 
Formatted input and output
Formatted input and outputFormatted input and output
Formatted input and outputOnline
 
Microprocessor instructions
Microprocessor instructionsMicroprocessor instructions
Microprocessor instructionshepzijustin
 
Lecture 03 Arithmetic Group of Instructions
Lecture 03 Arithmetic Group of InstructionsLecture 03 Arithmetic Group of Instructions
Lecture 03 Arithmetic Group of InstructionsZeeshan Ahmed
 
Lecture 02 Data Group of Instructions
Lecture 02 Data Group of InstructionsLecture 02 Data Group of Instructions
Lecture 02 Data Group of InstructionsZeeshan Ahmed
 

What's hot (20)

Instruction Set and Assembly Language Programming
Instruction Set and Assembly Language ProgrammingInstruction Set and Assembly Language Programming
Instruction Set and Assembly Language Programming
 
Register introduction
Register introductionRegister introduction
Register introduction
 
c++
c++c++
c++
 
Introduction to Python Part-1
Introduction to Python Part-1Introduction to Python Part-1
Introduction to Python Part-1
 
Functions class11 cbse_notes
Functions class11 cbse_notesFunctions class11 cbse_notes
Functions class11 cbse_notes
 
Standard Library Functions
Standard Library FunctionsStandard Library Functions
Standard Library Functions
 
Compiler Construction | Lecture 15 | Memory Management
Compiler Construction | Lecture 15 | Memory ManagementCompiler Construction | Lecture 15 | Memory Management
Compiler Construction | Lecture 15 | Memory Management
 
C Lecture
C LectureC Lecture
C Lecture
 
Symbolic instructions for 8086 micro processor
Symbolic instructions for 8086 micro processorSymbolic instructions for 8086 micro processor
Symbolic instructions for 8086 micro processor
 
Code Conversion in 8085 Microprocessor
Code Conversion in 8085 MicroprocessorCode Conversion in 8085 Microprocessor
Code Conversion in 8085 Microprocessor
 
PROCESSOR AND CONTROL UNIT
PROCESSOR AND CONTROL UNITPROCESSOR AND CONTROL UNIT
PROCESSOR AND CONTROL UNIT
 
Registers
RegistersRegisters
Registers
 
8
88
8
 
Formatted input and output
Formatted input and outputFormatted input and output
Formatted input and output
 
Ch9a
Ch9aCh9a
Ch9a
 
6
66
6
 
Ch9b
Ch9bCh9b
Ch9b
 
Microprocessor instructions
Microprocessor instructionsMicroprocessor instructions
Microprocessor instructions
 
Lecture 03 Arithmetic Group of Instructions
Lecture 03 Arithmetic Group of InstructionsLecture 03 Arithmetic Group of Instructions
Lecture 03 Arithmetic Group of Instructions
 
Lecture 02 Data Group of Instructions
Lecture 02 Data Group of InstructionsLecture 02 Data Group of Instructions
Lecture 02 Data Group of Instructions
 

Viewers also liked

Gatzke presentation
Gatzke presentationGatzke presentation
Gatzke presentationHeidi Gatzke
 
Assigment 3 it
Assigment 3 itAssigment 3 it
Assigment 3 itMona Bijan
 
Choosing Page Orientation
Choosing Page OrientationChoosing Page Orientation
Choosing Page Orientationcbuzz001
 
Hospitality PP Sheraton Presentation
Hospitality PP Sheraton PresentationHospitality PP Sheraton Presentation
Hospitality PP Sheraton PresentationTony Tamayo
 
News from Noise by Ms. Asha Phillips
News from Noise by Ms. Asha PhillipsNews from Noise by Ms. Asha Phillips
News from Noise by Ms. Asha Phillipswkwsci-research
 
Lati mengindeks kode decimal & terminal digit 2013
Lati mengindeks kode decimal & terminal digit 2013Lati mengindeks kode decimal & terminal digit 2013
Lati mengindeks kode decimal & terminal digit 2013Florencia Monica
 
Повышение эффективности бизнеса через дополнительные сервисы
Повышение эффективности бизнеса через дополнительные сервисыПовышение эффективности бизнеса через дополнительные сервисы
Повышение эффективности бизнеса через дополнительные сервисыEkaterina_1311
 
PHP Course in Kolkata
PHP Course in KolkataPHP Course in Kolkata
PHP Course in KolkataEjobIndia
 
Adjusting Fonts
Adjusting FontsAdjusting Fonts
Adjusting Fontscbuzz001
 
Mi trabajo de seminario 23
Mi trabajo de seminario 23Mi trabajo de seminario 23
Mi trabajo de seminario 23iriannyjimenez10
 
Veerendra_Patil_Technical_Skills_Details_
Veerendra_Patil_Technical_Skills_Details_Veerendra_Patil_Technical_Skills_Details_
Veerendra_Patil_Technical_Skills_Details_Veerendra Patil
 
Organizing the world of CQ rest infinitive possibilities by Arkadiusz Kita
Organizing the world of CQ rest infinitive possibilities by Arkadiusz KitaOrganizing the world of CQ rest infinitive possibilities by Arkadiusz Kita
Organizing the world of CQ rest infinitive possibilities by Arkadiusz KitaAEM HUB
 
Action weekly September`15
Action weekly September`15Action weekly September`15
Action weekly September`15inactionagency
 

Viewers also liked (19)

Gatzke presentation
Gatzke presentationGatzke presentation
Gatzke presentation
 
Assigment 3 it
Assigment 3 itAssigment 3 it
Assigment 3 it
 
HOSP PP
HOSP PPHOSP PP
HOSP PP
 
Choosing Page Orientation
Choosing Page OrientationChoosing Page Orientation
Choosing Page Orientation
 
Hospitality PP Sheraton Presentation
Hospitality PP Sheraton PresentationHospitality PP Sheraton Presentation
Hospitality PP Sheraton Presentation
 
october`15
october`15october`15
october`15
 
News from Noise by Ms. Asha Phillips
News from Noise by Ms. Asha PhillipsNews from Noise by Ms. Asha Phillips
News from Noise by Ms. Asha Phillips
 
AravindResume
AravindResumeAravindResume
AravindResume
 
Lati mengindeks kode decimal & terminal digit 2013
Lati mengindeks kode decimal & terminal digit 2013Lati mengindeks kode decimal & terminal digit 2013
Lati mengindeks kode decimal & terminal digit 2013
 
Повышение эффективности бизнеса через дополнительные сервисы
Повышение эффективности бизнеса через дополнительные сервисыПовышение эффективности бизнеса через дополнительные сервисы
Повышение эффективности бизнеса через дополнительные сервисы
 
august`15
august`15august`15
august`15
 
december`15
december`15december`15
december`15
 
PHP Course in Kolkata
PHP Course in KolkataPHP Course in Kolkata
PHP Course in Kolkata
 
Adjusting Fonts
Adjusting FontsAdjusting Fonts
Adjusting Fonts
 
Mi trabajo de seminario 23
Mi trabajo de seminario 23Mi trabajo de seminario 23
Mi trabajo de seminario 23
 
Veerendra_Patil_Technical_Skills_Details_
Veerendra_Patil_Technical_Skills_Details_Veerendra_Patil_Technical_Skills_Details_
Veerendra_Patil_Technical_Skills_Details_
 
Organizing the world of CQ rest infinitive possibilities by Arkadiusz Kita
Organizing the world of CQ rest infinitive possibilities by Arkadiusz KitaOrganizing the world of CQ rest infinitive possibilities by Arkadiusz Kita
Organizing the world of CQ rest infinitive possibilities by Arkadiusz Kita
 
Gimnazjum nr 2 w Kartuzach
Gimnazjum nr 2 w KartuzachGimnazjum nr 2 w Kartuzach
Gimnazjum nr 2 w Kartuzach
 
Action weekly September`15
Action weekly September`15Action weekly September`15
Action weekly September`15
 

Similar to Highlevel assemly

Lect05 Prog Model
Lect05 Prog ModelLect05 Prog Model
Lect05 Prog Modelanoosdomain
 
Systemsoftwarenotes 100929171256-phpapp02 2
Systemsoftwarenotes 100929171256-phpapp02 2Systemsoftwarenotes 100929171256-phpapp02 2
Systemsoftwarenotes 100929171256-phpapp02 2Khaja Dileef
 
Everybody be cool, this is a ROPpery
Everybody be cool, this is a ROPperyEverybody be cool, this is a ROPpery
Everybody be cool, this is a ROPperyVincenzo Iozzo
 
Computer architecture is made up of two main components the Instruct.docx
Computer architecture is made up of two main components the Instruct.docxComputer architecture is made up of two main components the Instruct.docx
Computer architecture is made up of two main components the Instruct.docxbrownliecarmella
 
Chapter 2 instructions language of the computer
Chapter 2 instructions language of the computerChapter 2 instructions language of the computer
Chapter 2 instructions language of the computerBATMUNHMUNHZAYA
 
W8_1: Intro to UoS Educational Processor
W8_1: Intro to UoS Educational ProcessorW8_1: Intro to UoS Educational Processor
W8_1: Intro to UoS Educational ProcessorDaniel Roggen
 
Introduction to debugging linux applications
Introduction to debugging linux applicationsIntroduction to debugging linux applications
Introduction to debugging linux applicationscommiebstrd
 
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 ProcessorDarling Jemima
 
Python introduction towards data science
Python introduction towards data sciencePython introduction towards data science
Python introduction towards data sciencedeepak teja
 
Chapter 1SyllabusCatalog Description Computer structu
Chapter 1SyllabusCatalog Description Computer structuChapter 1SyllabusCatalog Description Computer structu
Chapter 1SyllabusCatalog Description Computer structuEstelaJeffery653
 
microprocesser-140306112352-phpapp01.pdf
microprocesser-140306112352-phpapp01.pdfmicroprocesser-140306112352-phpapp01.pdf
microprocesser-140306112352-phpapp01.pdfPriyankaRana171346
 
Standardizing on a single N-dimensional array API for Python
Standardizing on a single N-dimensional array API for PythonStandardizing on a single N-dimensional array API for Python
Standardizing on a single N-dimensional array API for PythonRalf Gommers
 
Assembler Programming
Assembler ProgrammingAssembler Programming
Assembler ProgrammingOmar Sanchez
 
Computer Organization and 8085 microprocessor notes
Computer Organization and 8085 microprocessor notesComputer Organization and 8085 microprocessor notes
Computer Organization and 8085 microprocessor notesLakshmi Sarvani Videla
 
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 graphesAhmedMahjoub15
 

Similar to Highlevel assemly (20)

Lect05 Prog Model
Lect05 Prog ModelLect05 Prog Model
Lect05 Prog Model
 
Systemsoftwarenotes 100929171256-phpapp02 2
Systemsoftwarenotes 100929171256-phpapp02 2Systemsoftwarenotes 100929171256-phpapp02 2
Systemsoftwarenotes 100929171256-phpapp02 2
 
Everybody be cool, this is a ROPpery
Everybody be cool, this is a ROPperyEverybody be cool, this is a ROPpery
Everybody be cool, this is a ROPpery
 
Intro to assembly language
Intro to assembly languageIntro to assembly language
Intro to assembly language
 
Computer architecture is made up of two main components the Instruct.docx
Computer architecture is made up of two main components the Instruct.docxComputer architecture is made up of two main components the Instruct.docx
Computer architecture is made up of two main components the Instruct.docx
 
Chapter 2 instructions language of the computer
Chapter 2 instructions language of the computerChapter 2 instructions language of the computer
Chapter 2 instructions language of the computer
 
W8_1: Intro to UoS Educational Processor
W8_1: Intro to UoS Educational ProcessorW8_1: Intro to UoS Educational Processor
W8_1: Intro to UoS Educational Processor
 
Introduction to debugging linux applications
Introduction to debugging linux applicationsIntroduction to debugging linux applications
Introduction to debugging linux applications
 
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
 
C programming part2
C programming part2C programming part2
C programming part2
 
C programming part2
C programming part2C programming part2
C programming part2
 
C programming part2
C programming part2C programming part2
C programming part2
 
Python introduction towards data science
Python introduction towards data sciencePython introduction towards data science
Python introduction towards data science
 
Chapter 1SyllabusCatalog Description Computer structu
Chapter 1SyllabusCatalog Description Computer structuChapter 1SyllabusCatalog Description Computer structu
Chapter 1SyllabusCatalog Description Computer structu
 
microprocesser-140306112352-phpapp01.pdf
microprocesser-140306112352-phpapp01.pdfmicroprocesser-140306112352-phpapp01.pdf
microprocesser-140306112352-phpapp01.pdf
 
Standardizing on a single N-dimensional array API for Python
Standardizing on a single N-dimensional array API for PythonStandardizing on a single N-dimensional array API for Python
Standardizing on a single N-dimensional array API for Python
 
Assembler Programming
Assembler ProgrammingAssembler Programming
Assembler Programming
 
Computer Organization and 8085 microprocessor notes
Computer Organization and 8085 microprocessor notesComputer Organization and 8085 microprocessor notes
Computer Organization and 8085 microprocessor notes
 
Assembly Language
Assembly LanguageAssembly Language
Assembly Language
 
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
 

Recently uploaded

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 

Recently uploaded (20)

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 

Highlevel assemly

  • 1. 1 High-level vs. Assembly language Consider the following statements 1. a = x + y – z 2. if x > y then x:= x + y else x:= x - y How does a processor execute these? HLL (High Level Language) programs are machine independent. They are easy to learn, easy to use, and convenient for managing complex tasks. Assembly language programs are machine specific. It is the language that the processor directly understands.
  • 2. 2 Understanding Assembly Language Let us begin with data representation. How to represent • Signed integers • Fractions • Alphanumeric characters Review • Floating point numbers • Pictures? Memory 0 1 0 0 1 0 1 1 1 1 0 1 1 0 1 0 1 00 1 1 0 0 0 0o00 Can you read the contents of these memory cells?
  • 3. 3 Visualizing instruction execution (The main concept is register-transfer operation. registers Memory 0 x r0 1 y r1 ALU 2 z r2 3 a r3 Address data processor A register is a fast storage within the CPU load x into r1 load y into r2 a = x + y - z load z into r0 r3 ¨ r1 + r2 r0 ¨ r3 – r0 store r0 into a 500 24 -32 0
  • 4. 4 Assembly language instructions for a hypothetical machine (not MIPS) Load x, r1 Load y, r2 Load z, r0 Add r3, r1, r2 Sub r0, r3, r0 Store r0, a Each processor has a different set of registers, and different assembly language instructions. The assembly language instructions of Intel Pentium and MIPS are completely different. Motorola 68000 has 16 registers r0-r15 MIPS has 32 registers r0-r31 Pentium has 8 general purpose & 6 segment registers.
  • 5. 5 Binary or Machine Language program Both program and data are represented using only 0’s and 1’s inside a computer. Here is a sample: 0 31 Load address of x 0 31 Add r3 r1 r2 unused These are instruction formats. Each instruction has a specific format. 0 1 0 1 0 0 1 1 0 0 1 1 0 0 … 0 0 0 0 1 1 0 0 1 0 1 1 0 1 1 0 Operation code
  • 6. 6 Can we distinguish program from data? Both are bit strings. Indistinguishable. MEMORY Normally, the programmer has to tell the machine (or use some convention) to specify the address of the first instruction. Incorrect specification will lead to errors, and the program is most likely to crash. Program Data
  • 7. 7 Bits, bytes, words Bit: 0, 1 Byte: string of 8 bits. Each byte has an address. Word: one or more bytes (usually 2 or 4 or 8). 0 1 word 0 2 3 4 5 word 1 6 7 01010000 11110000 0000000 11111111 00001111 10111011 00111100 00000111
  • 8. 8 0 4 8 12 Byte order in a word Big Endian order [byte 0, byte 1, byte 2, byte 3] Little Endian order [byte 3, byte2, byte 1, byte 0] Word 0 Word 1 Word 2 Word 3
  • 9. 9 Registers vs. memory Data can be stored in registers or memory locations. Memory access is slower (takes approximately 50 ns) than register access (takes approximately 1 ns or less). To increase the speed of computation it pays to keep the variables in registers as long as possible. However, due to technology limitations, the number of registers is quite limited (typically 8-64). MIPS registers MIPS has 32 registers r0-r31. The conventional use of these registers is as follows:
  • 10. 10 register assembly name Comment r0 r1 r2-r3 r4-r7 r8-r15 r16-r23 r24-r25 r26-r27 r28 r29 r30 r31 $zero $at $v0-$v1 $a0-$a3 $t0-$t7 $s0-$s7 $t8-$t9 $k0-$k1 $gp $sp $fp $ra Always 0 Reserved for assembler Stores results Stores arguments Temporaries, not saved Contents saved for later use More temporaries, not saved Reserved by operating system Global pointer Stack pointer Frame pointer Return address
  • 11. 11 Example assembly language programs Example 1 f = g + h – i Assume that f, g, h, i are assigned to $s0, $s1, $s2, $s3 add $t0, $s1, $s2 # register $t0 contains g + h sub $s0, $t0, $s3 # f = g + h – i Example 2. g = h + A[8] Assume that g, h are in $s1, $s2. A is an array of words, the elements are stored in consecutive locations of the memory. The base address is stored in $s3. lw t0, 32($s3) # t0 gets A[8], 32= 4x 8 add $s1, $s2, $t0 # g = h + A[8]
  • 12. 12 Machine language representations Instruction “add” belongs to the R-type format. 6 5 5 5 5 6 src src dst add $s1, $s2, $t0 will be coded as 6 5 5 5 5 6 The function field is an extension of the opcode, and they together determine the operation. Note that “sub” has a similar format. opcode rs rt rd shift amt function 0 18 8 17 0 32