SlideShare uma empresa Scribd logo
1 de 1
Baixar para ler offline
Does anyone know how to translate this MIPS assembly code to its equivalent C statements,
assuming that the registers #s1, $s2, $t1 and $t2 are integers a, b, i and j, respectively? addi $t1,
$0, 0 LOOP: slti $at, $t1, 15 beq $at, $0, EXITLOOP addi $t2, $0, 20 LOOP2: beq $t2, $0,
EXITLOOP2 addi $s2, $s2, 5 addi $t2, $t2, -1 j LOOP2 EXITLOOP2: addi $t1, $t1, 1 j LOOP
EXITLOOP:
Solution
i=0;
while(i<15){
j=20;
while(j!=0){
b=b+5;
j=j-1;
}
i=i+1;
}

Mais conteúdo relacionado

Mais de wviola

Algorithm MaxsubFastest(A)- Input- An n-element array A of numbers- in.docx
Algorithm MaxsubFastest(A)- Input- An n-element array A of numbers- in.docxAlgorithm MaxsubFastest(A)- Input- An n-element array A of numbers- in.docx
Algorithm MaxsubFastest(A)- Input- An n-element array A of numbers- in.docxwviola
 
Algorithm for checking whether an array is a min heap- A binary heap i.docx
Algorithm for checking whether an array is a min heap- A binary heap i.docxAlgorithm for checking whether an array is a min heap- A binary heap i.docx
Algorithm for checking whether an array is a min heap- A binary heap i.docxwviola
 
Algorithm (Data Structure) Worst-case cost in terms of N Average-cast.docx
Algorithm (Data Structure) Worst-case cost in terms of N Average-cast.docxAlgorithm (Data Structure) Worst-case cost in terms of N Average-cast.docx
Algorithm (Data Structure) Worst-case cost in terms of N Average-cast.docxwviola
 
Alcohol dehydrogenation can proceed via a carbocation intermediate- Wh.docx
Alcohol dehydrogenation can proceed via a carbocation intermediate- Wh.docxAlcohol dehydrogenation can proceed via a carbocation intermediate- Wh.docx
Alcohol dehydrogenation can proceed via a carbocation intermediate- Wh.docxwviola
 
algebra question Add and subtract as indicated- -7-a2b2 + 5-ab - 9-a5.docx
algebra question Add and subtract as indicated-  -7-a2b2 + 5-ab - 9-a5.docxalgebra question Add and subtract as indicated-  -7-a2b2 + 5-ab - 9-a5.docx
algebra question Add and subtract as indicated- -7-a2b2 + 5-ab - 9-a5.docxwviola
 
Alex (age 36) and Maria (age 38) have been married for 12 years- and t (1).docx
Alex (age 36) and Maria (age 38) have been married for 12 years- and t (1).docxAlex (age 36) and Maria (age 38) have been married for 12 years- and t (1).docx
Alex (age 36) and Maria (age 38) have been married for 12 years- and t (1).docxwviola
 
Adjusting Entries- Allowance for Doubtful accounts made on 1-1-1X was.docx
Adjusting Entries- Allowance for Doubtful accounts made on 1-1-1X was.docxAdjusting Entries- Allowance for Doubtful accounts made on 1-1-1X was.docx
Adjusting Entries- Allowance for Doubtful accounts made on 1-1-1X was.docxwviola
 
Alden Company has decided to use a contribution format income statemen (1).docx
Alden Company has decided to use a contribution format income statemen (1).docxAlden Company has decided to use a contribution format income statemen (1).docx
Alden Company has decided to use a contribution format income statemen (1).docxwviola
 
Albert Shoe Company is considering investing in one of two machines th (1).docx
Albert Shoe Company is considering investing in one of two machines th (1).docxAlbert Shoe Company is considering investing in one of two machines th (1).docx
Albert Shoe Company is considering investing in one of two machines th (1).docxwviola
 
Albert Shoe Company is considering investing in one of two machines th.docx
Albert Shoe Company is considering investing in one of two machines th.docxAlbert Shoe Company is considering investing in one of two machines th.docx
Albert Shoe Company is considering investing in one of two machines th.docxwviola
 
al equilibrium- klmore NO e liwing mation at equiliheriem- which chang.docx
al equilibrium- klmore NO e liwing mation at equiliheriem- which chang.docxal equilibrium- klmore NO e liwing mation at equiliheriem- which chang.docx
al equilibrium- klmore NO e liwing mation at equiliheriem- which chang.docxwviola
 
al loop is is attached to an axle with a handle as shown- The north po.docx
al loop is is attached to an axle with a handle as shown- The north po.docxal loop is is attached to an axle with a handle as shown- The north po.docx
al loop is is attached to an axle with a handle as shown- The north po.docxwviola
 
AirQual Test Corporation provides on-site air quality testing services.docx
AirQual Test Corporation provides on-site air quality testing services.docxAirQual Test Corporation provides on-site air quality testing services.docx
AirQual Test Corporation provides on-site air quality testing services.docxwviola
 
AirParts Corporation reported an operating loss of $14 million for fin.docx
AirParts Corporation reported an operating loss of $14 million for fin.docxAirParts Corporation reported an operating loss of $14 million for fin.docx
AirParts Corporation reported an operating loss of $14 million for fin.docxwviola
 
Air travel Mountain Airlines for the past 18 weeks was- Week Passenger.docx
Air travel Mountain Airlines for the past 18 weeks was- Week Passenger.docxAir travel Mountain Airlines for the past 18 weeks was- Week Passenger.docx
Air travel Mountain Airlines for the past 18 weeks was- Week Passenger.docxwviola
 
Air is compressed from a state where the pressure is 0-1 Mpa and the t.docx
Air is compressed from a state where the pressure is 0-1 Mpa and the t.docxAir is compressed from a state where the pressure is 0-1 Mpa and the t.docx
Air is compressed from a state where the pressure is 0-1 Mpa and the t.docxwviola
 
Air at 400 kPa and 600 K enters a Turbine operating at a steady state.docx
Air at 400 kPa and 600 K enters a Turbine operating at a steady state.docxAir at 400 kPa and 600 K enters a Turbine operating at a steady state.docx
Air at 400 kPa and 600 K enters a Turbine operating at a steady state.docxwviola
 
Address the following- What specific problems do you think the n-tiere.docx
Address the following- What specific problems do you think the n-tiere.docxAddress the following- What specific problems do you think the n-tiere.docx
Address the following- What specific problems do you think the n-tiere.docxwviola
 
Add a function prototype for the function sumNum- # include using nam.docx
Add a function prototype for the function sumNum- # include  using nam.docxAdd a function prototype for the function sumNum- # include  using nam.docx
Add a function prototype for the function sumNum- # include using nam.docxwviola
 
adding a catalyst d- removing NHs(g) A 2500ml s the concentration of t.docx
adding a catalyst d- removing NHs(g) A 2500ml s the concentration of t.docxadding a catalyst d- removing NHs(g) A 2500ml s the concentration of t.docx
adding a catalyst d- removing NHs(g) A 2500ml s the concentration of t.docxwviola
 

Mais de wviola (20)

Algorithm MaxsubFastest(A)- Input- An n-element array A of numbers- in.docx
Algorithm MaxsubFastest(A)- Input- An n-element array A of numbers- in.docxAlgorithm MaxsubFastest(A)- Input- An n-element array A of numbers- in.docx
Algorithm MaxsubFastest(A)- Input- An n-element array A of numbers- in.docx
 
Algorithm for checking whether an array is a min heap- A binary heap i.docx
Algorithm for checking whether an array is a min heap- A binary heap i.docxAlgorithm for checking whether an array is a min heap- A binary heap i.docx
Algorithm for checking whether an array is a min heap- A binary heap i.docx
 
Algorithm (Data Structure) Worst-case cost in terms of N Average-cast.docx
Algorithm (Data Structure) Worst-case cost in terms of N Average-cast.docxAlgorithm (Data Structure) Worst-case cost in terms of N Average-cast.docx
Algorithm (Data Structure) Worst-case cost in terms of N Average-cast.docx
 
Alcohol dehydrogenation can proceed via a carbocation intermediate- Wh.docx
Alcohol dehydrogenation can proceed via a carbocation intermediate- Wh.docxAlcohol dehydrogenation can proceed via a carbocation intermediate- Wh.docx
Alcohol dehydrogenation can proceed via a carbocation intermediate- Wh.docx
 
algebra question Add and subtract as indicated- -7-a2b2 + 5-ab - 9-a5.docx
algebra question Add and subtract as indicated-  -7-a2b2 + 5-ab - 9-a5.docxalgebra question Add and subtract as indicated-  -7-a2b2 + 5-ab - 9-a5.docx
algebra question Add and subtract as indicated- -7-a2b2 + 5-ab - 9-a5.docx
 
Alex (age 36) and Maria (age 38) have been married for 12 years- and t (1).docx
Alex (age 36) and Maria (age 38) have been married for 12 years- and t (1).docxAlex (age 36) and Maria (age 38) have been married for 12 years- and t (1).docx
Alex (age 36) and Maria (age 38) have been married for 12 years- and t (1).docx
 
