SlideShare uma empresa Scribd logo
1 de 26
Baixar para ler offline
ASSEMBLERS
Prof. S.J. Soni, SPCE, Visnagar
Design Specifications
 Identify the information necessary to perform a task
 Design a suitable data structure to record the
information
 Determine the processing necessary to obtain and
maintain the information
 Determine the processing necessary to perform the
task
Synthesis Phase
 MOVER BREG, ONE
 Address of the memory word with which name ONE is
associated (depends on source program, so it must be
made available by the analysis phase)
 Machine op codes corresponding to the mnemonic
MOVER (not depends on source program, it depends on
the assembly language)
 Use two data structures:
 Symbol Table (name, address) – build by analysis phase
 Mnemonic Table (mnemonic, opcode, length)
Analysis Phase
 The primary function is of building of the symbol
table.
 Concept of “Memory Allocation”
 To implement memory allocation a data structure
called location counter (LC) is used.
 The LC is always made to contain the address of the
next memory word in the target program.
 It is initialized to the constant specified in the START
statement.
 To update the contents of LC, analysis phase needs
to know lengths of different instructions.
Data structures of the assembler
Analysis
Phase
Synthesis
Phase
Mnemonic Opcode Length
ADD 01 1
SUB 02 1
Symbol Address
AGAIN 104
N 113
Mnemonic Table
Symbol Table
SP TP
Pass Structure of Assembler
 Two Pass Translation
 It can handle forward references easily.
 LC processing is performed in the first pass and symbol
defined in the program are entered into the symbol
table.
 The second pass synthesizes the target form using the
address information found in the symbol table.
 In effect, the first pass performs analysis of the source
program while the second pass performs synthesis of
the target program.
Two pass assembly
Pass I Pass II
SP TP
Intermediate Code
Data Structures
Pass Structure of Assembler
 Single Pass Translation
 LC processing and construction of the symbol table
proceeds as in two pass translation.
 The problem of forward references is tacked using a
process called “backpatching”
 The operand field of an instruction containing a
forward reference is left blank initially. The address of
the forward referenced symbol is put into this field
when its definition is encountered.
 MOVER BREG, ONE [ONE is forward reference]
 Table of Incomplete Instruction (TII)
Advanced Assembler Directives
 ORIGIN
 ORIGIN <address spec>
 Where <address spec> is an <operand spec> or
<constant>
 This directive indicates that LC should be set to the
address given by <address spec>.
 It is useful when the target program does not consist of
consecutive memory words.
Advanced Assembler Directives
 EQU
 <symbol> EQU <address spec>
 Where <address spec> is an <operand spec> or
<constant>
 It defines the symbol to represent <address spec>.
 LTORG
 It permits a programmer to specify where literals
should be placed.
 By default, assembler places it after the END statement
Literals
 At every LTORG statement, as also at the END statement, the
assembler allocates memory to the literals of a literal pool.
The pool contains all literals used in the program since the start
of the program or since the last LTORG statement.
Design of a Two Pass Assembler
 Tasks performed by the passes of a two pass
assembler are as follows:
 Pass I
 Separate the symbol, mnemonic opcode, operand fields
 Build the symbol table
 Perform LC processing
 Construct intermediate representation
 Pass II
 Synthesis the target program
Pass I of an assembler
 It uses the following data structures:
 OPTAB – A table of mnemonic opcodes and related
information
 SYMTAB – Symbol Table
 LITTAB – A table of literals used in the program
Data Structures of assembler Pass I
Algorithm- Assembler First Pass
Intermediate code for Imperative Statements
Variant I and Variant II
Variant I
Variant II
Comparison of the variants
Comparison of the variants
Comparison of the variants
Pass II of an assembler
Pass II of an assembler
 Tables
Pass II of an assembler
 Source Program and Intermediate Code

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Fundamentals of Language Processing
Fundamentals of Language ProcessingFundamentals of Language Processing
Fundamentals of Language Processing
 
Code optimization
Code optimizationCode optimization
Code optimization
 
Assemblers: Ch03
Assemblers: Ch03Assemblers: Ch03
Assemblers: Ch03
 
Code Optimization
Code OptimizationCode Optimization
Code Optimization
 
Unit 3 sp assembler
Unit 3 sp assemblerUnit 3 sp assembler
Unit 3 sp assembler
 
