20 May ARM Architecture
MSU Denver CS Computer Organization CS2400
Dr. Iliya Georgiev Spring 2018
Student Name: Rohit Shrestha
HW2- ARM Basics – due date February 19th
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 ……101(16)…….
2. Explain the register-displacement addressing mode. What stands for PC-relative addressing mode?
Ans: The addressing modes specify the address of instruction set. The register displacement addressing mode is used when a value is in a register. The register contains the value of the operand. The number of bits used to specify the register depends on the total number of registers from the processor set. For the operand specified in the register node, there is no memory access required.
E.g.: Add R1, R2: Adds the content of R1 and R2 and stores it n R1.
The PC-relative addressing mode is used in case of branch equal and branch not equal instructions. In this mode, larger range of memory cannot be addressed. It can be loaded anywhere in memory without the need of adjustment in any addresses. The effective address for a PC-relative instruction address is the offset parameter added to the address of the next instruction.
3. 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:
a. The numbers in r0 and r1 are unsigned:
b. 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
Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.
About Writedemy
We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.
How It Works
To make an Order you only need to click on “Order Now” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Are there Discounts?
All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.