Adjusting Entries- Allowance for Doubtful accounts made on 1-1-1X was.docx
Adjusting Entries- Allowance for Doubtful accounts made on 1-1-1X was.docxAdjusting Entries- Allowance for Doubtful accounts made on 1-1-1X was.docx
Adjusting Entries- Allowance for Doubtful accounts made on 1-1-1X was.docx
 
Alden Company has decided to use a contribution format income statemen (1).docx
Alden Company has decided to use a contribution format income statemen (1).docxAlden Company has decided to use a contribution format income statemen (1).docx
Alden Company has decided to use a contribution format income statemen (1).docx
 
Albert Shoe Company is considering investing in one of two machines th (1).docx
Albert Shoe Company is considering investing in one of two machines th (1).docxAlbert Shoe Company is considering investing in one of two machines th (1).docx
Albert Shoe Company is considering investing in one of two machines th (1).docx
 
Albert Shoe Company is considering investing in one of two machines th.docx
Albert Shoe Company is considering investing in one of two machines th.docxAlbert Shoe Company is considering investing in one of two machines th.docx
Albert Shoe Company is considering investing in one of two machines th.docx
 
al equilibrium- klmore NO e liwing mation at equiliheriem- which chang.docx
al equilibrium- klmore NO e liwing mation at equiliheriem- which chang.docxal equilibrium- klmore NO e liwing mation at equiliheriem- which chang.docx
al equilibrium- klmore NO e liwing mation at equiliheriem- which chang.docx
 
al loop is is attached to an axle with a handle as shown- The north po.docx
al loop is is attached to an axle with a handle as shown- The north po.docxal loop is is attached to an axle with a handle as shown- The north po.docx
al loop is is attached to an axle with a handle as shown- The north po.docx
 
AirQual Test Corporation provides on-site air quality testing services.docx
AirQual Test Corporation provides on-site air quality testing services.docxAirQual Test Corporation provides on-site air quality testing services.docx
AirQual Test Corporation provides on-site air quality testing services.docx
 
AirParts Corporation reported an operating loss of $14 million for fin.docx
AirParts Corporation reported an operating loss of $14 million for fin.docxAirParts Corporation reported an operating loss of $14 million for fin.docx
AirParts Corporation reported an operating loss of $14 million for fin.docx
 
Air travel Mountain Airlines for the past 18 weeks was- Week Passenger.docx
Air travel Mountain Airlines for the past 18 weeks was- Week Passenger.docxAir travel Mountain Airlines for the past 18 weeks was- Week Passenger.docx
Air travel Mountain Airlines for the past 18 weeks was- Week Passenger.docx
 
Air is compressed from a state where the pressure is 0-1 Mpa and the t.docx
Air is compressed from a state where the pressure is 0-1 Mpa and the t.docxAir is compressed from a state where the pressure is 0-1 Mpa and the t.docx
Air is compressed from a state where the pressure is 0-1 Mpa and the t.docx
 
Air at 400 kPa and 600 K enters a Turbine operating at a steady state.docx
Air at 400 kPa and 600 K enters a Turbine operating at a steady state.docxAir at 400 kPa and 600 K enters a Turbine operating at a steady state.docx
Air at 400 kPa and 600 K enters a Turbine operating at a steady state.docx
 
Address the following- What specific problems do you think the n-tiere.docx
Address the following- What specific problems do you think the n-tiere.docxAddress the following- What specific problems do you think the n-tiere.docx
Address the following- What specific problems do you think the n-tiere.docx
 
Add a function prototype for the function sumNum- # include using nam.docx
Add a function prototype for the function sumNum- # include  using nam.docxAdd a function prototype for the function sumNum- # include  using nam.docx
Add a function prototype for the function sumNum- # include using nam.docx
 
adding a catalyst d- removing NHs(g) A 2500ml s the concentration of t.docx
adding a catalyst d- removing NHs(g) A 2500ml s the concentration of t.docxadding a catalyst d- removing NHs(g) A 2500ml s the concentration of t.docx
adding a catalyst d- removing NHs(g) A 2500ml s the concentration of t.docx
 

Último

Philosophy of Education and Educational Philosophy
Philosophy of Education  and Educational PhilosophyPhilosophy of Education  and Educational Philosophy
Philosophy of Education and Educational PhilosophyShuvankar Madhu
 
How to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 SalesHow to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 SalesCeline George
 
CAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxCAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxSaurabhParmar42
 
The Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George WellsThe Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George WellsEugene Lysak
 
In - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptxIn - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptxAditiChauhan701637
 
