Homework Assignment #1
Due in class Wednesday 7 February 2001
Topic: Code conversions
1.Example gray code to binary conversion:
|
Binary |
Gray Code |
|
00 |
00 |
|
01 |
01 |
|
10 |
11 |
|
11 |
10 |
Convert 2 binary value to the associated Gray code, show both the bit and word equations.
The bit equations are:
g0 = ((b0 ) AND ( NOT b1)) OR(( NOT b0) AND (b1) = b0 ExclusiveOR b1.
g1 = b1.
The word equations (where B = b1b0 and G=g1g0) are:
TEMP = Shift_right B.
G = ((B) AND (not TEMP)) or((NOT B) AND (TEMP)) = B ExclusiveOR TEMP.
|
Binary |
Gray code |
|
0000 |
0000 |
|
0001 |
0001 |
|
0010 |
0011 |
|
0011 |
0010 |
|
0100 |
0110 |
|
0101 |
0111 |
|
0110 |
0101 |
|
0111 |
0100 |
|
1000 |
1100 |
|
1001 |
1101 |
|
1010 |
1111 |
|
1011 |
1110 |
|
1100 |
1010 |
|
1101 |
1011 |
|
1110 |
1001 |
|
1111 |
1000 |
1a. (10 pts) what are the bit equations for converting a 4 bit binary value to the associated Gray Code.
1b. (10 pts) what are the word equations for converting a 4 bit binary value to the associated Gray Code.
2. Example of conversion from binary to ASCII for values of 0 to 9, with 8 bit binary result.
|
Binary |
Hex |
Decimal |
Character |
|
b
00110000 |
30 |
48 |
0 |
|
b
00110001 |
31 |
49 |
1 |
|
b
00110010 |
32 |
50 |
2 |
|
b
00110011 |
33 |
51 |
3 |
|
b
00110100 |
34 |
52 |
4 |
|
b
00110101 |
35 |
53 |
5 |
|
b
00110110 |
36 |
54 |
6 |
|
b
00110111 |
37 |
55 |
7 |
|
b
00111000 |
38 |
56 |
8 |
|
b
00111001 |
39 |
57 |
9 |
Example bit equations:
a7 = 0.
a6 = 0.
a5 = 1.
a4 = 1.
a3 = b3.
a2 = b2.
a1 = b1.
a0 = b0.
Example word equations:
TEMP = (B) AND (0001111).
A = (TEMP) OR (00110000).
2a. (10 pts)For values from 0 to 9, find the bit equations for converting ASCII to binary.
2b(10 pts) For the values from 0 to 9, find the word equations for converting ASCII to binary.
3. For values from 0 to 15, convert BCD to Binary.
|
Binary |
Hex |
Decimal |
BCD |
|
b 00000000 |
00 |
0 |
0000 0000 |
|
b 00000001 |
01 |
1 |
0000 0001 |
|
b 00000010 |
02 |
2 |
0000 0010 |
|
b 00000011 |
03 |
3 |
0000 0011 |
|
b 00000100 |
04 |
4 |
0000 0100 |
|
b 00000101 |
05 |
5 |
0000 0101 |
|
b 00000110 |
06 |
6 |
0000 0110 |
|
b 00000111 |
07 |
7 |
0000 0111 |
|
b 00001000 |
08 |
8 |
0000 1000 |
|
b 00001001 |
09 |
9 |
0000 1001 |
|
b 00001010 |
0A |
10 |
0001 0000 |
|
b 00001011 |
0B |
11 |
0001 0001 |
|
b 00001100 |
0C |
12 |
0001 0010 |
|
b 00001101 |
0D |
13 |
0001 0011 |
|
b 00001110 |
0E |
14 |
0001 0100 |
|
b 00001111 |
0F |
15 |
0001 0101 |
3a(25 pts) find the bit equations for values from 0 to 15 to convert BCD to binary.
3b(25 pts) find the word equations for values from 0 to 15 to convert BCD to binary.
4.(10 pts)Search the web and find the URL for 1 example of a code conversion hardware product.The URL you found is: