209k views
1 vote
This is the pseudo code: If (r2!=15) then r5:=r5−r2+r4. Please complete following 3 ARM instructions to do this task:

cmp r2,______
_____ skip
sub _____, r5,_____
___, ______,_____,r4

User Mindeh
by
7.3k points

1 Answer

3 votes

Final answer:

The given pseudo code can be implemented in ARM instructions as cmp r2, 15, skipsub r5, r2, r5, skipadd r5, r4, r5.

Step-by-step explanation:

The given pseudo code If (r2!=15) then r5:=r5−r2+r4 can be implemented in ARM instructions as follows:

  1. cmp r2, 15 - This instruction compares the value in register r2 with the value 15.
  2. skipsub r5, r2, r5 - This instruction subtracts the value in register r2 from the value in register r5 and stores the result in register r5.
  3. skipadd r5, r4, r5 - This instruction adds the value in register r4 to the value in register r5 and stores the result in register r5.

User Jamie Howarth
by
7.5k points