Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code_______________________________________________________________________________________________________ MOV R0, #0 ; R0 will accumulate the sum MOV R1, #2 ; R1 will have the update even number MOV R2, #5 ;

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribedimage text in transcribedimage text in transcribed

Code_______________________________________________________________________________________________________

MOV R0, #0 ; R0 will accumulate the sum

MOV R1, #2 ; R1 will have the update even number

MOV R2, #5 ; the counter for the loop

lbegin

CMP R2, #0 ; If R2 != 0 continue with the next instructions

BEQ lend

ADD R0, R0, R1

ADD R1, R1, #2

SUB R2, R2, #1 ; branch unconditionally to lbegin

B lbegin

lend

0. Objectives This lab will introduce you to VisUAL - a tool for editing, assembling and simulating a subset of ARM instructions. VisUAL is used in Lab1a, HW2, and HW3 to let you assimilate the ARM assembly instruction set. 1. Download VisUAL Vi and click "Downloads" to download VisUAL. Please choose the version corresponding to your operating systems, (Windows, MacOS, and Ubuntu). Follow the installation instructions carefully. 2. User Guide From the main menu, please click "User Guide" to see VisUAL's functionality, You don't have to read all. All you need is to frequently check "List of supported instructions" when receiving simulation errors upon your code execution, as VisUAL's instruction set is quite limited. 3. Coding and Simulation Upon starting VisUAL, you'll see the following window that allows you to code an ARM program on its left and to check the contents of CPU registers on the right. Complete the following program that sums up 10 integers that are 10,9,8,7,6,5,4,3,2, and 1 . R0 is used to maintain an intermediate and the final sum. The result of R0 should be stored into the "sum" variable at address 0x0100 (line 2in the example code). Please note that VisUAL uses memory address 0x00000x00FF for code (which is actually not visible from the simulator) and thus allocates any readable/writable data to the memory space starting at 0x0100. When you define "sum" as shown below (line 2), sum occupies memory 0r0100 - 0x0103 because an integer needs 4 bytes. VisUAL's menu buttons on the right side are quite descriptive: 1. To execute your program, click "Execute" 2. To stop your program, click "Reset", which goes back to your code-editing mode. 3. To run your program in a single atep, click "Step Forwards". 4. To reverse back your program execution, click "Step Backwards". 5. To view the memory contents, click "Tools" on VisUAL's left top menu and thereafter choose "View memory contents", which opens a "View Memory Contents" window. Set the memory region: Start address: 0100, End address: 0200 Please make sure to save your code by clicking "Save As". Your file name should be Labla.s. Please don't forget to add ". 9 " as the assembler file attribute. Hints for your Lab la (You may write one line of code for each of the following hint): 1. R.1 works as a counter and maintains each integer starting with 10 and decrementing all the way to 0 . 2. Use "CMP R1, \#0" to check if R1 reaches 0 . 3. Use "BEQ done" to jump to "done" if R1 reaches 0. 4. Use ADD to add R1 to R0. 5. Use SUB to decrement R1 by 1 every time. 6. Use B to go back to the top of loop. What to submit 1. Your source code named "Lab1a.s". You need to add comment to every line of your code (not necessary for the provided lines of code)! Otherwise, you will get 0 for this lab. 2. A pdf file with a. snapshots of VisUAL's register contents and memory contents at 01000103, b. copy of your code (yes, copy the source code into the pdf file too), and c. a short paragraph summarizing your learning through this lab. Lab1a.5 - VisUAL Start address: 0100, End address: 0200

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

Beginning Microsoft SQL Server 2012 Programming

Authors: Paul Atkinson, Robert Vieira

1st Edition

1118102282, 9781118102282

More Books

Students also viewed these Databases questions