1. For the two 16 bit values shown below, show what the value truncated to 8 bit
ID: 3805074 • Letter: 1
Question
1. For the two 16 bit values shown below, show what the value truncated to 8 bits would be. Also, for each truncated bit pattern, say whether the value of the original 16 bit representation is preserved or not, and explain how you determined your answer.
a. 0000 0000 1100 0011 (unsigned, that is, interpreted as B2U) i. 8 bit truncated value: ii. Does the value change when truncated to 8 bits? iii. How did you decide?
b. 1111 1111 0011 1010 (signed, that is, interpreted as B2T) i. 8 bit truncated value: ii. Does the value change when truncated to 8 bits? iii. How did you decide?
Please provide your work.
2. Assume that each of the following five hexadecimal values is stored as a 32-bit integer value, and these 5 values are being stored sequentially in memory starting at address 0x2000 (Hex 2000). Show the hex representation of the bytes in memory for both the big endian and little endian byte addressing schemes. Be sure to extend the “Address” column specifying the correct address values for each byte of memory needed to store these 5 values. HINT: Assume that integers are stored in 32 bits; 32 bits is 4 bytes, so 5 values at 4 bytes each would be a total of 20 bytes of memory.
a. 0xCE3C12 b. 0xBDEA6755 c. 0x129B5 d. 0x9 e. 0x1214A9E
Please provide your work
Address Big Endian Little Endian 0x2000 0x2001 0x2002 0x2003Explanation / Answer
Here is the solution for 1st problem:
1. For the two 16 bit values shown below, show what the value truncated to 8 bits would be.
Also, for each truncated bit pattern, say whether the value of the original 16 bit
representation is preserved or not, and explain how you determined your answer.
a. 0000 0000 1100 0011 (unsigned, that is, interpreted as B2U)
i. 8 bit truncated value: 1100 0011.
ii. Does the value change when truncated to 8 bits? No.
iii. How did you decide?
As the Most Significant 8 bits are 0's and as the number is unsigned, it doesn't make
any difference in truncating leading 0's. The decimal value in both the representations
is 195.
b. 1111 1111 0011 1010 (signed, that is, interpreted as B2T)
i. 8 bit truncated value: 0011 1010.
ii. Does the value change when truncated to 8 bits? Yes.
iii. How did you decide?
As the given number is signed value, and in the 16-bit representation, the Most Significant
Bit represents a 1, which means it is a negative, and therefore, is a 2's complement of
positive value. Where as, when truncated to 8-bit representation, the MSB is 0 now,
which means its a positive number, and should be considered as it is.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.