Docsity

Binary to Gray, Gray to Binary Conversion-Computer Architecture and Assembly Language-Assignment Solution, Exercises of Computer Architecture and Organization

Toggle sidebar
bg1
Q1 (a) Binary to Gray
1 1 0 0 0 1 1 0
Step 1: Write left most bit as it is
1
Step 2: Add the left most binary digit to adjacent one
1 + 0 0 0 1 1 0
1 0
Step 3: Add next adjacent pair
1 1 + 0 0 0 1 1 0
1 0 1
Step 4: Again add next adjacent pair and repeat until the last pair
1 1 0 + 0 0 1 1 0
1 0 1 0
Step 5: Repeat step 4
1 1 0 0 + 0 1 1 0
1 0 1 0 0
Step 6: Repeat step 4
1 1 0 0 0 + 1 1 0
1 0 1 0 0 1
Step 7: Repeat step 4
1 1 0 0 0 1 + 1 0
1 0 1 0 0 1 0
Step 8: Repeat step 4
1 1 0 0 0 1 1 + 0
1 0 1 0 0 1 0 1
So the Gray code for the binary 11000110 is 10100101
docsity.com
pf3

Partial preview of the text

Download Binary to Gray, Gray to Binary Conversion-Computer Architecture and Assembly Language-Assignment Solution and more Exercises Computer Architecture and Organization in PDF only on Docsity!

Q1 (a) Binary to Gray 1 1 0 0 0 1 1 0 Step 1: Write left most bit as it is 1 Step 2: Add the left most binary digit to adjacent one 1 + 0 0 0 1 1 0 1 0 Step 3: Add next adjacent pair 1 1 + 0 0 0 1 1 0 1 0 1 Step 4: Again add next adjacent pair and repeat until the last pair 1 1 0 + 0 0 1 1 0 1 0 1 0 Step 5: Repeat step 4 1 1 0 0 + 0 1 1 0

Step 6: Repeat step 4^1 0 1 0 1 1 0 0 0 + 1 1 0

Step 7: Repeat step 4^1 0 1 0 0 1 1 0 0 0 1 + 1 0 1 0 1 0 0 1 0 Step 8: Repeat step 4 1 1 0 0 0 1 1 + 0 1 0 1 0 0 1 0 1 So the Gray code for the binary 11000110 is 10100101

(b) Gray to Binary Step 1: Write left most bit as it is

Gray Code 1 Step 2: Add this gray bit to next binary bit and write the result below as arrows indicate.

Step 3: Repeat step 2 until the last bit

So Binary code for the gray 10101111 is 11001010