This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ow the single MIPS instruction or minimal sequence of instructions for this C statement(10%)
x = x + a; Assume that a corresponds to register $t3 and the array x has a base address of 6,400,000ten. 10 Which of the following instructions may need to be edited during link phase?(10%)
Loop: lui $at, 0xABCD # a ori $a0, $at, 0xFEDC jal add_link bne $a0,$v0, Loop # b # c # d? 1 1 MIPS to C. Assume $s3 = i, $s4 = j, $s5 = @A. Below is the MIPS code: (10%) Loop: addi $s4, $s4, 1 add add add lw addi slti beq slti bne $t1 $s3, $s3 , $t1 $t1 $t1 , , $t1 $t1 $s5 , , $t0, 0($t1) $s3, $s3 ,4 $t1 $t0, 1 , 0 $t0, $0, Loop $t1 $t0, , $t0, $0, Loop # j = j + 1? # $t1 = 2 * i # $t1 = 4 * i # $t1 = @ A[i] # $t0 = A[i] # i = i + 1? # $t1 = $t0 < 1 0? # goto Loop if >= 0 # $t1 = $t0 < 0? # goto Loop if < Below is part of the corresponding C code:
do j = j + 1 while (______); What C code properly fills in the blank in loop on right?...
View Full Document
- Spring '08
- Computer Science