Code optimization in compiler design
Code optimization in compiler designCode optimization in compiler design
Code optimization in compiler design
 
Language processing activity
Language processing activityLanguage processing activity
Language processing activity
 
Spr ch-02
Spr ch-02Spr ch-02
Spr ch-02
 
Loaders ( system programming )
Loaders ( system programming ) Loaders ( system programming )
Loaders ( system programming )
 
Compiler Design Unit 4
Compiler Design Unit 4Compiler Design Unit 4
Compiler Design Unit 4
 
Ch 4 linker loader
Ch 4 linker loaderCh 4 linker loader
Ch 4 linker loader
 
Unit 4 sp macro
Unit 4 sp macroUnit 4 sp macro
Unit 4 sp macro
 
Peephole optimization techniques in compiler design
Peephole optimization techniques in compiler designPeephole optimization techniques in compiler design
Peephole optimization techniques in compiler design
 
Language for specifying lexical Analyzer
Language for specifying lexical AnalyzerLanguage for specifying lexical Analyzer
Language for specifying lexical Analyzer
 
MACRO PROCESSOR
MACRO PROCESSORMACRO PROCESSOR
MACRO PROCESSOR
 
Address resolution protocol (ARP)
Address resolution protocol (ARP)Address resolution protocol (ARP)
Address resolution protocol (ARP)
 
Overview of TCP IP
Overview of TCP IPOverview of TCP IP
Overview of TCP IP
 
Compiler construction tools
Compiler construction toolsCompiler construction tools
Compiler construction tools
 
Assembler
AssemblerAssembler
Assembler
 
Toy compiler
Toy compilerToy compiler
Toy compiler
 

Semelhante a assembler-ppt.pdf

Workshop Assembler
Workshop AssemblerWorkshop Assembler
Workshop Assembler
Tuhin_Das
 
Compilerdesignnew 091219090526-phpapp02
Compilerdesignnew 091219090526-phpapp02Compilerdesignnew 091219090526-phpapp02
Compilerdesignnew 091219090526-phpapp02
Anil Thakral
 

Semelhante a assembler-ppt.pdf (20)

First pass of assembler
First pass of assemblerFirst pass of assembler
First pass of assembler
 
Workshop Assembler
Workshop AssemblerWorkshop Assembler
Workshop Assembler
 
Handout#06
Handout#06Handout#06
Handout#06
 
Module-4 Program Design and Anyalysis.pdf
Module-4 Program Design and Anyalysis.pdfModule-4 Program Design and Anyalysis.pdf
Module-4 Program Design and Anyalysis.pdf
 
SPOS UNIT1 PPTS (1).pptx
SPOS UNIT1 PPTS (1).pptxSPOS UNIT1 PPTS (1).pptx
SPOS UNIT1 PPTS (1).pptx
 
Concept of compiler in details
Concept of compiler in detailsConcept of compiler in details
Concept of compiler in details
 
microprocessor
 microprocessor microprocessor
microprocessor
 
Chapter#01 cc
Chapter#01 ccChapter#01 cc
Chapter#01 cc
 
Compiler Design(Nanthu)
Compiler Design(Nanthu)Compiler Design(Nanthu)
Compiler Design(Nanthu)
 
Compiler Design(NANTHU NOTES)
Compiler Design(NANTHU NOTES)Compiler Design(NANTHU NOTES)
Compiler Design(NANTHU NOTES)
 
Compilerdesignnew 091219090526-phpapp02
Compilerdesignnew 091219090526-phpapp02Compilerdesignnew 091219090526-phpapp02
Compilerdesignnew 091219090526-phpapp02
 
Examinable Question and answer system programming
Examinable Question and answer system programmingExaminable Question and answer system programming
Examinable Question and answer system programming
 
Introduction to Assembly Language
Introduction to Assembly Language Introduction to Assembly Language
Introduction to Assembly Language
 
Lexical analyzer
Lexical analyzerLexical analyzer
Lexical analyzer
 
Ss ui lecture 2
Ss ui lecture 2Ss ui lecture 2
Ss ui lecture 2
 
Handout#07
Handout#07Handout#07
Handout#07
 
System software 5th unit
System software 5th unitSystem software 5th unit
System software 5th unit
 
