Question

Problem 1 Consider the piece of ARM Cortex MO+ assembly code given below and answer the following questions: mw 1.AGAIN CMP R
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Assembly code
1.AGAIN:CMP R0, #10 //compare R0 with 10
2.   BLE LESSEQUAL //if R0<=10 branch to LESSEQUAL
3.   MOVS R0, #0 //R0 = 0
4.   B DONE       //Branch to DONE
5.LESSEQUAL ADDS R0,R0,R1 //R0 = R0 +1
6.   B AGAIN       //Branch to label AGAIN
DONE
(1)R0 = 20 and R>10 it will Brach to DONE after setting R0=0 number of time instrction 5 executed=0.

(2)R0=0 R1=1. number of time instrction 4 executed=1

(3)R0=0 R1=2. number of time instrction 4 executed=1

(4)Infinite Loop ,R0 always less than 10

Add a comment
Know the answer?
Add Answer to:
Problem 1 Consider the piece of ARM Cortex MO+ assembly code given below and answer the...
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
  • 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...

  • 2. The table below holds MIPS assembly code fragments with different branch instructions LOOP addi $s2....

    2. The table below holds MIPS assembly code fragments with different branch instructions LOOP addi $s2. $s2. 2 subi $t1. st1. 1 bne t1. 0. LOOP DONE: LOOP: it st2. $0. stl beq t2. 0. DONE addi $s2. Ss2. 2 LOOP DONE: For the loops written in MIPS assembly in the above table, assume that the register Şt1 is initialized to the value of 10. What is the value in register $s2 assuming that $s2 initially has a value of...

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

  • Assignment 4: Answer the following questions with reference to the assembly program below. Before the code...

    Assignment 4: Answer the following questions with reference to the assembly program below. Before the code is executed, the initial content of memory and registers is shown in the figure below memory 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 address Use BIG ENDIAN, and 0x2000.0000 0x2000.0001 0x2000.0002 show all steps register 0x2000.0000RO Ox2000.0003 0x2000.0004 0x2000.0005 0xFFFF.FFFF R2 ox2000.0006 0x1234.5678 R3 0x2000.0007 Ox0000.0000 R1 LDRH R1, [R0 , #2]! LDRH R2 , [R0 , #2)! ADD R3, R1, R2 STR...

  • Consider the following RISC-V loop: (i) LOOP: beq x6, XO, DONE (ii) addi x6, x6, -1...

    Consider the following RISC-V loop: (i) LOOP: beq x6, XO, DONE (ii) addi x6, x6, -1 addi x5, x5, 2 (iv) slli x7, x5, 1 (iv) bge x5, XO, DONE (vi) jal x0, LOOP (vii) DONE: some-other-instruction Assume that the register x6 is initialized to the value 5, and x5 and x7 to the value 0. Find... a) Final value of x5 at the end of execution b)Final value of x7 at the end of execution c)Total number of instructions...

  • The classic five-stage pipeline MIPS architecture is used to execute the code fragments in this problem....

    The classic five-stage pipeline MIPS architecture is used to execute the code fragments in this problem. Assume the followings: The architecture fully supports forwarding, Register write is done in the first half of the clock cycle; register read is performed in the second half of the clock cycle, Branches are resolved in the third stage of the pipeline and the architecture does not utilize any branch prediction mechanism, Register R4 is initially 100. L1:  lw    R1, 0(R4)   add   R3, R1, R2 sw   ...

  • The classic five-stage pipeline MIPS architecture is used to execute the code fragments in this problem....

    The classic five-stage pipeline MIPS architecture is used to execute the code fragments in this problem. Assume the followings: • The architecture fully supports forwarding, • Register write is done in the first half of the clock cycle; register read is performed in the second half of the clock cycle, • Branches are resolved in the third stage of the pipeline and the architecture does not utilize any branch prediction mechanism, • Register R4 is initially 100. L1: lw add...

  • he classic five-stage pipeline MIPS architecture is used to execute the code fragments in this problem....

    he classic five-stage pipeline MIPS architecture is used to execute the code fragments in this problem. Assume the followings: The architecture fully supports forwarding, • Register write is done in the first half of the clock cycle; register read is performed in the second half of the clock cycle, • Branches are resolved in the third stage of the pipeline and the architecture does not utilize any branch prediction mechanism, • Register R4 is initially 100. Ll: lw add SW...

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

  • The classic five-stage pipeline MIPS architecture is used to execute the code fragments in this problem....

    The classic five-stage pipeline MIPS architecture is used to execute the code fragments in this problem. Assume the followings: • The architecture fully supports forwarding, • Register write is done in the first half of the clock cycle; register read is performed in the second half of the clock cycle, • Branches are resolved in the third stage of the pipeline and the architecture does not utilize any branch prediction mechanism, • Register R4 is initially 200. L1: lw lw...

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