Question

Section B - ARM Assembly Language (25 marks) An ARM instruction set summary is provided at the end of this paper 1. (5 marks)

3. (5 marks) Write a single instruction that would subtract 5 from r1 (i.e., in C r1--5), only if the result of last comparis

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 "memory location" column and a "stored data" column, show the byte by byte values stored at each affected memory location (pay careful attention to data endianness) Additionally, what is the effect of this instruction on registers? Only write the name and new value of the registers that change 2. (10 marks) The following is the assembly language translation of a C function. mystery r1, #e cmp bne .L8 re, #e 1r myn bx .L8: r2, #e r12, [re] r3, г2 mov ldr mov .L3: ldr r2, [r0, r2, asl #2] r3, r3, #1 r12, r2 r12, r2 r3, r1 r2, r3 add cmp movcc cmp mov bne .L3 re, r12 Ir mov bx Annotate each line of the function with comments to explain what each line does. Write an equivalent C function and explain what it does. No gotos are allowed in C code.
3. (5 marks) Write a single instruction that would subtract 5 from r1 (i.e., in C r1--5), only if the result of last comparison instruction was an "greater than or equal". This instruction must not change the flags. unsigned C 4. (5 marks) Suppose that r1-0xffffffff and r2-0x2. After an "add rl,r2" instruction in Thumb-2 mode, what will be the values of r2, the negative (N) flag and the overflow (V) flag?
1 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer :- 1) STMFD will store multiple register value to the memory address present in first operand. Here values in register r5 and r6 will be stored from memory address 0x40003FFF . The memory and value table has been shown below.

memory location stored data
0x40003FFF 0x88
0x40003FFE 0x77
0x40003FFD 0x66
0x40003FFC 0x55
0x40003FFB 0x44
0x40003FFA 0x33
0x40003FF9 0x22
0x40003FF8 0x11

After execution, r13 = 0x40003FF7. Registers r5 and r6 are unchanged.

Answer :- 3) The instruction is-

SUBGE r1,r1,5 ; ri = r1-5, if last comparision instruction was unsigned

Add a comment
Know the answer?
Add Answer to:
Section B - ARM Assembly Language (25 marks) An ARM instruction set summary is provided at...
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
  • 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 =...

  • 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...

  • Q4 (10 marks): What are the values in registers R1, R2 and R3 at the end...

    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, #10 MOV R3, #10 L1: CMP R1, R3 BGE L3 BL L2 ADD R1, R1, #3 BL1 L2: ADD R2, R2, #3 MOV R15, R14 L3: MUL R3, R1, R2 Q5 (10 marks): Please write ARMv7 assembly program for following C programs. Assume that variables are stored in memory and their addresses can be...

  • 13) (4 pts) Squaring a number is useful in many other algorithms. This assembly routine calculates...

    13) (4 pts) Squaring a number is useful in many other algorithms. This assembly routine calculates the square of an unsigned integer. How long does this take in clock cycles (worst case). Assume ARM 32 bit instruction set and the integer is in R0 before we begin. AREA L.textl, CODE, READONLY PROC EXPORT square square MOV R1,RO; CMP R1, #0 ANDS R3,RO,R1 BNE skip ADD RO,R1, LSL R3; MOV R2,R2, LSL #1 CMP R2, #0 BNE loop BX LR loop...

  • IF statement is translated into assembly language with a o CMP instruction followed by Conditiona...

    IF statement is translated into assembly language with a o CMP instruction followed by Conditional jumps. If op1 or op2 is a memory operand o IF Statemert (a variable): o one of them must be moved Problem 3: Implement the following pseudocode in assembly language. to a register before executing CMP. All values are unsigned: стр ьї, ci ja next mov al,5 mov dl,6 al-50 dl-23 next: Add to the above code the mov instructions and assign values to bl,...

  • Could you please help me doing this? Slide #14: Slide #15 The question: ARM Assembly Language...

    Could you please help me doing this? Slide #14: Slide #15 The question: ARM Assembly Language label mnemonic operand1, operand2, operand3 comments R2+R1->R3 Loc ADD R3, R2 R1 Label is a symbolic reference to this instruction's address in memory. Mnemonic represents the operation to be performed .The number of operands varies, depending on each specific instruction. Some instructions have no operands at all. operand1 is typically the destination register, and operand2 and operand3 are source operands. operand2 is usually a...

  • Stack Operation 10. (10 pts.) Show the contents of the stack and affected registers at the two marked points in the exe...

    Stack Operation 10. (10 pts.) Show the contents of the stack and affected registers at the two marked points in the execution of the followin code. Assume RO-0, R1-1, R2-2, R3-3, R4-4, R5-5, and R6-6. The initial value for stack pointer (prior to executing this code block) is given as SP-0x20001000 PUSH R2,R3) ADD R4, R1, Re ;<---A POP R5, R6) ADD R5, R5, R4 ADD R6, R6, R5 PUSH (R4-R6); SUBS Re, RO,R1-B a) Show the contents of Stack,...

  • Question 3: ARM Processor a) What is the number of bits in a general-purpose register (e.g., R1) of the ARM Cortex-M4 processor (CPU)? b) What is the number of bits in a memory address for the ARM pr...

    Question 3: ARM Processor a) What is the number of bits in a general-purpose register (e.g., R1) of the ARM Cortex-M4 processor (CPU)? b) What is the number of bits in a memory address for the ARM processor architecture? c) What is the number of bits in an assembly instruction for the ARM Thumb-2 instruction set? d) Consider the memory map used with the TM4C123 microcontroller shown below. If the stack is in data memory, what is the initial address...

  • 1. Translate the following tasks into a single ARM instruction: a. Add 32 times of the...

    1. Translate the following tasks into a single ARM instruction: a. Add 32 times of the content of registers r0 and the content of r1 only if N is clear. Store the result in register r2 b. Subtract the content of register r0 from 0x990 and put the results in register r3 only if C is set and Z is clear. c. Clear the 2nd least significant byte of the content of register r1, i.e., store (00000000)2 in it, and...

  • A C program has been compiled into the Atmel AVR assembly language. The following instruction, which...

    A C program has been compiled into the Atmel AVR assembly language. The following instruction, which is located at address 0x002A, is executed: i.) What is the binary value contained in the instruction register (IR) when the instruction is executed? ii.) What is the hexadecimal value of the program counter (PC) when the instruction is executed? iii.) If register r1 = 0x40 and register r2 = 0x02 prior to executing the instruction, what are the contents of r1 and r2...

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