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

I. Assume r0=0xAD10 0002 and r1=0x3FF8 0000, what will be the value of register

ID: 3911338 • Letter: I

Question

I. Assume r0=0xAD10 0002 and r1=0x3FF8 0000, what will be the value of register r2 after executing the following instructions?

MOV    r2, #0

CMP    r0, r1

BGE     ELSE

B          DONE

ELSE: MOV    r2, #2

DONE:

II. Consider the four addressing modes given below used by ARM7 along with an example of each.

a. Immediate                                      ADD r2, r0, #5

b. Scaled register                               ADD r2, r0, r1, LSL, #2

c. Scaled register pre-indexed         LDR r2, [r0, r1, LSL, #2]!                  

d. PC-relative                                     BEQ 4000

List benefits and drawbacks of each ARM addressing mode.

Explanation / Answer

Answer is as follows :

I)

As per given scenario

Firsrt of all 0 is move to register r2 i.e. clear the register r2.

Compare value of r0 and r1, r0 is greater than r1

So than there is jump to lable ELSE from BGE ELSE.

than move 2 to register r2 and next instruction is DONE.

So at the end the register r2 contains value 2

II)

a) Immidiate Addressing Mode

Pros : We should perfrom operation on data directly. Less Registers are there, so execution is fast.

Cons : We can't update the data withiin execution, we chave to change the program.

b) Scaled Register :

Pros : The Operation is fast as shifting is used there for perfroming in given ADD instruction

Cons : Difficult to understand manually.

c) Scaled Register Pre Index

Pros : Calculate the Base register value with base plus offset calculation, so that new memory location is available for storing large data.

Cons : The Process takes large time because double calculation are there as in given example first base register is calculated than Loading is done.

d) PC-relative :

?Pros : Easy for jump to other locatoin from one location.

Cons : Wastage of memory location as PC is set to updated location on which control is jumped.

if there is any query or you want more explanation please ask in comments...