# CS302 Digital & Logic design Assignment No 1 Solution Fall 2012

Q1

(a) Convert the binary number 10111110 to Gray code. Show complete procedure                                             2+3=5 marks

(b) Convert the Gray code 10111110 to binary. Show complete procedure                                                          2+3=5 marks

Q2 Fill the empty columns in the table by performing each operation against each row.                                                                                                                                                                                          Marks 10

 A B C D 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1

Idea Solution:

SOLUTION:

Part(a):Solution
Step1:(1)0111110..copy most significant bit
Ans:1
Step2:(1+0) 111110=>1
Ans:11
Step3: 1(0+1)111110=>1
Ans:111
Step4:10(1+1)1110=>0
Ans:1110
Step5:101(1+1)110=>0
Ans:11100
Step6:1011(1+1)10=>0
Ans:111000
Step7:10111(1+1)0=>0
Ans:1110000
Step8:101110(1+0)=>1
Ans:11100001

…………….

Conversion Binary to Gray Code:

1 1 1 0 0 0 0 1
Converted Binary (10111110) to Gray Code (11100001).
Convert the Gray Code 10111110 to binary. Show complete procedure.
Conversion Gray code to Binary:

1 0 1 1 1 1 1 0

1 1 0 1 0 1 0 0

Converted Gray Code (10111110) to Binary (11010100).
Question No.2:
Fill the empty columns in the table by performing each operation against each row.
A B C D NAND AB+CD
0 0 0 0 0 1 1 0
0 0 0 1 0 0 1 0
0 0 1 0 0 0 1 0
0 0 1 1 0 1 1 1
0 1 0 0 1 1 1 0
0 1 0 1 1 0 1 0
0 1 1 0 1 0 1 0
0 1 1 1 1 1 1 1
1 0 0 0 1 1 1 0
1 0 0 1 1 0 1 0
1 0 1 0 1 0 1 0
1 0 1 1 1 1 1 1
1 1 0 0 0 1 0 1
1 1 0 1 0 0 0 1
1 1 1 0 0 0 0 1
1 1 1 1 0 1 0 1

Part(a):Solution
Step1: (1)0111110..copy most significant bit
Ans:1
Step2: (1+0) 111110=>1
Ans:11
Step3: 1(0+1)111110=>1
Ans:111
Step4:10(1+1)1110=>0
Ans:1110
Step5:101(1+1)110=>0
Ans:11100
Step6:1011(1+1)10=>0
Ans:111000
Step7:10111(1+1)0=>0
Ans:1110000
Step8:101110(1+0)=>1
Ans:11100001

A B C D NAND AB CD AB+CD
0 0 0 0 1 0 0 0
0 0 0 1 1 0 0 0
0 0 1 0 1 0 0 0
0 0 1 1 1 0 1 1
0 1 0 0 1 0 0 0
0 1 0 1 1 0 0 0
0 1 1 0 1 0 0 0
0 1 1 1 1 0 1 1
1 0 0 0 1 0 0 0
1 0 0 1 1 0 0 0
1 0 1 0 1 0 0 0
1 0 1 1 1 0 1 1
1 1 0 0 1 1 0 1
1 1 0 1 1 1 0 1
1 1 1 0 1 1 0 1
1 1 1 1 0 1 1 1

A,B,C,D in four colum ka AND lena hai phir osko olt kr dena hai to wo NAND bn jaeyga
A B C D AND NAND
0.0.0.0 = 0 1
0.0.0.1 = 0 1
0.0.1.0 = 0 1
0.0.1.1 = 0 1
0.1.0.0 = 0 1
AND SO ON
.
.
.
1.1.1.1 = 1 0