






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This course includes logic operators, gates, combinational and sequential circuits are studied along with their constituent elements comprising adders, decoders, encoders, multiplexers, as well as latches, flip-flops, counters and registers. This lab includes: Binary, Gray, Code, Conversion, Gate, Level, Model, Verilog, Decoder, Implemeting, Self-complemetary, Code
Typology: Exercises
1 / 10
This page cannot be seen from the preview
Don't miss anything!







Lab 3: Digital Logic Design Page 1
Lab4: Part (a): Binary to Gray Code Conversion
Lab4: Part (b): Gate-level Modeling in Verilog
converter. You will be cascading these two converters thus implementing a binary to gray coderdocsity.com
Lab 3: Digital Logic Design Page 2
Pre-Lab Tasks: (To be done before coming to the lab)
What do you mean by binary codes for the decimal digits? Give some examples and codes (tables) for the decimal digits. ๏ท An n bit binary code is a group of n bits that assumes up to distinct combinations of 1โs and 0โs with each combination representing one element of the set that is being coded. (1 Mark) ๏ท Binary codes are a way to represent information in binary numbers. ๏ท By using binary codes we can present decimal numbers in computer understandable form.
Examples are
๏ Access-3 code ๏ Binary coded decimal codes ๏ Gray codes ๏ 8 4 -2 -
Lab 3: Digital Logic Design Page 4
W=A
X=AโB + ABโ=A โ B
Y=BโC + BCโ=B โ C
Z=CโD + CDโ=C โ D
Decimal Binary Gray
--------- A B C D W X Y Z
0 0 0 0 0 0 0 0 0
1 0 0 0 1 0 0 0 1
2 0 0 1 0 0 0 1 1
3 0 0 1 1 0 1 1 0
4 0 1 0 0 0 1 1 0
5 0 1 0 1 0 1 1 1
6 0 1 1 0 0 1 0 1
7 0 1 1 1 0 1 0 0
8 1 0 0 0 1 1 0 0
9 1 0 0 1 1 1 0 1
10 1 0 1 0 1 1 1 1
11 1 0 1 1 1 1 1 0
12 1 1 0 0 1 0 1 0
13 1 1 0 1 1 0 1 1
14 1 1 1 0 1 0 0 1
15 1 1 1 0 1 0 0 0
Our inputs and outputs are of 4-bit each. You will have to make 4 K-Maps (Consider W as independent function of A,B,C,D, Make K-Map and simplify it). Arrive at the simplest expression for each output.
Lab 3: Digital Logic Design Page 5
Decimal Gray Binary
--------- W^ X^ Y^ Z^ A^ B^ C^ D 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 2 0 0 1 1 0 0 1 0 3 0 1 1 0 0 0 1 1 4 0 1 1 0 0 1 0 0 5 0 1 1 1 0 1 0 1 6 0 1 0 1 0 1 1 0 7 0 1 0 0 0 1 1 1 8 1 1 0 0 1 0 0 0 9 1 1 0 1 1 0 0 1 10 1 1 1 1 1 0 1 0 11 1 1 1 0 1 0 1 1 12 1 0 1 0 1 1 0 0 13 1 0 1 1 1 1 0 1 14 1 0 0 1 1 1 1 0 15 1 0 0 0 1 1 1 0
Our inputs and outputs are of 4-bit each. You will have to make 4 K-Maps (Consider A as independent function of W,X,Y,Z. Make K-Map and simplify it). Arrive at the simplest expression for each output.
Lab 3: Digital Logic Design Page 7
Implement the Gray to Binary Code Converter. Make the Schematic Diagram. Show the results to your Lab Instructor / Assistant. What and how many gates did you use? Donot dispatch your hardware.You will need it in lab task 3. (3 Marks)
We have used 4 XOR(one XOR was used for buffer)
B=W โ X
C=W โ X โ Y
D=W โXโYโZ
Lab Task 3:
Now cascade the two circuits in series by connecting the outputs of binary to gray converter to the inputs of the gray to binary converter. You should be able to get the binary input at output as well. Show the results to your Lab Instructor / Assistant. (6 Marks)
Lab Task4:
Design and simulate the gate-level model of the circuit you patched. Give the code in the space provided below.
Code of Binary to Grey. (5 marks)
module btg (w,x,y,z,a,b,c,d);
output w,x,y,z;
input a,b,c,d;
xor x1(w,a,0);
xor x2(x,a,b);
xor x3(y,b,c);
Lab 3: Digital Logic Design Page 8
xor x4(z,c,d);
endmodule
Time-Line Diagram of Binary to Grey Code.
Code of Grey to Binary.
module gtb(a,b,c,d,w,x,y,z);
output a,b,c,d;
input w,x,y,z;
xor xr1(a,w,0);
xor xr2(b,w,x);
xor xr3(c,w,x,y);
xor xr4(d,w,x,y,z);
endmodule
Time-Line Diagram of Grey Code to Binary.
Lab 3: Digital Logic Design Page 10