SSD Mod 2 -18CS61_Notes.pdf
SSD Mod 2 -18CS61_Notes.pdfSSD Mod 2 -18CS61_Notes.pdf
SSD Mod 2 -18CS61_Notes.pdf
 
Chapter1pdf__2021_11_23_10_53_20.pdf
Chapter1pdf__2021_11_23_10_53_20.pdfChapter1pdf__2021_11_23_10_53_20.pdf
Chapter1pdf__2021_11_23_10_53_20.pdf
 
SP Solutions -Adi.pdf
SP Solutions -Adi.pdfSP Solutions -Adi.pdf
SP Solutions -Adi.pdf
 

Último

Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdfPests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
PirithiRaju
 
Seismic Method Estimate velocity from seismic data.pptx
Seismic Method Estimate velocity from seismic  data.pptxSeismic Method Estimate velocity from seismic  data.pptx
Seismic Method Estimate velocity from seismic data.pptx
AlMamun560346
 
Introduction,importance and scope of horticulture.pptx
Introduction,importance and scope of horticulture.pptxIntroduction,importance and scope of horticulture.pptx
Introduction,importance and scope of horticulture.pptx
Bhagirath Gogikar
 
Formation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disksFormation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disks
Sérgio Sacani
 

Último (20)

module for grade 9 for distance learning
module for grade 9 for distance learningmodule for grade 9 for distance learning
module for grade 9 for distance learning
 
Call Girls Alandi Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Alandi Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Alandi Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Alandi Call Me 7737669865 Budget Friendly No Advance Booking
 
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdfPests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
 
FAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
FAIRSpectra - Enabling the FAIRification of Spectroscopy and SpectrometryFAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
FAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
 
PSYCHOSOCIAL NEEDS. in nursing II sem pptx
PSYCHOSOCIAL NEEDS. in nursing II sem pptxPSYCHOSOCIAL NEEDS. in nursing II sem pptx
PSYCHOSOCIAL NEEDS. in nursing II sem pptx
 
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑
 
GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)
 
pumpkin fruit fly, water melon fruit fly, cucumber fruit fly
pumpkin fruit fly, water melon fruit fly, cucumber fruit flypumpkin fruit fly, water melon fruit fly, cucumber fruit fly
pumpkin fruit fly, water melon fruit fly, cucumber fruit fly
 
Seismic Method Estimate velocity from seismic data.pptx
Seismic Method Estimate velocity from seismic  data.pptxSeismic Method Estimate velocity from seismic  data.pptx
Seismic Method Estimate velocity from seismic data.pptx
 
Introduction,importance and scope of horticulture.pptx
Introduction,importance and scope of horticulture.pptxIntroduction,importance and scope of horticulture.pptx
Introduction,importance and scope of horticulture.pptx
 
Kochi ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Kochi ESCORT SERVICE❤CALL GIRL
Kochi ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Kochi ESCORT SERVICE❤CALL GIRLKochi ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Kochi ESCORT SERVICE❤CALL GIRL
Kochi ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Kochi ESCORT SERVICE❤CALL GIRL
 
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticsPulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
 
SAMASTIPUR CALL GIRL 7857803690 LOW PRICE ESCORT SERVICE
SAMASTIPUR CALL GIRL 7857803690  LOW PRICE  ESCORT SERVICESAMASTIPUR CALL GIRL 7857803690  LOW PRICE  ESCORT SERVICE
SAMASTIPUR CALL GIRL 7857803690 LOW PRICE ESCORT SERVICE
 
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 60009654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
 
Feature-aligned N-BEATS with Sinkhorn divergence (ICLR '24)
Feature-aligned N-BEATS with Sinkhorn divergence (ICLR '24)Feature-aligned N-BEATS with Sinkhorn divergence (ICLR '24)
Feature-aligned N-BEATS with Sinkhorn divergence (ICLR '24)
 
Formation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disksFormation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disks
 
IDENTIFICATION OF THE LIVING- forensic medicine
IDENTIFICATION OF THE LIVING- forensic medicineIDENTIFICATION OF THE LIVING- forensic medicine
IDENTIFICATION OF THE LIVING- forensic medicine
 
STS-UNIT 4 CLIMATE CHANGE POWERPOINT PRESENTATION
STS-UNIT 4 CLIMATE CHANGE POWERPOINT PRESENTATIONSTS-UNIT 4 CLIMATE CHANGE POWERPOINT PRESENTATION
STS-UNIT 4 CLIMATE CHANGE POWERPOINT PRESENTATION
 
Factory Acceptance Test( FAT).pptx .
Factory Acceptance Test( FAT).pptx       .Factory Acceptance Test( FAT).pptx       .
Factory Acceptance Test( FAT).pptx .
 
Forensic Biology & Its biological significance.pdf
Forensic Biology & Its biological significance.pdfForensic Biology & Its biological significance.pdf
Forensic Biology & Its biological significance.pdf
 

assembler-ppt.pdf

  • 2. Design Specifications  Identify the information necessary to perform a task  Design a suitable data structure to record the information  Determine the processing necessary to obtain and maintain the information  Determine the processing necessary to perform the task
  • 3. Synthesis Phase  MOVER BREG, ONE  Address of the memory word with which name ONE is associated (depends on source program, so it must be made available by the analysis phase)  Machine op codes corresponding to the mnemonic MOVER (not depends on source program, it depends on the assembly language)  Use two data structures:  Symbol Table (name, address) – build by analysis phase  Mnemonic Table (mnemonic, opcode, length)
  • 4. Analysis Phase  The primary function is of building of the symbol table.  Concept of “Memory Allocation”  To implement memory allocation a data structure called location counter (LC) is used.  The LC is always made to contain the address of the next memory word in the target program.  It is initialized to the constant specified in the START statement.  To update the contents of LC, analysis phase needs to know lengths of different instructions.
  • 5. Data structures of the assembler Analysis Phase Synthesis Phase Mnemonic Opcode Length ADD 01 1 SUB 02 1 Symbol Address AGAIN 104 N 113 Mnemonic Table Symbol Table SP TP
  • 6. Pass Structure of Assembler  Two Pass Translation  It can handle forward references easily.  LC processing is performed in the first pass and symbol defined in the program are entered into the symbol table.  The second pass synthesizes the target form using the address information found in the symbol table.  In effect, the first pass performs analysis of the source program while the second pass performs synthesis of the target program.
  • 7. Two pass assembly Pass I Pass II SP TP Intermediate Code Data Structures
  • 8. Pass Structure of Assembler  Single Pass Translation  LC processing and construction of the symbol table proceeds as in two pass translation.  The problem of forward references is tacked using a process called “backpatching”  The operand field of an instruction containing a forward reference is left blank initially. The address of the forward referenced symbol is put into this field when its definition is encountered.  MOVER BREG, ONE [ONE is forward reference]  Table of Incomplete Instruction (TII)
  • 9. Advanced Assembler Directives  ORIGIN  ORIGIN <address spec>  Where <address spec> is an <operand spec> or <constant>  This directive indicates that LC should be set to the address given by <address spec>.  It is useful when the target program does not consist of consecutive memory words.
  • 10. Advanced Assembler Directives  EQU  <symbol> EQU <address spec>  Where <address spec> is an <operand spec> or <constant>  It defines the symbol to represent <address spec>.  LTORG  It permits a programmer to specify where literals should be placed.  By default, assembler places it after the END statement
  • 11. Literals  At every LTORG statement, as also at the END statement, the assembler allocates memory to the literals of a literal pool. The pool contains all literals used in the program since the start of the program or since the last LTORG statement.
  • 12.
  • 13. Design of a Two Pass Assembler  Tasks performed by the passes of a two pass assembler are as follows:  Pass I  Separate the symbol, mnemonic opcode, operand fields  Build the symbol table  Perform LC processing  Construct intermediate representation  Pass II  Synthesis the target program
  • 14. Pass I of an assembler  It uses the following data structures:  OPTAB – A table of mnemonic opcodes and related information  SYMTAB – Symbol Table  LITTAB – A table of literals used in the program
  • 15. Data Structures of assembler Pass I
  • 17.
  • 18. Intermediate code for Imperative Statements Variant I and Variant II
  • 21. Comparison of the variants
  • 22. Comparison of the variants
  • 23. Comparison of the variants
  • 24. Pass II of an assembler
  • 25. Pass II of an assembler  Tables
  • 26. Pass II of an assembler  Source Program and Intermediate Code