SlideShare a Scribd company logo
A.S.PrabaharanAP/CSE
UNIT I MIPS Addressing
Addressing in Branches and Jumps
 The MIPS jump instructions have the simplest addressing.
 They use the final MIPS instruction format, called the J-type,
which consists of 6 bits for the operation field and the rest of the
bits for the address field.
 j 10000 # go to location 10000
 where the value of the jump opcode is 2 and the jump address is
10000.
 Unlike the jump instruction, the conditional branch instruction
must specify two operands in addition to the branch address.
 bne $s0,$s1,Exit # go to Exit if $s0 ≠ $s1
 branch instruction would calculate the following:
 Program counter Register Branch address
 PC-relative addressing
 Showing Branch Offset in Machine Language
 The while loop as compiled into this MIPS assembler code:
 Loop:sll $t1,$s3,2 #Temp reg $t1 = 4 * i
 add $t1,$t1,$s6 # $t1 = address of save[i]
 lw $t0,0($t1) #Temp reg $t0 = save[i]
 bne $t0,$s5, Exit # go to Exit if save[i] ≠ k
 addi $s3,$s3,1 # i = i + 1
 j Loop # go to Loop
 Exit:
 If we assume we place the loop starting at location 80000 in
memory, what is the MIPS machine code for this loop?
 The assembled instructions and their addresses are:
MIPS Addressing Mode
 Addressing mode One of several addressing regimes delimited by
their varied use of operands and/or addresses.
 1. Immediate addressing, where the operand is a constant within
the instruction itself
 2. Register addressing, where the operand is a register
 3. Base or displacement addressing, where the operand is at the
memory location whose address is the sum of a register and a
constant in the instruction
 4. PC-relative addressing, where the branch address is the sum of
the PC and a constant in the instruction
 5. Pseudo direct addressing, where the jump address is the 26
bits of the instruction concatenated with the upper bits of the PC
What is the Addressing Mode
 Add $s0,$s1,5
 A. Register addressing
 B. Immediate addressing
 C. Base addressing
 D. PC-relative addressing
 Ans:B
What is the Addressing Mode
 Add $s0,$s1,$s2
 A. Register addressing
 B. Immediate addressing
 C. Base addressing
 D. PC-relative addressing
 Ans:A
What is the Addressing Mode
 Lw $t0,32(s3)
 A. Register addressing
 B. Immediate addressing
 C. Base addressing
 D. PC-relative addressing
 Ans:C
What is the Addressing Mode
 beq $t0,$3,Label
 A. Register addressing
 B. Immediate addressing
 C. Base addressing
 D. PC-relative addressing
 Ans:D
What is the Addressing Mode
 J 2000
 A. Register addressing
 B. Immediate addressing
 C. Base addressing
 D. PC-relative addressing
 E. Pseudo direct Addressing
 Ans:E

More Related Content

What's hot

Presentation(intermediate code generation)
Presentation(intermediate code generation)Presentation(intermediate code generation)
Presentation(intermediate code generation)
Sourov Kumar Ron
 
Displacement addressing
Displacement addressingDisplacement addressing
Displacement addressing
Rajon
 
instruction format and addressing modes
instruction format and addressing modesinstruction format and addressing modes
instruction format and addressing modes
RamaPrabha24
 
Back patching
Back patchingBack patching
Back patching
santhiya thavanthi
 
Instruction set-of-8086
Instruction set-of-8086Instruction set-of-8086
Instruction set-of-8086
mudulin
 
COMPILER DESIGN AND CONSTRUCTION
COMPILER DESIGN AND CONSTRUCTIONCOMPILER DESIGN AND CONSTRUCTION
COMPILER DESIGN AND CONSTRUCTION
Anil Pokhrel
 
Addressing modes ppt
Addressing modes pptAddressing modes ppt
Addressing modes ppt
sanjay pachauri
 
Compiler Design - Ambiguous grammar, LMD & RMD, Infix & Postfix, Implementati...
Compiler Design - Ambiguous grammar, LMD & RMD, Infix & Postfix, Implementati...Compiler Design - Ambiguous grammar, LMD & RMD, Infix & Postfix, Implementati...
Compiler Design - Ambiguous grammar, LMD & RMD, Infix & Postfix, Implementati...
Saikrishna Tanguturu
 
ADDRESSING MODE
ADDRESSING MODEADDRESSING MODE
ADDRESSING MODE
Anika Shahabuddin
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
Asif Iqbal
 
Instruction set (prasenjit dey)
Instruction set (prasenjit dey)Instruction set (prasenjit dey)
Instruction set (prasenjit dey)
Prasenjit Dey
 
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
 
Optimization of basic blocks
Optimization of basic blocksOptimization of basic blocks
Optimization of basic blocks
ishwarya516
 
Intermediate code generation
Intermediate code generationIntermediate code generation
Intermediate code generation
Akshaya Arunan
 
Translation of expression(copmiler construction)
Translation of expression(copmiler construction)Translation of expression(copmiler construction)
Translation of expression(copmiler construction)
IrtazaAfzal3
 
Addressing modes
Addressing  modesAddressing  modes
Addressing modes
lalithambiga kamaraj
 
Computer architecture instruction formats
Computer architecture instruction formatsComputer architecture instruction formats
Computer architecture instruction formats
Mazin Alwaaly
 
8086 architecture
8086 architecture8086 architecture
8086 architecture
karthiga selvaraju
 
Assignment statements
Assignment statementsAssignment statements
Assignment statements
Divya Devan
 

What's hot (20)

Presentation(intermediate code generation)
Presentation(intermediate code generation)Presentation(intermediate code generation)
Presentation(intermediate code generation)
 
Displacement addressing
Displacement addressingDisplacement addressing
Displacement addressing
 
instruction format and addressing modes
instruction format and addressing modesinstruction format and addressing modes
instruction format and addressing modes
 
Back patching
Back patchingBack patching
Back patching
 
Instruction set-of-8086
Instruction set-of-8086Instruction set-of-8086
Instruction set-of-8086
 
COMPILER DESIGN AND CONSTRUCTION
COMPILER DESIGN AND CONSTRUCTIONCOMPILER DESIGN AND CONSTRUCTION
COMPILER DESIGN AND CONSTRUCTION
 
Addressing modes ppt
Addressing modes pptAddressing modes ppt
Addressing modes ppt
 
Compiler Design - Ambiguous grammar, LMD & RMD, Infix & Postfix, Implementati...
Compiler Design - Ambiguous grammar, LMD & RMD, Infix & Postfix, Implementati...Compiler Design - Ambiguous grammar, LMD & RMD, Infix & Postfix, Implementati...
Compiler Design - Ambiguous grammar, LMD & RMD, Infix & Postfix, Implementati...
 
ADDRESSING MODE
ADDRESSING MODEADDRESSING MODE
ADDRESSING MODE
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
Instruction set (prasenjit dey)
Instruction set (prasenjit dey)Instruction set (prasenjit dey)
Instruction set (prasenjit dey)
 
Computer architecture addressing modes and formats
Computer architecture addressing modes and formatsComputer architecture addressing modes and formats
Computer architecture addressing modes and formats
 
Optimization of basic blocks
Optimization of basic blocksOptimization of basic blocks
Optimization of basic blocks
 
Intermediate code generation
Intermediate code generationIntermediate code generation
Intermediate code generation
 
Translation of expression(copmiler construction)
Translation of expression(copmiler construction)Translation of expression(copmiler construction)
Translation of expression(copmiler construction)
 
Addressing modes
Addressing  modesAddressing  modes
Addressing modes
 
Computer architecture instruction formats
Computer architecture instruction formatsComputer architecture instruction formats
Computer architecture instruction formats
 
8086 architecture
8086 architecture8086 architecture
8086 architecture
 
Assignment statements
Assignment statementsAssignment statements
Assignment statements
 
Me330 lecture4
Me330 lecture4Me330 lecture4
Me330 lecture4
 

Similar to Unit i ca- mips addressing

Instruction format UJJWAL MATOLIYA.pptx
Instruction format UJJWAL MATOLIYA.pptxInstruction format UJJWAL MATOLIYA.pptx
Instruction format UJJWAL MATOLIYA.pptx
ujjwalmatoliya
 
Assignment on different types of addressing modes
Assignment on different types of addressing modesAssignment on different types of addressing modes
Assignment on different types of addressing modes
NusratJahan263
 
Msp 430 addressing modes module 2
Msp 430 addressing modes module 2Msp 430 addressing modes module 2
Msp 430 addressing modes module 2
SARALA T
 
Compreport
CompreportCompreport
Compreport
xdarlord
 
ITEC582-Chapter 12.pptx
ITEC582-Chapter 12.pptxITEC582-Chapter 12.pptx
ITEC582-Chapter 12.pptx
SabaNaeem26
 
UNIT-3.pptx
UNIT-3.pptxUNIT-3.pptx
UNIT-3.pptx
TirthPatel479872
 
Unit II arm 7 Instruction Set
Unit II arm 7 Instruction SetUnit II arm 7 Instruction Set
Unit II arm 7 Instruction Set
Dr. Pankaj Zope
 
COA_mod2.ppt
COA_mod2.pptCOA_mod2.ppt
COA_mod2.ppt
singleps47
 
Addressing modes presentation
Addressing modes presentationAddressing modes presentation
Addressing modes presentation
UmeshBhattarai4
 
Chapter 4 programming concepts III
Chapter 4  programming concepts IIIChapter 4  programming concepts III
Chapter 4 programming concepts III
SHREEHARI WADAWADAGI
 
Chapter8.ppt
Chapter8.pptChapter8.ppt
Chapter8.ppt
AshokRachapalli1
 
ADDRESSING MODES
ADDRESSING MODESADDRESSING MODES
ADDRESSING MODES
Sadaf Rasheed
 
ADDRESSING MODES
ADDRESSING MODESADDRESSING MODES
ADDRESSING MODES
Sadaf Rasheed
 
addressing modes
addressing modesaddressing modes
addressing modes
Sadaf Rasheed
 
CS304PC:Computer Organization and Architecture Session 12 Instruction Format...
CS304PC:Computer Organization and Architecture  Session 12 Instruction Format...CS304PC:Computer Organization and Architecture  Session 12 Instruction Format...
CS304PC:Computer Organization and Architecture Session 12 Instruction Format...
Asst.prof M.Gokilavani
 
PPT on Addressing Modes.ppt.pptx
PPT on Addressing Modes.ppt.pptxPPT on Addressing Modes.ppt.pptx
PPT on Addressing Modes.ppt.pptx
Tushar Singhal
 
Chapter3.ppt
Chapter3.pptChapter3.ppt
Chapter3.ppt
AshokRachapalli1
 
addressing mode 1
addressing mode 1addressing mode 1
addressing mode 1
samrana gultasab
 
Chapter 11 - Intermediate Code Generation.pdf
Chapter 11 - Intermediate Code Generation.pdfChapter 11 - Intermediate Code Generation.pdf
Chapter 11 - Intermediate Code Generation.pdf
RAnwarpasha
 
Assembler - System Programming
Assembler - System ProgrammingAssembler - System Programming
Assembler - System Programming
Radhika Talaviya
 

Similar to Unit i ca- mips addressing (20)

Instruction format UJJWAL MATOLIYA.pptx
Instruction format UJJWAL MATOLIYA.pptxInstruction format UJJWAL MATOLIYA.pptx
Instruction format UJJWAL MATOLIYA.pptx
 
Assignment on different types of addressing modes
Assignment on different types of addressing modesAssignment on different types of addressing modes
Assignment on different types of addressing modes
 
Msp 430 addressing modes module 2
Msp 430 addressing modes module 2Msp 430 addressing modes module 2
Msp 430 addressing modes module 2
 
Compreport
CompreportCompreport
Compreport
 
ITEC582-Chapter 12.pptx
ITEC582-Chapter 12.pptxITEC582-Chapter 12.pptx
ITEC582-Chapter 12.pptx
 
UNIT-3.pptx
UNIT-3.pptxUNIT-3.pptx
UNIT-3.pptx
 
Unit II arm 7 Instruction Set
Unit II arm 7 Instruction SetUnit II arm 7 Instruction Set
Unit II arm 7 Instruction Set
 
COA_mod2.ppt
COA_mod2.pptCOA_mod2.ppt
COA_mod2.ppt
 
Addressing modes presentation
Addressing modes presentationAddressing modes presentation
Addressing modes presentation
 
Chapter 4 programming concepts III
Chapter 4  programming concepts IIIChapter 4  programming concepts III
Chapter 4 programming concepts III
 
Chapter8.ppt
Chapter8.pptChapter8.ppt
Chapter8.ppt
 
ADDRESSING MODES
ADDRESSING MODESADDRESSING MODES
ADDRESSING MODES
 
ADDRESSING MODES
ADDRESSING MODESADDRESSING MODES
ADDRESSING MODES
 
addressing modes
addressing modesaddressing modes
addressing modes
 
CS304PC:Computer Organization and Architecture Session 12 Instruction Format...
CS304PC:Computer Organization and Architecture  Session 12 Instruction Format...CS304PC:Computer Organization and Architecture  Session 12 Instruction Format...
CS304PC:Computer Organization and Architecture Session 12 Instruction Format...
 
PPT on Addressing Modes.ppt.pptx
PPT on Addressing Modes.ppt.pptxPPT on Addressing Modes.ppt.pptx
PPT on Addressing Modes.ppt.pptx
 
Chapter3.ppt
Chapter3.pptChapter3.ppt
Chapter3.ppt
 
addressing mode 1
addressing mode 1addressing mode 1
addressing mode 1
 
Chapter 11 - Intermediate Code Generation.pdf
Chapter 11 - Intermediate Code Generation.pdfChapter 11 - Intermediate Code Generation.pdf
Chapter 11 - Intermediate Code Generation.pdf
 
Assembler - System Programming
Assembler - System ProgrammingAssembler - System Programming
Assembler - System Programming
 

Recently uploaded

Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 

Recently uploaded (20)

Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 

Unit i ca- mips addressing

  • 2. Addressing in Branches and Jumps  The MIPS jump instructions have the simplest addressing.  They use the final MIPS instruction format, called the J-type, which consists of 6 bits for the operation field and the rest of the bits for the address field.  j 10000 # go to location 10000  where the value of the jump opcode is 2 and the jump address is 10000.
  • 3.  Unlike the jump instruction, the conditional branch instruction must specify two operands in addition to the branch address.  bne $s0,$s1,Exit # go to Exit if $s0 ≠ $s1  branch instruction would calculate the following:  Program counter Register Branch address  PC-relative addressing
  • 4.  Showing Branch Offset in Machine Language  The while loop as compiled into this MIPS assembler code:  Loop:sll $t1,$s3,2 #Temp reg $t1 = 4 * i  add $t1,$t1,$s6 # $t1 = address of save[i]  lw $t0,0($t1) #Temp reg $t0 = save[i]  bne $t0,$s5, Exit # go to Exit if save[i] ≠ k  addi $s3,$s3,1 # i = i + 1  j Loop # go to Loop  Exit:
  • 5.  If we assume we place the loop starting at location 80000 in memory, what is the MIPS machine code for this loop?  The assembled instructions and their addresses are:
  • 6. MIPS Addressing Mode  Addressing mode One of several addressing regimes delimited by their varied use of operands and/or addresses.  1. Immediate addressing, where the operand is a constant within the instruction itself  2. Register addressing, where the operand is a register  3. Base or displacement addressing, where the operand is at the memory location whose address is the sum of a register and a constant in the instruction  4. PC-relative addressing, where the branch address is the sum of the PC and a constant in the instruction  5. Pseudo direct addressing, where the jump address is the 26 bits of the instruction concatenated with the upper bits of the PC
  • 7.
  • 8.
  • 9.
  • 10. What is the Addressing Mode  Add $s0,$s1,5  A. Register addressing  B. Immediate addressing  C. Base addressing  D. PC-relative addressing  Ans:B
  • 11. What is the Addressing Mode  Add $s0,$s1,$s2  A. Register addressing  B. Immediate addressing  C. Base addressing  D. PC-relative addressing  Ans:A
  • 12. What is the Addressing Mode  Lw $t0,32(s3)  A. Register addressing  B. Immediate addressing  C. Base addressing  D. PC-relative addressing  Ans:C
  • 13. What is the Addressing Mode  beq $t0,$3,Label  A. Register addressing  B. Immediate addressing  C. Base addressing  D. PC-relative addressing  Ans:D
  • 14. What is the Addressing Mode  J 2000  A. Register addressing  B. Immediate addressing  C. Base addressing  D. PC-relative addressing  E. Pseudo direct Addressing  Ans:E