Question

Write a program in ARM assembly language that copies each element of array A to consecutive...

Write a program in ARM assembly language that copies each element of array A to consecutive fourth elements of array B, i.e., A[0] to B[0], A[1] to B[3], A[2] to B[7], etc. The array A is 12 elements long, and each element is a number that is 32 bits (1 word) wide. Assume the base address of array A is in register R2, and the base address of array B is in R3.

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

The required program snippet for the above operation in ARM assembly with R2 as base address of array A snd R3 as base address of array B is as below.

MOV R4,#0 ; initialise loop counter

LOOP LDR R5,[R2],#4 ;load the word content 32bit array A element to R5 register and post increment R2 to point to nextvelement of array A

STR R5,[R3],#16 ;Store the word content 32bit into array B element from R5 register and post increment R3 to point to next 4th consicutive element of array B

ADD R4,R4,#1 ; increment loop counter

CMP R4,#12 ; checking condition for 12 elements

BNE LOOP ; repeats loop for 12 times till r4 is 12

Add a comment
Know the answer?
Add Answer to:
Write a program in ARM assembly language that copies each element of array A to consecutive...
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
  • Write a program in assembly language that loads register R2 with the word in memory location...

    Write a program in assembly language that loads register R2 with the word in memory location which is 10 bytes above the address in R0; and loads register R3 with the word in memory location which is 10 bytes below the address in R1. Your program must compare the two numbers in R2 and R3. If number in R2 is less than or equal to the number in R3 it must add the two numbers and save the result in...

  • IN ARM7TDMI Problem 2 ARM Assembly Programming; Splitting Array an - Write an ARM assembly program...

    IN ARM7TDMI Problem 2 ARM Assembly Programming; Splitting Array an - Write an ARM assembly program to split to the end. This program first accepts an array. Then splits specification. Now it becomes 2 parts and then add first part of an array at the end of the second part. Assume an array of size 50 elements and define its elements using DCD directive an array from specified position and add first part an array according to the user Draw...

  • Computer Architecture Please help me explain the answer 3 For the following statement, translate the statement to ARM assembly code. Assume that variable fand g are each in register rO, r1. Base addr...

    Computer Architecture Please help me explain the answer 3 For the following statement, translate the statement to ARM assembly code. Assume that variable fand g are each in register rO, r1. Base address of array A is in r3 and base address of array B is in r4. Temporary register is r5. f= g + A[B[3]] Ans) sol) LDR r5, 14, #12] ADD rs. r3. r5, LSL #2 LDR r5, [r3. #01 ADD rO, rl, r5 3 For the following...

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

  • For Computer Organization and Design: Suppose we have 3 arrays A, B, and C, array A’s...

    For Computer Organization and Design: Suppose we have 3 arrays A, B, and C, array A’s base address is in $S3, B’s base address is in $S4, C’s base address is in $S5. You can only use two temporal registers $t0 and $t1. Convert the following code into MIPS assembly language code. Suppose every array element occupies 1 word in MIPS (32 bits). A[20] = B[0] + C[6] - 1

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

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

  • C++. Write a program that copies the contents of one array into another array but in...

    C++. Write a program that copies the contents of one array into another array but in reverse order using pointers.           - in main()                    - define 2 arrays of type int, 10 elements each                              - initialize one array with numbers 1 through 10                              - initialize all elements of the second array to 0                    - call function reverseCopy with both arrays as arguments                    - display the values of array number 2 (reversed order)           - reverseCopy...

  • 1- Write a MIPS assembly program to initialize register Ss0 to 8, register Ssl to 12, regis- ter ...

    1- Write a MIPS assembly program to initialize register Ss0 to 8, register Ssl to 12, regis- ter Ss2 to 5, and register Ss3 to 2. Then, store register Ss0 in the first element of an array, register Ssl in the second element of the array, register Ss2 in the third element of the ar- ray, and register Ss3 in the fourth element of the array. Then, sort the elements of the ar- ray using the selection sort algorithm, and...

  • ARM assembly language Write a program "fibonacci.s" that computes the Nth Fibonacci number where N is...

    ARM assembly language Write a program "fibonacci.s" that computes the Nth Fibonacci number where N is not so large that overflow of integer arithmetic is a concern. When your assembly language program is called it should expect the value of N to be passed using register r0 and your program should return the Nth Fibonacci number in register r0. Please include comments as well. Do not just use the output generated by gcc -S

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