Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help. png 2018 uestion 3 (30 pt.) nswer the following questions related w

ID: 3726724 • Letter: P

Question

Please help.

png 2018 uestion 3 (30 pt.) nswer the following questions related with MIPS instructions: a) (10 pt.) Rewrite the following pseudo-instructions using an equivalent sequence of "real" MIPS instructions (i.e., non-pseudo-instructions) li $t0, 0x1122aabb move $ti, $to b) (20 pt.) In the following C code snippet, variables sre_ptr and dst _ptr are pointers of type char*. Initially, src_ptr points to a null-terminated string, while dst_ptr points to a free region of memory where the string will be copied. Translate this code to MIPS, assuming that variable src_ptr is contained in sso, and variable dst _ptr in $s1. Don't write a full M program, just focus on the code for the loop. do c *src-ptr; char = src ptr++: dst ptr++i } while (c != 0); end!

Explanation / Answer

Answer for first question:
The li pseudo instruction loads an immediate value into a register.
li $t0, 0x1122aabb
will be change to
lui $t0, 0x1122 ;first half
ori $t0, $t0, 0xaabb ; second half
move pseudo instruction moves the contents of one register into another register.
move $t0, $t1
add $t0, $t1, $0


Second answer:
Here before moving to solution let me tell you, this code would not compile success fully as variable c is not declared in the scope of exression while(c!=0).
But still i will reply you for the code snippet written inside do/while.
lui $2,%hi(src_ptr) ; get half from src pntr and move to reg2
lw $2,%lo(src_ptr)($2) ; get half from src pntr and move to reg2
lbu $2,0($2) ; now make proper.
sb $2,0($fp)
lui $2,%hi(dst_ptr) ; similarly assign back.
lw $2,%lo(dst_ptr)($2)
lbu $3,0($fp)
sb $3,0($2)
lui $2,%hi(src_ptr) ; increment the pointer.
lw $2,%lo(src_ptr)($2)
addiu $3,$2,1
lui $2,%hi(src_ptr)
sw $3,%lo(src_ptr)($2)
lui $2,%hi(dst_ptr)
lw $2,%lo(dst_ptr)($2)
addiu $3,$2,1
lui $2,%hi(dst_ptr)
sw $3,%lo(dst_ptr)($2)