202204/CST308/A
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
202204/CST308/A
Question 1: (5 marks) [CLO1ÆPLO1: C2]
Suppose $t0 is initialized with 0x1234ABCD. After the execution ofthe following instructions, what data will $t0 contain in the little endian system and big endian system?
sw $t0, 0($0)
lb $t0, 3($0)
Question 2: (5 marks) [CLO2ÆPLO2: C3]
i. Suppose a computer A executes a program in 198 seconds in the year 2000 and the upgraded computer B executes the same program in 148 seconds in the year 2002. Compute the speedup that the manufacturer has achieved over a period of two years.
ii. Suppose a program took 76 seconds to execute. How much reduction in execution time of a program is required if we want to achieve the speedup of 3?
Question 3: (5 marks) [CLO2ÆPLO2: C3]
Produce the corresponding MIPS assembly code for the following C/C++ instructions. Note: initialize x to $t0, y to $t1, and z to $s0. Give comments for each instruction. z = x + y + 4;
do {
z = z - x;
++y;
} while (z > 3);
Question 4: (10 marks) [CLO2ÆPLO2: C3]
Produce the equivalent machine code (hexadecimal format) for the following MIPS instructions. Use the MIPS green sheet to show the type and values of each fields of the instruction such as
i. add $t4 $s6 $s7
ii. lw $t8, 0xAE, $s0
iii. addi $s5, $0, -20
iv. sw $s1, -7, $s2
v. slti $t1, $t2, 0x10
Question 5: (25 marks) [CLO2ÆPLO2: C3]
i. Produce the equivalent MIPS assembly code for the following machine code. Suppose
$a0 is the input and initialized with any positive value whereas $v0 is the output.
Note: Show instruction type and format as shown in Question 4 .
[16 marks]
Memory Address |
Machine Code |
Find Equivalent MIPS code |
0x00400000 |
0x02004020 |
|
0x00400004 |
0x21090001 |
|
0x00400008 |
0x0089502A |
|
0x0040000C |
0x15600003 |
|
0x00400010 |
0x01094020 |
|
0x00400014 |
0x21290002 |
|
0x00400018 |
0x08100002 |
|
0x0040001C |
0x01001020 |
|
ii. Once the MIPS code is generated, briefly explain the functionality of the code and generate an equivalent C/C++ code. [4 + 5 marks]
Question 6: (10 marks) [CLO2ÆPLO2: C3]
Consider the following information for direct-mapped memory:
Main memory size = 256 MB
Cache size = 512 KB
Block size = 256 Byte
Word size = 1 Byte
Compute the following by showing the calculation steps. [2.5 marks each]
i. Byte offset
ii. Cache lines (index)
iii. Tag
iv. Size of physical address
2022-07-13