Question

Q4 (10 marks): What are the values in registers R1, R2 and R3 at the end of this ARMv7 assembly program? MOV R1, #2 MOV R2, #

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Q4:

Initially the values stored in the register are :

  • R1 = 2
  • R2 = 10
  • R3 = 10

L1 :

Compare R1 and R3  ---> 2 > 10 , NO hence it will skip to the next step -- BL L2 => branches to L2

L2 :  R2 gets updated to R2 = 10 + 3 => 13 and value in R14  gets stored in R15 .

Next step - R1 gets updated to R1 = 2 + 3 => R1 = 5 and gets stored in R1 register.

Now, the updated values are :

  • R1 = 5
  • R2 = 13
  • R3 = 10

L1 :

Compare R1 and R3  ---> 5 > 10 , NO hence it will skip to the next step -- BL L2 => branches to L2

L2 :  R2 gets updated to R2 = 13 + 3 => 16 and value in R14  gets stored in R15 .

Next step - R1 gets updated to R1 = 5 + 3 => R1 = 8 and gets stored in R1 register.

Now, the updated values are :

  • R1 = 8
  • R2 = 16
  • R3 = 10

L1 :

Compare R1 and R3  ---> 8 > 10 , NO hence it will skip to the next step -- BL L2 => branches to L2

L2 :  R2 gets updated to R2 = 16 + 3 => 19 and value in R14  gets stored in R15 .

Next step - R1 gets updated to R1 = 8 + 3 => R1 = 11 and gets stored in R1 register.

Now, the updated values are :

  • R1 = 11
  • R2 = 19
  • R3 = 10

L1 :

Compare R1 and R3  ---> 11 > 10 , YES hence it will go to the next step -- BGE L3 => branch on if >= 0 , implied branches to L3

L3 :  R3gets updated to R3 = 11 * 19 => 209

Now, the updated values are :

  • R1 = 11
  • R2 = 19
  • R3 = 209

The last values are the final updated values.

Q5:

Please find the below ARMv7 assembly languauge code for the given C language code:

MOV R1, 10
CMP R1, R2
JLE L1
MOV AX, R1
ADD AX, R2
ADD AX, R2
MOV R3, AX
JMP L2
L1:
MOV R3, R1
MOV AX, R1
SUB AX, R1
MOV R2, AX
L2:
MOV AX, R3
ADD AX, 2
MOV R3, AX
INT 03

