MSUD, CS 2400, Spring 2019
- Download and install VisUAL.
- Find out what UAL means in the context of ARM syntax.
- Review the instructions supported by VisUAL.
- Load the short negate program into VisUAL (Use Open from the menu).
- Execute the program. View the memory. (Use Tools from the menu.)
- QUESTION: What does the program do?
- Single-step the program and watch the registers, memory locations, and status flags change.
-
Load the long negate program into VisUAL (Use Open from the menu).
-
Execute the program. View the memory. (Use Tools from the menu.)
-
Answer the following questions:
- QUESTION 1: What is the short program doing that the long program is not?
The short program loops through the words array in a more efficient manner, while the long program stores most or all of the array seperately in registers
- QUESTION 2: Why do you think the compiler has generated such assembly code?
Because the computer has to track stack and pointer information for everything involved in the for loop, as well as calls/branches to the negate function.
- QUESTION 3: How would you try to change the code so that the compiler would generate an assembly program that behaves more like the short one above? The original code is in
negate.c
. Modify it and see if that changes the generated code. (The code is generated in the Compiler Explorer. Use the ARM gcc 8.2 compiler. Use the following compiler options:-fomit-frame-pointer -mcpu=cortex-m3 -mtune=cortex-m3
. Note: The assembly generated by the Compiler Explorer cannot be run directly in VisUAL. You might want to check the differences between the original generated code and the long negate program to see what modifications you have make.)
I would remove the loop and add individual calls to the negate function, or manually execute the negate instructions on each of the numbers we are using. This would eliminate the need for tracking pointers and stack information for the loop that is present in the longer program
-
Single-step the program and watch the registers, memory locations, and status flags change.
-
Modify the long program to do what the short one is doing.
- Fork this repository.
- Clone and develop.
- Commit your changes and push to the remote.
- Submit your fork's URL on the Google Classroom assignment CS 2400 - Classwork - ARM assembly negate exercise.