3. (10 points) Data layout Suppose re ex28008000, and the memory layout is as fo
ID: 3605124 • Letter: 3
Question
3. (10 points) Data layout Suppose re ex28008000, and the memory layout is as follows: Address Data 8x20008007 x79 x20098006 xCD 0x20008005OXA3 ex209e8894 exFD 0x20008003 ex0D ex28088802 exEB ex28008801 0x2C 8x20098900 8x1A What is the value of register ri and rO after running the following instructions? Assume little endianness is used to organize data in the memory. These instructions runs independently, i.e. they are not part of a program. LDRSB r1, [r0, #2] re LDRH r1, [r8], #2 r1 = re= LDRSH r1, [re, #4]!Explanation / Answer
1)
LDRSB r1,[r0,#2]
1-byte deriver :
r1= [r0+2] --> [0x20008000+2] --> [0x2008002] --> 0xEB
sign-extended to 32 bit word
r1=0xFFFFFFEB
r0=0x20008000
2)
LDRH r1,[r0],#2
half-word derived
r1= [r0+ #2*2] --> [0x20008000+4] --> [0x20008004] --> 0xA3FD
zero-extended to 32 bit word :
r1=0x0000A3FD
r0=0x20008000
3)
LDRSH r1,[r0,#4]!
half-word deriverd with pre-indexing
r1= [r0+ #4] --> [0x20008000 + 4] --> [0x20008004] --> 0xA3FD
pre-indexing :- so, r0=0x20008004
sign-extended to 32 bit word:
r1=0xFFFFA3FD
r0=0x20008004
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.