What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?TechSoup
 
Education and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxEducation and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxraviapr7
 
Patient Counselling. Definition of patient counseling; steps involved in pati...
Patient Counselling. Definition of patient counseling; steps involved in pati...Patient Counselling. Definition of patient counseling; steps involved in pati...
Patient Counselling. Definition of patient counseling; steps involved in pati...raviapr7
 
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...Nguyen Thanh Tu Collection
 
How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17Celine George
 
M-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptxM-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptxDr. Santhosh Kumar. N
 
Human-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming ClassesHuman-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming ClassesMohammad Hassany
 
Benefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive EducationBenefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive EducationMJDuyan
 
How to Solve Singleton Error in the Odoo 17
How to Solve Singleton Error in the  Odoo 17How to Solve Singleton Error in the  Odoo 17
How to Solve Singleton Error in the Odoo 17Celine George
 
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptxPISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptxEduSkills OECD
 
How to Use api.constrains ( ) in Odoo 17
How to Use api.constrains ( ) in Odoo 17How to Use api.constrains ( ) in Odoo 17
How to Use api.constrains ( ) in Odoo 17Celine George
 
The basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxThe basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxheathfieldcps1
 
General views of Histopathology and step
General views of Histopathology and stepGeneral views of Histopathology and step
General views of Histopathology and stepobaje godwin sunday
 

Último (20)

Philosophy of Education and Educational Philosophy
Philosophy of Education  and Educational PhilosophyPhilosophy of Education  and Educational Philosophy
Philosophy of Education and Educational Philosophy
 
How to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 SalesHow to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 Sales
 
CAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptxCAULIFLOWER BREEDING 1 Parmar pptx
CAULIFLOWER BREEDING 1 Parmar pptx
 
The Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George WellsThe Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George Wells
 
In - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptxIn - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptx
 
What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?
 
Education and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxEducation and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptx
 
Patient Counselling. Definition of patient counseling; steps involved in pati...
Patient Counselling. Definition of patient counseling; steps involved in pati...Patient Counselling. Definition of patient counseling; steps involved in pati...
Patient Counselling. Definition of patient counseling; steps involved in pati...
 
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
CHUYÊN ĐỀ DẠY THÊM TIẾNG ANH LỚP 11 - GLOBAL SUCCESS - NĂM HỌC 2023-2024 - HK...
 
How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17
 
M-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptxM-2- General Reactions of amino acids.pptx
M-2- General Reactions of amino acids.pptx
 
Human-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming ClassesHuman-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming Classes
 
Benefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive EducationBenefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive Education
 
How to Solve Singleton Error in the Odoo 17
How to Solve Singleton Error in the  Odoo 17How to Solve Singleton Error in the  Odoo 17
How to Solve Singleton Error in the Odoo 17
 
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptxPISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
PISA-VET launch_El Iza Mohamedou_19 March 2024.pptx
 
Finals of Kant get Marx 2.0 : a general politics quiz
Finals of Kant get Marx 2.0 : a general politics quizFinals of Kant get Marx 2.0 : a general politics quiz
Finals of Kant get Marx 2.0 : a general politics quiz
 
How to Use api.constrains ( ) in Odoo 17
How to Use api.constrains ( ) in Odoo 17How to Use api.constrains ( ) in Odoo 17
How to Use api.constrains ( ) in Odoo 17
 
Personal Resilience in Project Management 2 - TV Edit 1a.pdf
Personal Resilience in Project Management 2 - TV Edit 1a.pdfPersonal Resilience in Project Management 2 - TV Edit 1a.pdf
Personal Resilience in Project Management 2 - TV Edit 1a.pdf
 
The basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxThe basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptx
 
General views of Histopathology and step
General views of Histopathology and stepGeneral views of Histopathology and step
General views of Histopathology and step
 

Does anyone know how to translate this MIPS assembly code to its equiv.docx

  • 1. Does anyone know how to translate this MIPS assembly code to its equivalent C statements, assuming that the registers #s1, $s2, $t1 and $t2 are integers a, b, i and j, respectively? addi $t1, $0, 0 LOOP: slti $at, $t1, 15 beq $at, $0, EXITLOOP addi $t2, $0, 20 LOOP2: beq $t2, $0, EXITLOOP2 addi $s2, $s2, 5 addi $t2, $t2, -1 j LOOP2 EXITLOOP2: addi $t1, $t1, 1 j LOOP EXITLOOP: Solution i=0; while(i<15){ j=20; while(j!=0){ b=b+5; j=j-1; } i=i+1; }