Question

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 put the results in register r4. The result of the instruction must affect the value of the Current Program Status Register (CPSR).

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

MOV R5,#32 ;initializing counter

loop: ADDPL R2,R0,R1 ;adding contents of RO and R1 and saving the result in R2 only if N is clear

SUB R5,R5,#01 ;decrementing counter

BNE loop ;if Z is not set,that is ,counter is not zero then the branch will take place

RSBHI R3,R0,0x990 ; if C is set and Z is clear,contents of R0 will be subtracted from 0x990

BIC R4,R1,0b0000000011111111   ;getting content of the 2nd least significant byte of the content of register r1 and storing it into R4 by bit clearing the least significant byte.

SUB R4,R4,R1 ;this instruction will make the  2nd least significant byte of the content of register r1 zero and assuming that the  least significant byte of the content of register r1 is not 00000000,N flag in the CPSR will be set. ;

Add a comment
Know the answer?
Add Answer to:
1. Translate the following tasks into a single ARM instruction: a. Add 32 times of 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
  • 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...

  • Exercise 1 (9 pts) We have seen that ARM has 16*32 bits registers (plus floating point...

    Exercise 1 (9 pts) We have seen that ARM has 16*32 bits registers (plus floating point registers) There is also a status register: CPSR. It contains, among other things, the following important status bits N Negative, set when the result of an arithmetic operation is negative (according to the two's complement encoding of the natural numbers . Z- Zero, set when the result of an operation is zero . C Carry, set when an operation results in a carry bit...

  • 1. The following instruction(s),--, is (are) ARM® Cortex®-M4 assembly instructions. a. ui32int uiLoop c. void_WFI(void)...

    1. The following instruction(s),--, is (are) ARM® Cortex®-M4 assembly instructions. a. ui32int uiLoop c. void_WFI(void); d. WFI 2. The ARM® Cortex-M4 assembly instructions contain. a. Label field b. Operation field and operands field c. Operation field, op erands field and comment field d. Both a and c Copyrighted material Homework 245 3. The pseudo instruction DCW 2 is to a. Reserve 2-byte space for a data item in the program b. Reserve 2 hal f-word space for a data item...

  • Consider the following operations: A B- C The corresponding assembly code instruction list generated by a compiler are 1 load [%r0 +4], %r1 2 load [%r0 + 8], %r2 3 sub %r1, %r2,%r3 4 load [ZrO + 1...

    Consider the following operations: A B- C The corresponding assembly code instruction list generated by a compiler are 1 load [%r0 +4], %r1 2 load [%r0 + 8], %r2 3 sub %r1, %r2,%r3 4 load [ZrO + 12], %r4 5 add %r3, %r4 , %r5 6 store %r3, [%r0 + 16] 7 store %r5, [%r0 + 20] a) Identify the potential pipeline hazards. (10 points) b) State if the found hazards can be eliminated and if so propose a scheme...

  • You are given a homework processor (HPro) capable of addressing 32 8-bit (1 byte) wide registers....

    You are given a homework processor (HPro) capable of addressing 32 8-bit (1 byte) wide registers. However, it has only 29 physical registers. Register RO, R1 and R31 are not physically implemented. Instead, every read from RO, R1 and R31 will return a constant zero (00000000), constant one (00000001) and all ones (11111111), respectively. Every write to RO, R1 and R31 will go to null (dummy write). Assume that all other registers have initially unknown (X) state (This in fact...

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

  • its microprocessors help please Im sorry but thats the picture i can provide and all i cam say is that its microprocessors with ARM assembly lamguage.. 1) Draw a flow chart and an assemble program...

    its microprocessors help please Im sorry but thats the picture i can provide and all i cam say is that its microprocessors with ARM assembly lamguage.. 1) Draw a flow chart and an assemble program to Note: the reader is serial a. Open a save box b. Press the number 96357 on the save box key c. If the number pressed is not the corresponding number rest d. After three fail, the save box will be locked for a long...

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

  • third photo is problem 8 pt 2. anything would help please Problem 7 (15pts) Convert this...

    third photo is problem 8 pt 2. anything would help please Problem 7 (15pts) Convert this following pseudo-code in high level language into a piece of an assembly code (NIOS 2). In the following pseudo-code in high level language, r4, r5, r6, and r10 represent registers 4,5, 6, and 10, respectively Consider this pseudo-code in high level language: If ! (r4 >r5 or rs <r6) r10=r10+1 else r10- r10-1 This becomes the following piece in assembly code (put you answers...

  • Write a program in ARM assembly using ARMSim# to perform the following tasks: 1. Open a...

    Write a program in ARM assembly using ARMSim# to perform the following tasks: 1. Open a file named "integers.dat" and keep track of the following information: a.The first integer value is (i) b. The ith integer value is (j) c. Count the total number of integers in the file d. Count the number of integers that are less than j e. Count how many even numbers are less than j f. And how many odd numbers are less than j...

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