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

  • A data scientist needs a MIPS assembly-language program for data analysis. He has three arrays of...

    A data scientist needs a MIPS assembly-language program for data analysis. He has three arrays of floating-point numbers. Array 'a' is a source array, and 'b' and 'c' are result arrays. Array 'a' contains '2n' floating-point numbers. 'r1' is the address of 'a[0]'. 'r4' is the address of the byte immediately following 'a', i.e., the address of the imaginary element 'a[2n]'. Each of 'b' and 'c' can store 'n' floating-point numbers. 'r2' is the address of 'b[0]'. 'r3' is the...

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

  • Write an ARM assembly language program to translate the following sequence of statements . Assume x...

    Write an ARM assembly language program to translate the following sequence of statements . Assume x and y are memory locations that store two unsigned integers. Use the following: x is in R1, y is in R2, and z in R3. Make sure that your program works for any value of x and y. if (x > 15) {     x = 1;     if (y > 15) {          y = 2;         } else {       y =...

  • 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 ARM assembly language program to collect the correct amount of road toll tax from...

    Write an ARM assembly language program to collect the correct amount of road toll tax from a vehicle. If the vehicle is a motorbike then the correct road toll tax should be 2, otherwise the road toll tax should be 5. The vehicle type is given to you, so you don’t have to guess. Assume that someone has already put the vehicle type value in register R0. Therefore, R0 contains a value, 0 or some other value. If the value...

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

  • 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

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

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