Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Step 1: Create a new ASSEMBLY project using Keil Software Make sure vou use the M3 option Step 2: Copy the following template to your

image text in transcribed

Step 1: Create a new ASSEMBLY project using Keil Software Make sure vou use the M3 option Step 2: Copy the following template to your assembly file AREA Lab 06 YourFirstName YourLastName, CODE, READONLY EXPORT main main MOV R0, SP; MOV R1, #1 ; MOV R2, #20: MOV R3, #0 ; Replace_with base register. R1 will be used to increment the loop R2 will represent the number of iterations R3 will be used to hold the sum of the array. storeValuesLoop STR R1, [R0], #4: Store the value of R1 to address of R0, then auto increment the address bv 4. Hint use STR instruction ADD R1, #1: Increment the Loop by adding 1 to R1 CMP R1, R2; Compare R1 & R2 to determine if we need to exit the loop or not BLE storeValuesLoop; Stay in the loop if R1 is less than or equal to R2 MOV R1, #1 ; Reset RI to start from the beginning again for the 2nd loop MOV R0, SP; readValuesLoop LDR R4, [R0], #4: Read the value of current iteration to R4. Hint use LDR instruction. ADD R3, R4; Add the value your read [R4] to the sum [R3] ADD R1, #1; Increment the Loop by adding 1 to R1 CMP R1, R2; Compare R1 & R2 to determine if we need to exit the loop or not BLE readValuesLoop; Stay in the loop if R1 is less than or equal to R2 stop B stop END Step 3: Change YourFirstName to vour first name Change YourLastName to your last name Step 4: Modify store ValuesLoop from using the STR-Post-indexed-autoindexing-post incrementing to STR-Pre-indexed-autoindexing pre-incrementing You are ONLY allowed to modify the highlighted line inside the storeValuesLoop loop Step 5: Modify readValuesLoop from using the LDR-Post-indexed-autoindexing-post incrementing to LDR- indexed-Double Register with Scaling You are ONLY allowed to modify the highlighted line inside the readValuesLoop loop. Step 6: After testing your program, answer the 2 questions in Blackboard quiz by filling the blanks. Make sure that you don't ADD any comments to your code and add only 1 space after each commna Example: For question i, you will enter: STR R4, [R0], #4 For question 2, you will enter: LDR R4, [R0], #4 Step 1: Create a new ASSEMBLY project using Keil Software Make sure vou use the M3 option Step 2: Copy the following template to your assembly file AREA Lab 06 YourFirstName YourLastName, CODE, READONLY EXPORT main main MOV R0, SP; MOV R1, #1 ; MOV R2, #20: MOV R3, #0 ; Replace_with base register. R1 will be used to increment the loop R2 will represent the number of iterations R3 will be used to hold the sum of the array. storeValuesLoop STR R1, [R0], #4: Store the value of R1 to address of R0, then auto increment the address bv 4. Hint use STR instruction ADD R1, #1: Increment the Loop by adding 1 to R1 CMP R1, R2; Compare R1 & R2 to determine if we need to exit the loop or not BLE storeValuesLoop; Stay in the loop if R1 is less than or equal to R2 MOV R1, #1 ; Reset RI to start from the beginning again for the 2nd loop MOV R0, SP; readValuesLoop LDR R4, [R0], #4: Read the value of current iteration to R4. Hint use LDR instruction. ADD R3, R4; Add the value your read [R4] to the sum [R3] ADD R1, #1; Increment the Loop by adding 1 to R1 CMP R1, R2; Compare R1 & R2 to determine if we need to exit the loop or not BLE readValuesLoop; Stay in the loop if R1 is less than or equal to R2 stop B stop END Step 3: Change YourFirstName to vour first name Change YourLastName to your last name Step 4: Modify store ValuesLoop from using the STR-Post-indexed-autoindexing-post incrementing to STR-Pre-indexed-autoindexing pre-incrementing You are ONLY allowed to modify the highlighted line inside the storeValuesLoop loop Step 5: Modify readValuesLoop from using the LDR-Post-indexed-autoindexing-post incrementing to LDR- indexed-Double Register with Scaling You are ONLY allowed to modify the highlighted line inside the readValuesLoop loop. Step 6: After testing your program, answer the 2 questions in Blackboard quiz by filling the blanks. Make sure that you don't ADD any comments to your code and add only 1 space after each commna Example: For question i, you will enter: STR R4, [R0], #4 For question 2, you will enter: LDR R4, [R0], #4

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

From Herds To Insights Harnessing Data Analytics For Sustainable Livestock Farming

Authors: Prof Suresh Neethirajan

1st Edition

B0CFD6K6KK, 979-8857075487

More Books

Students also viewed these Databases questions