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

Question 3: (20 points) Exercise 6.5 Explain how the following program can be us

ID: 2250074 • Letter: Q

Question

Question 3: (20 points) Exercise 6.5 Explain how the following program can be used to determine whether a computer is big-endian or little-endian: 1i St0. 0xABCD9876 sw $t0, 100 (s0) 1b $s5, 101 (s0) Where li stand for "load immediate Question 4: (30 points, 10 points for each sub-question) Assume that register $10 (or $12) contains 0x10010000. The value of A is at memory address 0x10010004 and the value of B is at memory address 0x10010008. In assembly language, write instructions to: a. load the values of A and B to registers $S0 and SS1, respectively. b. C=A.B; // You may use any register to hold value ofC. c. store the value of C into memory address Ox1001000C.

Explanation / Answer

3)

Big-endian:
li $t0, 0xABCD9876 ;load the immediate value into register t0
sw $t0, 100($0) ; store the byte values left to right , starting loation 100
the bytes are numbered from 100 to 103 from left to right
lb $s5, 101($0)    ; load the byte in 101th loation to register s5.

So the value of $s5 = 0xCD

Little-endian :
li $t0, 0xABCD9876 ;load the immediate value into register t0
sw $t0, 100($0) ; store the byte values right to left, starting loation 100
;the bytes are numbered from 100 to 103 from right to left.
lb $s5, 101($0) ; load the byte in 101th loation to register s5.
So the value of $s5 = 0x98

Thus, the final load byte(lb) instruction returns a different value depending
on the endianness of the machine.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote