Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This program adds a scalar value to all the elements in one array and stores that in another array. ; int main() ;{ ; const

image text in transcribed

image text in transcribed

image text in transcribed

This program adds a scalar value to all the elements in one array and stores that in another array. ; int main() ;{ ; const int size = 8; int x[size] = {13000, 298, -4729, 698, -2700, 5267, -1, 32641}; int y[size]; int a = 1307; int i; for (i = 0; i = 0, done (24) LDR r4, [ro] x[i] (28) ADD r4, r4, r5 ; r4 = x[i] + a (32) STR r4, [r1] ; y[i] x[i] + a (36) ADD ro, ro, #4 ; update ro to point to next element of x (40) ADD ri, r1, #4 ; update ri to point to next element of y (44) ADD r3, r3, #1 ; i++ (48) B loop (52) B done (56) DCD 8 (60) DCD 1307 (64) x has addresses (68-99) DCD 13000, 298, -4729, 698, -2700, 5267, -1, 32641 ; y has addresses (100-131) SPACE 32 DCD 0 ; (132) END done size a In the memory map popup window, enter a map range equal to the current mapped region, with the beginning and ending address separated by a comma. Click on Read, Write, and Execute. Then, click on Map Range. You should see write added to the current mapped range. Click Close. Set a break point on the done B done instruction (line 34). Down in the bottom right of the Keil Simulator window, click on the Memory 1 tab and enter 0 as the Address at the top. This window shows you everything that has been put in memory, both instructions and data. The starting address of the line is followed by a colon and then each byte separated by a space. Red indicates that a data item has been read and green indicates that a data item has been written. Run the program and answer the following questions: 1. What is the value of the PC (decimal and hexadecimal) when the program ends execution? 2. What are the memory addresses associated with x? 3. What are the memory addresses associated with y? 4. What values are stored in y (decimal and hexadecimal)? 5. Are they correct? This program adds a scalar value to all the elements in one array and stores that in another array. ; int main() ;{ ; const int size = 8; int x[size] = {13000, 298, -4729, 698, -2700, 5267, -1, 32641}; int y[size]; int a = 1307; int i; for (i = 0; i = 0, done (24) LDR r4, [ro] x[i] (28) ADD r4, r4, r5 ; r4 = x[i] + a (32) STR r4, [r1] ; y[i] x[i] + a (36) ADD ro, ro, #4 ; update ro to point to next element of x (40) ADD ri, r1, #4 ; update ri to point to next element of y (44) ADD r3, r3, #1 ; i++ (48) B loop (52) B done (56) DCD 8 (60) DCD 1307 (64) x has addresses (68-99) DCD 13000, 298, -4729, 698, -2700, 5267, -1, 32641 ; y has addresses (100-131) SPACE 32 DCD 0 ; (132) END done size a In the memory map popup window, enter a map range equal to the current mapped region, with the beginning and ending address separated by a comma. Click on Read, Write, and Execute. Then, click on Map Range. You should see write added to the current mapped range. Click Close. Set a break point on the done B done instruction (line 34). Down in the bottom right of the Keil Simulator window, click on the Memory 1 tab and enter 0 as the Address at the top. This window shows you everything that has been put in memory, both instructions and data. The starting address of the line is followed by a colon and then each byte separated by a space. Red indicates that a data item has been read and green indicates that a data item has been written. Run the program and answer the following questions: 1. What is the value of the PC (decimal and hexadecimal) when the program ends execution? 2. What are the memory addresses associated with x? 3. What are the memory addresses associated with y? 4. What values are stored in y (decimal and hexadecimal)? 5. Are they correct

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Distributed Relational Database Architecture Connectivity Guide

Authors: Teresa Hopper

4th Edition

0133983064, 978-0133983067

More Books

Students also viewed these Databases questions

Question

6. Explain how to train managers to coach employees.

Answered: 1 week ago

Question

5. Tell how job experiences can be used for skill development.

Answered: 1 week ago