Question

I. What value will be in register r2 after execution of the following instructions? Show your...

I. What value will be in register r2 after execution of the following instructions? Show your work with the register values after executing each instruction.

MOV r2, #0x0

LDR r1, =0xCF

MOVS r1, r1,

LSR #1

ADC r2, r2, #0

MOVS r1, r1,

LSR #1

ADC r2, r2, #0

II. Assume a 32 bit register holds a data of four bytes as B3B2B1B0. Write a sequence of ARM instruction that takes this data as input and swaps the bytes 0 and 3 so the result would be B0B1B2B3.

III. Which ARM processor mode/modes has the fewest available number of registers available? How many and why??

Homework Answers

Answer #1

Answer :- i) The ARM assembly code has been written below-

MOV r2, #0x0 ;r2 = 0

LDR r1, =0xCF ;r1 = 0xCF

MOVS r1, r1, LSR #1 ;r1 = 0x67 and carry flag = 1 i.e lsb of oxCF

ADC r2, r2, #0 ;r2 = r2+0+carry = 0x01

MOVS r1, r1, LSR #1 ;r1 = 0x33 and c = 1

ADC r2, r2, #0 ;r2 = 0x01 + 0x0 + c = 0x02.

Answer :- ii) The ARM assembly code has been written below-(assume r1 holds 4 bit data)

AND r2, r1, #0x01 ;r2 = lsb i.e. B0

AND r3, r1, #0x08 ;r3 = msb i.e. B3

AND r1, r1, #0x06 ;r1 = 0 B2 B1 0

LSL r2, r2, #3 ;r2 = B0 0 0 0

LSR r3, r3, #3 ;r3 = 0 0 0 B3

ORR r2, r2, r3 ;r2 = B0 0 0 B3

ORR r1, r1, r2 ;r1 = B0 B2 B1 B3

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
VII. After execution of the following instructions what value will be in register r2? Trace the...
VII. After execution of the following instructions what value will be in register r2? Trace the program and write the value of the registers at each line to receive full credit. LDR r12, =0xA4000000 LDR r0, =0x2D STR r0, [r12, #-4]! LDR r0, =0x5E STR r0, [r12, #-4]! LDR r0, =0xD5 STR r0, [r12, #-4]! LDMIA r12!, {r0-r2} SUB r2, #0x68 VIII. Write a simple ARM assembly program to divide a 32 bit positive number stored in r0 by a...
III. After execution of the following instructions what value will be in register r0? LDR                ...
III. After execution of the following instructions what value will be in register r0? LDR                 r12, =0xA4000000 LDR                 r0, =0x75 LDR                 r1, =0xD2 LDR                 r2, =0x9C LDR                 r5, =0xC STMDB           r12!, {r0-r2, r5} LDR                 r0, [r12, #8] SUB                 r0, #0x77 IV. Assume that the variables f, g, h, i, and j are assigned to registers r0, r1, r2, r3, and r4, respectively. Assume that the base address of the arrays A and...
Assignment-I Write the output for the following instructions MOV B , A             Before instruction execution, the...
Assignment-I Write the output for the following instructions MOV B , A             Before instruction execution, the contents of registers B and A are                                  Rd= B= XBH                         Rs= A = 1FH              After the execution of instruction.                                 Rd= B = ?                         Rs= A = ? ADD B If A= E 3H   B=  0 4H then after the  execution of the above instruction the content of A = ? SUI 03H If the value of A = 15Hthen after the execution of the above instruction...
Given the following sequential list of VEX operations: A. add $r3 = $r1, $r2 B. sub...
Given the following sequential list of VEX operations: A. add $r3 = $r1, $r2 B. sub $r8 = $r1, $r3 C. sub $r7 = $r1, 2 D. add $r1 = $r1, 1 E. mpy $r6 = $r3, $r2 Which VEX operations can be scheduled simultaneously to make up the second VLIW instruction? The constructed schedule should satisfy the following conditions: Assume infinite resources and no limit to the number of operations scheduled to a single instruction. Operations that are scheduled...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT