List the powers of 2 up to 2. For a 12-bit CPU: a. What is the maximum number of
ID: 3849155 • Letter: L
Question
List the powers of 2 up to 2. For a 12-bit CPU: a. What is the maximum number of values (express in decimal) b. What is the highest positive number when unsigned (express in decimal) c. What is the range of values for two's complement signed values (express in d. Show the binary equivalent of -1. For 8-bit 2's complement math, express each number as hexadecimal. Add them together and show the result. Convert that result to decimal and compare answers. Finally, of the four flags after doing the math. a. -5 + -38 b. 120 + 53 c. -45 + -90 d. 150 + -128Explanation / Answer
2) a. The CPU is of 12-bits and each bit can hold a 0 or 1. As you have two options for each bit and there are 12 such bits in total, number of possibilities (values it can express is):
2 x 2 x 2 .... x 2 [12 times] = 212 = 4096
===============================================================
b) When numbers are unsigned, you start the counting with 0 and end at 2n - 1, where n denotes the number of bits (Total number of values are actually 4096 as we start from 0 and end up at 4095 - just as we calculated in part a.)
So again the highest value is 212-1 = 4095.
===============================================================
c) Range of values in 2's complement notation is -2n-1 to 2n-1-1. (where n = number of bits)
In this case we have to represent the negative numbers as well. So, the range is split into two halves : one for negative numbers and one for positive numbers.
The positive numbers are upto 2n-1-1. (as we have an extra 0 to represent)
The negative numbers are upto 2n-1. (as we have no negative 0, so negative numbers are one more than positive).
Hence, range in our current question becomes -211 to 211-1 i.e. -2048 to 2047.
===============================================================
d) Binary equivalent of -1 depends upon the type of representation you are using to represent the binary numbers.
In the signed representation, we just flip the sign bit of the number from 0 to 1.
For example, if we consider 4-bit CPU and signed representation,
+1 = 0 0 0 1
and
-1 = 1 0 0 1
in signed binary representaiton. We just flipped the sign bit (Most significant bit).
In 1's Complement representation, we flip the bits of positive number. For example,
+1 = 0 0 0 1
-1 = 1 1 1 0
In 2's complement representation, we take 1's complement and add 1 to it. For example,
-1 in 1's complement = 1 1 1 0
Adding 1 to it + 1
2's complement
representation of -1 = 1 1 1 1
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.