Add a comment
Know the answer?
Add Answer to:
Q4 (10 marks): What are the values in registers R1, R2 and R3 at the end...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please help by showing steps. Question 4. (continued) (b) Consider a 16-bit binary number stored in AVR registers r1...

    Please help by showing steps. Question 4. (continued) (b) Consider a 16-bit binary number stored in AVR registers r15:r14 which the programmer considers to be a two's complement value. (r15 holds the most significant byte, r14 holds the least significant.) Write down a sequence of AVR assembly language instructions which perform each of the following operations The result should end up in r15:r14. Other registers can be used freely if required i) Sets r15:r14 to the constant value-1 (2 marks)...

  • Write an equivalent C function and explain what it computes. 3. (10 marks) The following is...

    Write an equivalent C function and explain what it computes. 3. (10 marks) The following is the assembly language translation of a C function mystery: r3, [r0, #0] r3, #0 L3 ldrb cmp beq r3, #0 mov L4: r3, r3, #1 r2, [ro, r3] r2, #0 L4 add ldrb cmp bne .L3: ro, r3 lr mov bx Annotate each line of the function with commentss to explain what each line does. Write an equivalent C function and explain what it...

  • Section B - ARM Assembly Language (25 marks) An ARM instruction set summary is provided at...

    Section B - ARM Assembly Language (25 marks) An ARM instruction set summary is provided at the end of this paper 1. (5 marks) Consider the following assembly instruction STMFD r13!, (r5-6} Before executing this instruction, registers hold the following values: Register Value Register r9 Value r4 0x00400040 0x00000000 r5 r10 0x11223344 0x00800080 r6 0x55667788 r11 0x10001000 r7 0x99aabbcc r12 0x20002000 r8 exddeeff00 r13 ex40004000 What memory locations are affected after executing the above instruction? In a table, with a...

  • Registers R1 and R2 of a computer contain the decimal values 12000 and 6000 respectively. What...

    Registers R1 and R2 of a computer contain the decimal values 12000 and 6000 respectively. What is the Effective Address of the memory operand in each of the following instructions?             i) MOV 20(R1), R5           ii) STORE R5, 30(RF1,R2)              iii) LOAD #3000, R5        iv) ADD -(R2),R5

  • . (10 pt) Registers R1 and R2 hold the values given below. Write down the values...

    . (10 pt) Registers R1 and R2 hold the values given below. Write down the values in R3 and R4 after executing each group of instructions given below. Assume that each group of instructions is independent of each other and each group uses the register values given below. Show your work. Rl = 00AA BB1116 R2 0000 0010016 multu R1, R2 mfhi R3 R3= 16 mflo R4 R4 = 16 divu R1, R2 mfhi R3 R3= 16 mflo R4 R4=...

  • please solve problems 1 and problems 2. PROBLEM 1: Derive state-space equations for the following circuit in the form of L1 where χ = :L2 L3 L1 and (a) y 7 V L3 R1 L1 L3 R3 Vt R2 Vc し2 (c) For Part (...

    please solve problems 1 and problems 2. PROBLEM 1: Derive state-space equations for the following circuit in the form of L1 where χ = :L2 L3 L1 and (a) y 7 V L3 R1 L1 L3 R3 Vt R2 Vc し2 (c) For Part (a), use the file CircuitStateSpace.slx (define the four matrices in Matlab) to verify your derivation using the following numerical values: R1-1; R3-1 R2-10; L1-1e-3 L3-1e-3 L2-10e-2 ; C1-10e-6 PROBLEM 2: (a) What are eigenvalues of the...

  • R2 R1 R3 Equivalent Resistance and current (10 pts) 1. R1 = 4 Ω R2-50 R3...

    R2 R1 R3 Equivalent Resistance and current (10 pts) 1. R1 = 4 Ω R2-50 R3 = 3 Ω For each arrangement of resistors (a)-(d), find the equivalent resistance between points x and y. Show your work. i. ii. Answer the following for arrangement (d) only, the voltage difference between x and y is 12 V What is the current through each resistor, that is, what is . l2, and Iz. What is the potential difference across each resistor, that...

  • Question 2 ARM Assembly Language (25 marks) An ARM instruction set summary is provided at the...

    Question 2 ARM Assembly Language (25 marks) An ARM instruction set summary is provided at the end of this paper. (5 marks) Explain the difference between eor and eors instruction. Use an example to show why both forms are useful. а. b. (5 marks) Explain using an example what the "Idr r3, [r7,#4]" instruction does. c. (10 marks) The following is the assembly language generated by a C compile type mystery, %function mystery: args 0, pretend = 0, frame =...

  • Implement the following statements using MS430 assembly instructions. You may use more than one, ...

    Implement the following statements using MS430 assembly instructions. You may use more than one, but you should minimize the number of instructions required. You can use both native and emulated instructions. Use hex notation for all numbers 1. (a) Move the word located in register R14 to R15 (b) Increment the word in R6 by 2. (c) Perform a bitwise ANDing of the word located at address 0x0240 with the datum in R15, placing the results in R15. (d) Rotate...

  • Question [5x2 marks 10 marks] In the circuit in Figure 4, the resistance value R1, R2,...

    Question [5x2 marks 10 marks] In the circuit in Figure 4, the resistance value R1, R2, R3 and R4 have a value of 30, 40, 40 and 50 (a) Find the equivalent resistance (Req) in the circuit (b) Determine the current through each resistance 1 to 14. (c) Determine the power dissipated by each resistor and the power delivered by the independence voltage source. Confirm that the power delivered by the independent source is the same as the power absorbed...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT