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

the condition codes when the breakpoint set at the branchinstruction is encounte

ID: 3609016 • Letter: T

Question

the condition codes when the breakpoint set at the branchinstruction is encountered.

Will the branch be taken when the program continues execution?Assume initial

values of 0x0000007E and 0x0000001C in r0 and r2 respectively.

   mov r3, r0, LSL r2

   cmp r3, #4

   bcc process


2) Given the following ARM assembly language code segment,determine the value of

the condition codes when the breakpoint set at the branchinstruction is encountered.

Will the branch be taken when the program continues execution?Assume initial

values of 6 and -2 in r0 and r1 respectively.

   adds r0, r1, r0

   bhi convert


3) Given the memory map shown, determine the contents ofr4, r6, r9, and r10 after the following ARM assembly languageinstructions have executed. Indicate all changes to thememory map after the program is complete. Assume thatr4, r6, r9, and r10 initially contain0x00008A04, 0x00008A0A, 0x12ABCDEF, and0x0000000A respectively. Assume little endian byteordering.

   LDR r10, [r4, #6]!

   STRH r9, [r6, #2]


1) Given the following ARM assembly language code segment,determine the value of the condition codes when the breakpoint set at the branchinstruction is encountered. Will the branch be taken when the program continues execution?Assume initial values of 0x0000007E and 0x0000001C in r0 and r2 respectively. mov r3, r0, LSL r2 cmp r3, #4 bcc process 2) Given the following ARM assembly language code segment,determine the value of the condition codes when the breakpoint set at the branchinstruction is encountered. Will the branch be taken when the program continues execution?Assume initial values of 6 and -2 in r0 and r1 respectively. adds r0, r1, r0 bhi convert 3) Given the memory map shown, determine the contents ofr4, r6, r9, and r10 after the following ARM assembly languageinstructions have executed. Indicate all changes to thememory map after the program is complete. Assume thatr4, r6, r9, and r10 initially contain0x00008A04, 0x00008A0A, 0x12ABCDEF, and0x0000000A respectively. Assume little endian byteordering. LDR r10, [r4, #6]! STRH r9, [r6, #2]

Explanation / Answer

Dear,    1. Here given, r0 = 0 0 0 0 0 0 7 E                          r2= 0 0 0 0 0 0 1 C          Thegiven instructions are,               movr3, r0, LSL r2             Herefirst the value in r2 is ligically shifted left and thus moved tor0 and thus r0 to r3.                i.e.,LSL r2 = 0 0 0 0 1 C 0 0                Thisvalue to moved to r0 and hence r3.                Now,the values in r0 = r3 = 0 0 0 0 1 C 0 0          
          cmpr3, #4                Herethe value of r3 is subtacted by #4 and the cc bit is set.                Herethe value of r3 is subtacted by #4 and the cc bit is set.          bcc process                Thismeans branch on carry clear.          Here thecarry clear(cc) bit is not clear. So, there will not be anybranching.      2. Here, r0 = 6 and r1 =-2          adds r0, r1, r0                Herethe r0 = r1 + r0                            r0= -2 + 6 = 4          bhiconvert              BHIperforms the branch if C is set and Z is clear. This is used aftersubtaction of unsigned integers.             Herebranching is done to the convert, because the unsigned subtractionis performed.       3. Here r4 = 0 0 0 0 8 A 04                   r6= 0 0 0 0 8 A 0 A                   r9= 1 2 A B C D E F                   r10= 0 0 0 0 0 0 0 A                 LDR r10, [r4, #6]                      Herethe value of r4 is placed in r10                      Herethe value of r4 is placed in r10                STRHr9, [r6, #2]                      Storethe halfword in r9 at r6+2 but dont write back " I hope this will help you"                      Storethe halfword in r9 at r6+2 but dont write back " I hope this will help you"