Choose an editorial article (An editorial is an article that presents the writer's opinion on an issue supported with facts) from the New York Times or the Wall Street Journal. Browse the libra

MSU Denver CS Computer Organization CS2400 CRN 53551

Dr. Iliya Georgiev Fall 2018

Student Name: . . . . . . . . . . . . . . . HW2- ARM Basics – due date September 24th
  1. Warm up questions (5 p):


  1. A 32-bit word 112233FA(16) is stored in a byte-addressed little endian main memory at address 100(16). . The byte 33 is stored at address ……………..



  1. Explain the register-displacement addressing mode. What stands for PC-relative addressing mode?

  1. Assume an ARM-like CPU but with only 8-bit registers and ALU. In register r0 a byte is stored 1000 0000, in r1=0000 0010. The CPU performs the following instruction

ADD r2, r0, r1.

Perform the binary addition and provide the decimal value of the result assuming that:

  1. The numbers in r0 and r1 are unsigned:

  1. The numbers in r0 and r1 are signed:


Part 2. ARM assembly programming

Remark: Assume that the variables are loaded in some registers.

4. Write in ARM assembly language the following operations without using multiplication instruction (5p. each)

4.1. A * 17

4.2. A * 23

5. In ARM assembly program of only two instructions (addition and/or subtraction) implement the following calculation: a*105 (hint: 105=15*7). (8 p.)

6. Write an ARM assembly program that performs the following pseudo code. Assume that the variables are already loaded in some registers (8 p).

If (a==b) AND (c==d) then d = a +b + c + 1

7. In ARM assembly program calculate the absolute value of some variable a. (5p)

Hint: The pseudo code is:

if a<o then a=0-a.

8. Suppose that register r0 contains 0x20001400. Show the value (binary or hexadecimal) in the destination registers after every instruction. What is the final value of r2 after the execution of this peace of code? (4p):

MOVS r2, #0

ADD r2, r2, r0

Equal ADDLT r2, r2, #2

MOVNE r2, #&ABCD

MOV r2, #&FF

OK ;r2= . . . . .

9. (8p) Binary value 0xFFFFFFFF is loaded in r0 and 0x3FF80000 in r1. Show the value (binary or hexadecimal) in the destination register after every instruction. What is the final binary value in r2 after the following code? Considering the value in r2 as a signed number, what is the decimal value in r2?

start MOV r6,#0

ADDS r6, r6, #0

MOV r2, #&5

MOVS r2, #FF, ROR 8

Equal MOVPL r2, #2

Done MVNEQ r2, #3

MOVCS r2, #&FF

OK ;r2= . . . . .

10. (5p) Binary value 0xAB1FFFF2 is loaded in r0 and 0x3FF80000 in r1. Show the value (binary or hexadecimal) in every destination register after every instruction. What is the final binary value in r2 after the following code? Considering the value in r2 as a signed number, what is the decimal value in r2?

start MOV r6,#0

ADDS r6, r6, #0

MOV r2, #0

ADD r3, r0, r1

MVNGE r2, #2

MVNMI r2, #3

OK ;r2= . . . . .

11. (5 p.) Trace the following program and declare what will be the value in r0. Show the hexadecimal values in registers r0, r5, r6 and r7 after every instruction that is executed and changes some of those registers. Show the values of the flags after every instruction that changes the flags.

start MOV r6,#0

ADDS r6, r6, #0

MOV r0, #&FF

MOV r5, #0x7F

MOV r5, r5, ROR #8

MOV r6, r5

ADDS r7, r5, r6

MOVGE r0, #0xE5

12. Write ARM assembly program that performs the following pseudo code. It converts an unsigned integer 0≤i≤15 to a hexadecimal character c. Assume that the variables are already loaded in some registers (10 p).

IF (i<10) c= i +’0’ ;if the digit is 0 to 9

ELSE c =i + “A” -10 ;If the number is 10 to 15