Hardware Reference
In-Depth Information
Example B.5
▼
Convert the following two binary numbers into octal representation:
a. 101011001
2
b. 1010101010
2
Solution
a. 10101001
2
5 10,101,001 5 010,101,001
2
5 252
8
b. 1010101010
2
5 1,010,101,010 5 001,010,101,010
2
5 1252
8
▲
B.6 Convert from Octal to Binary
To convert from octal to binary, simply convert each octal digit to its 3-bit binary equiva-
lent and delete the leading 0s from the resultant binary number.
Example B.6
▼
Convert the following octal numbers into binary:
a. 532
8
b. 246
8
Solution
a. 532
8
5 101,011,010
2
b. 246
8
5 010,100,110
2
5 10,100,110
2
▲
B.7 Convert from Binary to Hexadecimal
The hex number system uses digits 0 through 9 and letters A through F to represent a num-
ber. The digit 0 corresponds to 0000
2
, and the letter A corresponds to 1010, whereas the letter F
corresponds to 1111
2
. There are two steps to convert a binary number to hex.
Step 1
Partition the given number (a string of 0s and 1s) from the right to the left into groups of
4 bits. Add leading 0s if the leftmost group has fewer than 4 bits.
Step 2
Convert each 4-bit group to the corresponding hex digit (0 to F).
Example B.7
▼
Convert the following two binary numbers into hex representation:
a. 100101011001
2
b. 1011010101110
2
Search WWH ::
Custom Search