Please help with the below 3 questions. The more detail the work shown, the bett
ID: 3825932 • Letter: P
Question
Please help with the below 3 questions. The more detail the work shown, the better for my understanding. Thank you so much!
1. What is the value in R4 (in hexadecimal) after the following instructions are executed?
MOV.w #0x0, R4 ; R4 =
ADD.w #0x02, R4 ; R4 =
RLA.w R4 ; R4 =
RLA.w R4 ; R4 =
2. What is the value in R5 (in hexadecimal) after the following instructions are executed?
MOV.w #0xF008, R5 ;R5 =
RRA.w R5 ;R5 = ; 1111 0000 0000 1001 -> 1111 1000 0000 0100 C=1
RRC.w R5 ;R5 =
SWPB.w R5 ;R5 =
SXT R5 ; R5 =
3. Here is a series of address references given as word addresses: 1, 4, 8, 5, 20, 17, 19, 56, 9, 11, 4, 43, 5, 6, 9, 17. Using this references, show the hits and misses and final cache contents for direct-mapped cache with 16 one-word blocks.
Explanation / Answer
1....
mov value 0x0 in r4
MOV.w #0x0, R4 ; R4 = 0x0
add value 0x02 with value in r4
ADD.w #0x02, R4 ; R4 = 0x02 (adding 0x0 +0x02 =0x02)
RLA(.B or .W) dst
CMSBMSB-1 LSB+1LSB0
Rotate left arithmetically (multiplied by 2)
RLA results in mulplication by 2
RLA.w R4 ; R4 =0x04 (0x02 * 2 =0x04)
RLA.w R4 ; R4 = 0x08 (0x04 * 2= 0x08)
2....
1.MOV(.B or .W) src,dst srcdst Move source to destination
MOV.w 0xF008,R5 move 0xf008 to r5.
R5= 0xF008h
2.
RRA(.B or .W) dst MSBMSB… LSBC Roll destination right
RRA.w R5
R5 was= 0xF008
converting to binary
1111 0000 0000 1000
shifting bits from right to left and c=lsb
0111 1000 0000 0111 c=0
answer: R5=0x7804
3.
RRC(.B or .W) dst CMSB…LSBC Roll destination right through carry
R5 was =0x7804 c=0
converting to binary
0111 1000 0000 0100 c=0
rotating bits from right to left through c gives
0011 1100 0000 0010 c=0
converting back to hex
answer:R5=0x3c02
4.
SWPB( or .W) dst Swap bytes in destination
SWPB.w R5
R5 has value= 0x3c02
converting to binary
0011 1100 0000 0010
swaping bytes
0000 0010 0011 1100
converting back to hex
answer: R5=0x23c
4.SXT dst bit 7bit 8…bit 15 Sign extend destination
R5=0x023c
converting to binary
0000 0010 0011 1100
bit(7 is 0) hence put all bits from 8 to 15 to be 0
so we get 0000 0000 0011 1100
converting back to hex
answer: R5=0x003c
3......
a cache is a hardware or software component that stores data so future requests for that data can be served faster; . A cache hit occurs when the requested data can be found in a cache, while a cache miss occurs when it cannot. Cache hits are served by reading data from the cache, which is faster than recomputing a result or reading from a slower data store;
Address reference
Binary address
Hit/Miss
Assigned cache block
1
0001
Miss
0001
4
0100
Miss
0100
8
1000
Miss
1000
5
0101
Miss
0101
20
10100
Miss
0100
17
10001
Miss
0001
19
10011
Miss
0011
56
111000
Miss
1000
9
1001
Miss
1001
11
1011
Miss
1011
4
0100
Miss
0100
43
101011
Miss
1011
5
0101
Hit
0101
6
0110
Miss
0110
9
1001
Hit
1001
17
10001
Hit
0001
Final Contents of Cache after references
Index
0000
0001
0010
0011
0100
0101
0110
0111
Contents
M(17)
M(19)
M(4)
M(5)
M(6)
Index
1000
1001
1010
1011
1100
1101
1110
1111
Contents
M(56)
M(9)
M(43)
Address reference
Binary address
Hit/Miss
Assigned cache block
1
0001
Miss
0001
4
0100
Miss
0100
8
1000
Miss
1000
5
0101
Miss
0101
20
10100
Miss
0100
17
10001
Miss
0001
19
10011
Miss
0011
56
111000
Miss
1000
9
1001
Miss
1001
11
1011
Miss
1011
4
0100
Miss
0100
43
101011
Miss
1011
5
0101
Hit
0101
6
0110
Miss
0110
9
1001
Hit
1001
17
10001
Hit
0001