Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. For the following C statement, what is the corresponding MIPS assembly code? Assume that the variables f, g, h, and i are given and

image text in transcribed
image text in transcribed
1. For the following C statement, what is the corresponding MIPS assembly code? Assume that the variables f, g, h, and i are given and could be considered 32-bit integers as declared in a C program. Use a minimal number of MIPS assembly instructions. f=g+ (h-5); 2. Show how the value Oxabcdef12 would be arranged in memory of a little-endian and a big-endian machine. Assume that the data is stored starting at address 0. 3. For the following C statement, what is the corresponding MIPS assembly code? Assume that the variables i, and jare assigned to registers $80 and $81, respectively. Assume that the base address of the arrays A and B are in registers $s2 and $s3, respectively. B[8] - A[i-j]; 5. For the following assembly instruction, what is the machine code in decimal representation, binary representation and hexadecimal representation respectively, respectively? Assume that the code of add is 0, the codes of registers $81, $s2 and $t0 are 17, 18 and 8, respectively. add Sto, S1, S2 6. For the following assembly instruction, what is the machine code in decimal representation, binary representation and hexadecimal representation, respectively? Assume that the code of lw is 35, the codes of registers are $to and $t1, respectively. ok lw $to, 4($t1) 7. What is the MIPS assembly code to move the value of register Ss1 to registers $t1 8. What is the MIPS assembly code to add 8 to $s2? 9. What is the MIPS assembly code to subtract 4 from $s3? 10. What are the 8 bit representation for the +4 and 4 respectively? 11. What is the MIPS assembly code to multiply 8 to $so? 12. What is the MIPS assembly code to divide $s by 4? 13. Assume the following register contents: $to = OxAAAAAAAA, St1 = 0x12345678 1) For the register values shown above, what is the value of S12 for the following sequence of instructions? b. For the Tollowing assembly instruction, what is the machine code in decimal representation, binary representation and hexadecimal representation, respectively? Assume that the code of lw is 35, the codes of registers are Sto and $t1, respectively lw $t0, 4($11) 7. What is the MIPS assembly code to move the value of register Ss1 to registers $t1 8. What is the MIPS assembly code to add 8 to $s2? 9. What is the MIPS assembly code to subtract 4 from $s3? 10. What are the 8 bit representation for the +4 and 4 respectively? 11. What is the MIPS assembly code to multiply 8 to $so? 12. What is the MIPS assembly code to divide $50 by 4? 13. Assume the following register contents: $t0 = OxAAAAAAAA, $t1 = 0x12345678 1) For the register values shown above, what is the value of $12 for the following sequence of instructions? sll $t2Sto, 44 or $12, $t2, St1 2) For the register values shown above, what is the value of $i2 for the following sequence of instructions? sll $12, Sto, 4 andi $t2, $t2.-1 16. Translate the following C code to MIPS assembly code. Use a minimum number of instructions. Assume that the values of a. b. i. and jare in registers $so. Ss1. Sto, and $t1, respectively. Also, assume that register Ss2 holds the base address of the array D. for(i=0; i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

50 Tips And Tricks For MongoDB Developers Get The Most Out Of Your Database

Authors: Kristina Chodorow

1st Edition

1449304613, 978-1449304614

More Books

Students also viewed these Databases questions