ELEC2220-elec2220代写
时间:2024-02-07
ELEC 2220 Homework 03 – Three Points – Due February 6, 2024, 11:59 PM
Each bullet point is worth 0.1 points unless otherwise noted.
Turn in your answers as a single PDF. When screenshots are required, include them in the
PDF as well at the appropriate places.
The first few questions will use the program below. Questions #1-7 are in red in the
comments of the code. List the register values after that line executes (for example, #1 is
asking after that ldr r1, [r0] executes, what value will be in register 1?). You’re welcome to
paste the code into uVision and step through it to double check your answers.
AREA RESET, CODE
THUMB
ENTRY
Main
ldr r0, =Fourth
ldr r1, [r0] ;#1 - r1 = 0x
ldrb r2, [r0] ;#2 - r2 = 0x
ldr r0, =Output
strb r1, [r0, #2] ;#3 - r0 = 0x
ldr r1, =First
ldr r2, [r1, #4] ;#4 - r2 = 0x and #5 - r1 = 0x
strb r2, [r0]
ldr r3, [r1], #8 ;#6 - r3 = 0x and #7 - r1 = 0x
strb r3, [r0, #3]!
mov r1, #-3
strb r1, [r0, #-2] ;yes, that’s a negative two
b .
First DCD 17, 0x17, -1, 0x11117777
Second DCB 17, 0x17, -1, -7
Third DCB "Fourth!", 0
Fourth DCD 0xFEEDCA7 ;get it? Feed cat?
AREA HW03, DATA
Output space 4
END
8. After the above code executes to the “b .” infinite loop, what will be the contents of
Output array? (Give four bytes, in order as they’d be stored in memory, in hex).
9. To what address would each of the following labels point, assuming the data section starts
at address 0x20000000 and the First label points to 0x08000024?
a. Output
b. Second
c. Third
d. Fourth
10. How many bytes total would be required to represent the four write-only arrays?
11. Fill out the chart below with labels, memory addresses, and data (hex bytes) for the
First, Second, Third, and Fourth. I’ve started it with the First label and three addresses;
continue as far as needed to represent all the values. (0.4 points)
Label Address (in hex, 32 bits) Byte stored (in hex)
First 0x08000024
0x08000025
0x08000026
… continue chart as needed
12. To ensure you have a working uVision setup, be it in the Broun computer lab or on your
own device, as well as to give you debug/error practice… Paste the code below into a uVision
project. Then, find the five errors and correct them (these will all show up in the Build
Output window when you build the code). It may help to read the comments to figure out
what each line is supposed to do; feel free to reference the op code and error cheat sheets
on Canvas. Don’t be surprised if, after fixing an error, a new one pops up. That’s common.
Once these errors are fixed, run the code to the b . infinite loop and take a screenshot of
the full uVision window. This screenshot must include the file path in the upper left corner
all the way down to including the memory window in the bottom right. Have the memory
window show the start of the Data section so we can see the new Label value. If you need
to rotate it 90 degrees to fit into the document better/more legibly, you may do that.
What to turn in:
• List of changes made to the code and why (example: I changed x to y because that
op code doesn’t all z) for 0.5 points total
• Screenshot of uVision pasted into PDF submission as described for 0.8 points total.
AREA RESET, CODE
THUMB
ENTRY
Main
mov r0, #3 ;r0 = 3
add r1, #4, r0 ;r1 = r0 + 4
mov r2, #C9 ;r2 = 0x000000C9
mul r3, r2, r1 ;r3 = r2 * r1
ldr r0, =label ;r0 has base address of Label (0x20000000)
str [r0], r3 ;store r3 at the address in r0
b .
AREA MyData, DATA
Label space 4
END
essay、essay代写