Starting from:

$29.99

CSS422 Homework 2 Solution

Q1. (4 pts) Application Program Status Register (APSR)’s flags
After the following piece of instructions is executed, what value will be maintained in each of NZCV flags in APSR?
MOV R0, #0x80000000
MOV R1, #0x1
SUBS R2, R1, R0
Flag Value
N I
Z
C
V
Q2. (6 pts) Memory Endianness and Alignment
1) As you see the following example with #1234 at memory address 0x20000000, allocate #9876543210 to memory address 0x20001000. (2pts) An example:
Big endian 06402
Address Data Contents (in hex)
0x20000000 04
0x20000001 D2
0x20000002
0x20000003
Address Data Contents (in hex)
0x20001000 D2
0x20001001 04
0x20001002
0x20001003
Little endian
9826543210
16 617283950 10A

A question you must solve: 16 38580246 14
of 2411265 6
16 150704 I 16 9419 O
16 588 NBS
16 36 126
16 2 4
16 0 2
34 B EA

#9876543210
Big endian
Address Data Contents (in hex)
0x20000000
0x20000001
0x20000002
0x20000003
Little endian EA
Address Data Contents (in hex)
0x20001000 EA
0x20001001 16
0x20001002 BO
0x20001003 4C
oz

2) As you see the following example with exampleData, allocate myData to the memory and fill out the spaces to indicate how each data element is mapped. Assume that the memory is based on a 32 -bit addressing system. (2pts)
An example:
struct exampleData {
char a; short b;
};
+ 0th + 1st + 2nd + 3rd
0th byte a b b
4th byte
8th byte

Q3. (10 pts) Introduction to VisUAL
Complete the following assembly program that 1) read characters (i.e., ‘A’, ‘B’, ‘C’, ‘D’, ‘E’, ‘F’, ‘G’, ‘H’, ‘I’, ‘J’, ‘K’, ‘L’) given at address “src”, 2) change them to the corresponding lower-cased characters, and 3) store them at address “dst”.
Submission: You need to submit two files.
File 1 (5pts): Your HW2-Q3.s.
File 2 (5pts): A pdf file with:
1. (1pts) A screenshot of your code.
2. (4pts) A screenshot of VisUAL’s “View Memory Contents” window.


More products