Question

code: 3. (20 pts.) Consider the following fragment of for (i-0; i<=100; i-i++) { a [i] = b[i] + c; Assume that a and b are ar
0 0
Add a comment Improve this question Transcribed image text
Answer #1

******************************************************************************************
Please Upvote the answer as it matters to me a lot :)
*****************************************************************************************
As HOMEWORKLIB RULES expert answering guidelines,Experts are supposed to answer only certain number of questions/sub-parts in a post.Please raise the remaining as a new question as HOMEWORKLIB RULES guidelines.
******************************************************************************************

bgt = branch if greater than

li = load immediate

lw = load word

sw= store word

sll = shift left logical

sll t2,t2,2 mmeans t2= t2*22= 4*t2

Add a comment
Know the answer?
Add Answer to:
code: 3. (20 pts.) Consider the following fragment of for (i-0; i<=100; i-i++) { a [i]...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using MIPS: Consider the following fragment of C code: for i=0: i < = 100: i...

    Using MIPS: Consider the following fragment of C code: for i=0: i < = 100: i = i + 1) {a[i] = b[i] + c;} Assume that a and bare arrays of words and the base address of a is in $a0 and the base address of b is in $a1. Register $t0 is associated with variable i and register $s0 with c. Write the code for MIPS. How many instructions are executed during the running of this code? How...

  • 7. Translate the following C code to MIPS assembly code. Use a minimum number of instructions....

    7. Translate the following C code to MIPS assembly code. Use a minimum number of instructions. Assume that the values of a,b, i and j are in registers Ss0, Ss1, St0, and St1, respectively. Also, assume that register SS2 holds the base address of the array D. for(i-0; i<a; i++) for(j=0 ; j<b; j++)

  • C2. Convert the following c-code to MIPS code. The base memory address of the array a is 0x8000_4...

    C2. Convert the following c-code to MIPS code. The base memory address of the array a is 0x8000_400C, which must be loaded in the base register Ss0. Register assignments: int a[10]; while (i !- 10) 1 if ( i%2 == 0) a[i] = i * 2; else ail - i* 3 i++i C2. Convert the following c-code to MIPS code. The base memory address of the array a is 0x8000_400C, which must be loaded in the base register Ss0. Register...

  • IN MIPS AND MUST RUN IN QTSPIM Translate the following C code to MIPS assembly code....

    IN MIPS AND MUST RUN IN QTSPIM Translate the following C code to MIPS assembly code. Use a minimum number of instructions. Assume that the values of a, b, i and j are stored in registers Ss0, Ss1, St0 and Stl, respectively. Also assume that register Ss2 holds the base address of the array D. for (i=0; i<a; itt) for (i-0j<b:jt+)

  • Assignment 3 Translate the following MIPS code to C. Assume that the variables f, g, h,...

    Assignment 3 Translate the following MIPS code to C. Assume that the variables f, g, h, i and j are assigned to registers Ss0, Ss1, Ss2, Ss3 and Ss4, respectively. Assume that the base address of the arrays A and B are in registers Ss6 and $s7, respectively. addi St0, Ss6, 4 add $t1, $s6, $0 #register $0 always holds 320s sw St1, 0(Sto) add Ss0, St1, Sto

  • 1. (15 pts) For the following C statement, what is the corresponding MIPS assembly code? Assume...

    1. (15 pts) For the following C statement, what is the corresponding MIPS assembly code? Assume f, g, h correspond to $80, $s1, and $s2, respectively. f=g+(h-5) 2. (15 pts) For the following pseudo-MIPS assembly instructions, what is the corresponding C code? add f, g, h add f,i, f 3. (30 pts) Provide the instruction type, assembly language instruction, and binary representation of the instruction described by the following MIPS fields: a. op = 0, rs = 18, rt=9, rd...

  • 5. Write the MIPS minimal sequence of instructions for the following C procedure code: int array_sum...

    5. Write the MIPS minimal sequence of instructions for the following C procedure code: int array_sum (a[], b[])                                  { int i;                                       i =1; for (i=1; i<100; i=i+1) { b[i] = D + a[i-1] + a[i] + a[i+1] ;}                                                             } Assume that: a and b are arrays of words and the base address of “a” is in $a0 and the base address of “b” is in $a1, Register $S1 is associated with...

  • C code to MIPS Translate the following C command into MIPS assembly. Assume that the base...

    C code to MIPS Translate the following C command into MIPS assembly. Assume that the base address of arrays A is stored in register $s1. 시 I-A[2] + 7;

  • C3. Convert the following C-code to MIPS code. [Use register $al for the variable i, temporary re...

    C3. Convert the following C-code to MIPS code. [Use register $al for the variable i, temporary registers for other values, and load the base memory address of the array OxA0000080 to Şao] int i i int array [101; for (i= 0; i<5 ; i=i+1 ) { [i+1] [i] 8; * array = array C3. Convert the following C-code to MIPS code. [Use register $al for the variable i, temporary registers for other values, and load the base memory address of...

  • . U 8. (15 pts) Assuming the code fragment below is executed by the classic 5-stage...

    . U 8. (15 pts) Assuming the code fragment below is executed by the classic 5-stage MIPS architecture, answer the following questions. Ll: lw RI, O (R5) // 11 add R2, Ri, 20 // 12 lw R3, 0(R6) // 13 add R3, R2, R3 SW R3, 0(R5) addi R4, R4,-4 // 16 addi R5, R5,4 // 17 addi R6, R6,4 // 18 bne R4, RO, L1 // 19 a. (5 pts) Assuming R5 holds the address of array A, R6...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT