Professional Documents
Culture Documents
DEC Lab Manual
DEC Lab Manual
DEC Lab Manual
Let it Go Up
PART-A
Realize using Digital Trainer Kits
Page
Expt. No. Title of the Experiment
No.
Study of Trainer kit, Verification of Logic gates and
0 1-8
Realization of NAND and NOR as Universal gates.
Simplification and realization of Boolean expressions
using logic gates/universal gates.
1 (a) Demorgan’s Theorem for 2 variables. 9 - 16
(b) The sum-of product and product-of-sum
expressions using universal gates.
Design and implement
(a) Full Adder and subtractor using basic logic 17 - 21
2 gates.
(b) Design and implement 4-bit Parallel Adder/
22 - 23
subtractor using IC 7483.
Design and Verify
a. Binary to Gray code converter and vice-versa
3 b. Binary to Excess-3 code converter
24 - 31
c. 1-bit comparator and 4-bit comparator
Design and implementation of Multiplexers, De-
4 multiplexers and Priority Encoder
32 - 41
Shift Registers
Ring Counter
5 42 - 53
Johnson Counter
Mod-N Counter
PART-B
AIM: To study logic gates and to realize NAND and NOR as Universal gates.
NAND Gate
Logic Symbol Pin Diagram of IC 7400 Truth Table
(Quad 2-Input NAND
gate)
Input Outpu
s t
A B Y
0 0 1
0 1 1
1 0 1
1 1 0
NOR Gate
Logic Symbol Pin Diagram of IC 7402 Truth Table
(Quad 2-Input NOR gate)
Inputs Output
A B Y
0 0 1
0 1 0
1 0 0
1 1 0
NOT Gate
1
Logic Symbol Pin Diagram of IC 7404 Truth Table
(1-Input NOT Gate Hex Inverter)
Input Output
A Y
0 1
1 0
AND Gate
Logic Symbol Pin Diagram of IC 7408 Truth Table
(Quad 2-Input AND gate)
Inputs Output
A B Y
0 0 0
0 1 0
1 0 0
1 1 1
OR Gate
Logic Symbol Pin Diagram of IC 7432 Truth Table
(Quad 2-Input OR gate)
Inputs Output
A B Y
0 0 0
0 1 1
1 0 1
1 1 1
XOR Gate
Logic Symbol Pin Diagram of IC 7486 Truth Table
(Quad 2-Input XOR gate)
Inputs Output
A B Y
0 0 0
0 1 1
1 0 1
1 1 0
XNOR Gate
2
Logic Symbol Truth Table
Inputs Output
A B Y
0 0 1
0 1 0
1 0 0
1 1 1
3
4 Inputs AND Gate
Logic Symbol Truth Table
Inputs Output
A B C D Y
0 0 0 0 0
0 0 0 1 0
Pin Diagram of IC 7421 0 0 1 0 0
( Dual 4-input AND gate) 0 0 1 1 0
0 1 0 0 0
0 1 0 1 0
0 1 1 0 0
0 1 1 1 0
1 0 0 0 0
1 0 0 1 0
1 0 1 0 0
1 0 1 1 0
1 1 0 0 0
1 1 0 1 0
1 1 1 0 0
1 1 1 1 1
4 inputs NAND Gate
Logic Symbol Truth Table
Inputs Output
A B C D Y
0 0 0 0 1
0 0 0 1 1
0 0 1 0 1
0 0 1 1 1
0 1 0 0 1
Pin Diagram of IC 7420 0 1 0 1 1
( Dual 4-input NAND gate) 0 1 1 0 1
0 1 1 1 1
1 0 0 0 1
1 0 0 1 1
1 0 1 0 1
1 0 1 1 1
1 1 0 0 1
1 1 0 1 1
1 1 1 0 1
1 1 1 1 0
4
(I) By using NAND gates :
Inputs Output
A B Y
0 0 0
0 1 1
1 0 1
1 1 1
Inputs Output
A B Y
0 0 0
0 1 1
1 0 1
1 1 0
5
Realization of X-NOR function: TRUTH TABLE:
Inputs Output
A B Y
0 0 1
0 1 0
1 0 0
1 1 1
6
Realization of an OR functions: TRUTH TABLE:
Inputs Output
A B Y
0 0 0
0 1 1
1 0 1
1 1 1
Inputs Output
A Y
0 1
1 0
Inputs Output
A B Y
0 0 0
0 1 1
1 0 1
1 1 0
Inputs Output
A B Y
0 0 1
0 1 0
1 0 0
1 1 1
7
PROCEDURE:
1) Check the IC and fix it to the socket.
2) Rig up the circuit as shown in the logic diagram.
3) Apply various input data to the circuit via logic switches.
4) Note down the corresponding output and verify the truth table.
RESULT:
All the logic gates are verified and NAND and NOR gates are realized as Universal gates.
8
EXPERIMENT NO.1
VERIFICATION OF SUM-OF-PRODUCT AND PRODUCT-OF-SUM EXPRESSION
AIM: To realize the Sum-Of –Product (SOP) and Product-Of-Sum (POS) expression using universal and
basic gates.
a) Y= f (a, b, c) = 𝒂 𝒃 𝒄 + a 𝒃 𝒄 + a 𝒃 c
= ∑(𝟎, 𝟒, 𝟓)
Y= 𝒃 𝒄 (𝒂 + a) + a 𝒃 c
Y= 𝒃 𝒄 + a 𝒃 c
Y= 𝒃 ( 𝒄 + a c)
Y= 𝒃 ( 𝒄 + a) ( 𝒄 + c)
Y= 𝒃 ( 𝒄 + a)
i) (0,4) 𝒃𝒄
ii) (4,5) a𝒃
Y= 𝒃 𝒄 + a 𝒃
Y= 𝒃 ( 𝒄 + a)
9
LOGIC DIAGRAMS:
USING BASIC GATES:
Y=a𝒃 +𝒃𝒄
𝒀 = 𝒂𝒃 + 𝒃 𝒄 = 𝒂𝒃 ⦁ 𝒃 𝒄
Y= 𝒀 = 𝒂𝒃 ⦁ 𝒃 𝒄
10
USING NOR GATES:
Y= 𝒃 (a + 𝒄 )
𝒀= 𝒃 (𝒂 + 𝒄 )
=𝒃+ 𝒂+𝒄
Y= 𝒀 = 𝒃 + 𝒂 + 𝒄
TRUTH TABLE:
Inputs Outputs
a b c Y
0 0 0 1
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 0
1 1 1 0
11
Simplification Using K-Map:
i) (12,13,14,15) ab
ii) (9,11,13,15) ad
iii) (3,7,11,15) cd
iv) (7,6,14,15) bc
Y= 𝒂𝒃 + 𝒂𝒅 + 𝒄𝒅 + 𝒃𝒄
Y= 𝒂(𝒃 + 𝒅) + 𝒄(𝒅 + 𝒃)
Y= (𝒂 + 𝒄)(𝒃 + 𝒅)
LOGIC DIAGRAM:
USING BASIC GATES:
12
USING NAND GATES:
Y= 𝒂𝒃 + 𝒂𝒅 + 𝒄𝒅 + 𝒃𝒄
𝒀= 𝒂𝒃 ⦁ 𝒃𝒄 ⦁ 𝒄𝒅 ⦁ 𝒂𝒅
Y = 𝒀= 𝒂𝒃 ⦁ 𝒃𝒄 ⦁ 𝒄𝒅 ⦁ 𝒂𝒅
13
TRUTH TABLE:
Inputs Outputs
a b c Y
0 0 0 0
0 0 0 0
0 0 1 0
0 0 1 1
0 1 0 0
0 1 0 0
0 1 1 1
0 1 1 1
1 0 0 0
1 0 0 1
1 0 1 1
1 0 1 1
1 1 0 1
1 1 0 1
1 1 1 1
1 1 1 1
i) (0,2,4,6,8,10,12,14) d
ii) (8,9,12,13) 𝒂+c
Y= 𝒅(𝒂 + 𝒄)
14
LOGIC DIAGRAMS:
USING BASIC GATES:
𝒀 = 𝒂𝒅 + 𝒅𝒄
𝒀 = 𝒂𝒅 + 𝒄𝒅
𝒀 = 𝒂𝒅 + 𝒄𝒅
𝒀 = 𝒂𝒅 ⦁ 𝒄𝒅
𝒀 = 𝒂𝒅 ⦁ 𝒄𝒅
𝒀 = 𝒂𝒅 + 𝒄𝒅
15
USING NOR GATES:
𝒀 = (𝒂 + 𝒄)𝒅
𝒀 = (𝒂 + 𝒄)𝒅
𝒀 = 𝒀 = (𝒂 + 𝒄) + 𝒅
TRUTH TABLE:
Inputs Outputs
a b c Y
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 0
1 0 1 0
1 0 1 1
1 1 0 0
1 1 0 0
1 1 1 0
1 1 1 1
PROCEDURE:
1) Mount the IC on the Zero Insertion Force (ZIF) socket and lock the socket.
2) Make connections as per the logic diagram.
3) Apply all input combinations using toggle switches.
4) Note down the corresponding output and verify the truth table.
RESULT:
POS and SOP expressions for three and four variables are simplified and realized using basic
and universal gates. Also the result are verified using truth table.
INFERENCE:
16
EXPERIMENT NO.2 (a)
DESIGN AND IMPLEMENTATION OF FULL ADDERS USING LOGIC GATES
FULL ADDER
A INPUTS OUTPUTS
B FULL ADDER S A B Cin S Cout
Cin 0 0 0 0 0
Cout 0 0 1 1 0
0 1 0 1 0
BOOLEAN EXPRESSION: 0 1 1 0 1
1 0 0 1 0
𝑺 = 𝒇(𝑨, 𝑩, 𝑪𝒊𝒏) = 𝑨 𝑩𝑪𝒊𝒏 + 𝑨𝑩 𝑪𝒊𝒏 + 𝑨𝑩 𝑪𝒊𝒏 + 𝑨𝑩𝑪𝒊𝒏 1 0 1 0 1
=∑ (1, 2, 4, 7) 1 1 0 0 1
𝑺 = 𝑨( 𝑩𝑪𝒊𝒏 + 𝑩 𝑪𝒊𝒏) + 𝑨(𝑩 𝑪𝒊𝒏 + 𝑩𝑪𝒊𝒏) 1 1 1 1 1
𝑺 = 𝑨( 𝑩 ⊕ 𝑪𝒊𝒏) + 𝑨(𝑩 ⊕ 𝑪𝒊𝒏)
𝑺 = 𝑨 ⊕ 𝑩 ⊕ 𝑪𝒊𝒏
17
REALIZATION OF FULL ADDER USING BASIC GATES:
𝑺 = 𝑨 ⊕ 𝑩 ⊕ 𝑪𝒊𝒏
𝑳𝒆𝒕 𝑨 ⊕ 𝑩 = 𝑿
𝑺 = 𝑿 ⊕ 𝑪𝒊𝒏
= 𝑿𝑿 + 𝑿𝑪𝒊𝒏 + 𝑿𝑪𝒊𝒏 + 𝑪𝒊𝒏 𝑪𝒊𝒏
= 𝑿(𝑿 + 𝑪𝒊𝒏) + 𝑪𝒊𝒏(𝑿 + 𝑪𝒊𝒏)
= 𝑿(𝑿𝑪𝒊𝒏) + 𝑪𝒊𝒏(𝑿𝑪𝒊𝒏)
𝑺 = 𝑿(𝑿𝑪𝒊𝒏) + 𝑪𝒊𝒏(𝑿𝑪𝒊𝒏)
𝑺 = 𝑿(𝑿𝑪𝒊𝒏) ⦁ 𝑪𝒊𝒏(𝑿𝑪𝒊𝒏)
𝑺 = 𝑺 = 𝑿(𝑿𝑪𝒊𝒏) ⦁ 𝑪𝒊𝒏(𝑿𝑪𝒊𝒏)
𝑪𝒐𝒖𝒕 = (𝑨 ⊕ 𝑩)𝑪𝒊𝒏 + 𝑨𝑩
𝑪𝒐𝒖𝒕 = (𝑨 ⊕ 𝑩)𝑪𝒊𝒏 + 𝑨𝑩 = (𝑨 ⊕ 𝑩)𝑪𝒊𝒏 ⦁ 𝑨𝑩
𝑪𝒐𝒖𝒕 = 𝑪𝒐𝒖𝒕 = (𝑨 ⊕ 𝑩)𝑪𝒊𝒏 ⦁ 𝑨𝑩
18
PROCEDURE:
1) Mount the IC on the Zero Insertion Force (ZIF) socket and lock the socket.
2) Make connections as per the logic diagram.
3) Apply all input combinations using toggle switches.
4) Note down the corresponding output and verify the truth table.
RESULT:
Full Adder Circuits are realized using logic gates and truth tables are verified.
19
EXPERIMENT NO.2 (b)
DESIGN AND IMPLEMENTATION OF FULL SUBTRACTORS USING LOGIC GATES
FULL SUBTRACTOR
BLOCK DIAGRAM: TRUTH TABLE:
INPUTS OUTPUTS
A A B Bin D Bout
B D 0 0 0 0 0
FULL SUBTRACTOR 0 0 1 1 1
Bin Bout 0 1 0 1 1
0 1 1 0 1
1 0 0 1 0
1 0 1 0 0
BOOLEAN EXPRESSIONS: 1 1 0 0 0
1 1 1 1 1
𝑫 = 𝒇(𝑨, 𝑩, 𝑪𝒊𝒏) = 𝑨 𝑩𝑩𝒊𝒏 + 𝑨𝑩 𝑩𝒊𝒏 + 𝑨𝑩 𝑩𝒊𝒏 + 𝑨𝑩𝑩𝒊𝒏
=∑ (1, 2, 4, 7)
𝑫 = (𝑨 𝑩 ⊕ 𝑨𝑩)𝑩𝒊𝒏) + 𝑩𝒊𝒏(𝑨 𝑩 + 𝑨𝑩)
𝑫 = (𝑨 ⊕ 𝑩)𝑩𝒊𝒏 + 𝑩𝒊𝒏(𝑨 ⊕ 𝑩)
𝑫 = (𝑨 ⊕ 𝑩)𝑩𝒊𝒏
20
Realization of FULL SUBTRACTOR using 2 input NAND GATES:
PROCEDURE:
1) Mount the IC on the Zero Insertion Force (ZIF) socket and lock the socket.
2) Make connections as per the logic diagram.
3) Apply all input combinations using toggle switches.
4) Note down the corresponding output and verify the truth table.
RESULT:
Full Subtractor Circuits are realized using logic gates and truth tables are verified.
21
EXPERIMENT NO. 2 (c)
DESIGN AND IMPLEMENTATION OF 4-BIT PARALLEL ADDER / SUBTRACTOR USING IC
7483(CODE CONVERSION)
AIM: To design and implement 4-bit parallel adder and subtractor using IC 7483.
BLOCK DIAGRAM:
LOGIC DIAGRAM:
22
TRUTH TABLE:
TRUTH TABLE:
23
EXPERIMENT NO. 3
a. DESIGN AND IMPLEMENTATION OF Binary to gray code converter and vice
versa
AIM: To design and implement Binary to gray code converter and vice versa.
BOOLEAN EXPRESSION:
G1 = B1
G2 = B1 XOR B2
G3 = B2 XOR B3
G4 = B3 XOR B4
LOGIC DIAGRAM:
24
Gray code to Binary converter:
TRUTH TABLE:
Four Bit Gray Code Four Bit Binary Number
G1 G2 G3 G4 B1 B2 B3 B4
0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 1
0 0 1 1 0 0 1 0
0 0 1 0 0 0 1 1
0 1 1 0 0 1 0 0
0 1 1 1 0 1 0 1
0 1 0 1 0 1 1 0
0 1 0 0 0 1 1 1
1 1 0 0 1 0 0 0
1 1 0 1 1 0 0 1
1 1 1 1 1 0 1 0
1 1 1 0 1 0 1 1
1 0 1 0 1 1 0 0
1 0 1 1 1 1 0 1
1 0 0 1 1 1 1 0
1 0 0 0 1 1 1 1
BOOLEAN EXPRESSION:
B1 = G1
B2 = G2 XOR B1
B3 = G3 XOR B2
B4 = G4 XOR B3
LOGIC DIAGRAM:
25
b. DESIGN AND IMPLEMENTATION OF Binary to Ex-3 code converter and vice
versa
AIM: To design and implement BCD to Ex-3 code converter.
BCD to Ex-3
TRUTH TABLE:
A B C D w x y z
0 0 0 0 0 0 1 1
0 0 0 1 0 1 0 0
0 0 1 0 0 1 0 1
0 0 1 1 0 1 1 0
0 1 0 0 0 1 1 1
0 1 0 1 1 0 0 0
0 1 1 0 1 0 0 1
0 1 1 1 1 0 1 0
1 0 0 0 1 0 1 1
1 0 0 1 1 1 0 0
1 0 1 0 x x x x
1 0 1 1 x x x x
1 1 0 0 x x x x
1 1 0 1 x x x x
1 1 1 0 x x x x
1 1 1 1 x x x x
c.
w = A+BC+BD x = B’C+B’D+BC’D’
y = C’D’+CD z = D’
26
LOGIC DIAGRAM:
A
w
x
B
C y
D z
Ex-3 to BCD
TRUTH TABLE:
27
K-MAP AND BOOLEAN EXPRESSION:
FOR
LOGIC DIAGRAM:
28
c. DESIGN AND IMPLEMENTATION OF ONE BIT COMPARATOR AND 4-
BIT COMPARATOR USING IC 7485.
AIM: To design and implement one bit comparator and 4- bit comparator using IC 7485.
Inputs Outputs
A B A<B A=B A>B
0 0 0 1 0
0 1 1 0 0
1 0 0 0 1
1 1 0 1 0
29
LOGIC DIAGRAM:
TRUTH TABLE:
Inputs Outputs
A3B3 A2B2 A1B1 A0B0 A>B A=B A<B
A3>B3 X X X 1 0 0
A3<B3 X X X 0 0 1
A3=B3 A2>B2 X X 1 0 0
A3=B3 A2<B2 X X 0 0 1
A3=B3 A2=B2 A1>B1 X 1 0 0
A3=B3 A2=B2 A1<B1 X 0 0 1
A3=B3 A2=B2 A1=B1 A0>B0 1 0 0
A3=B3 A2=B2 A1=B1 A0<B0 0 0 1
A3=B3 A2=B2 A1=B1 A0=B0 0 1 0
30
TABULAR COLUMN:
Inputs Outputs
A3 A2 A1 A0 DEC B3 B2 B1 B0 DEC A>B A=B A<B
0 0 0 0 0 0 0 0 1 1 0 0 1
0 1 1 1 7 0 1 0 0 4 1 0 0
1 1 1 1 15 1 1 1 1 15 0 1 0
0 1 0 1 5 0 1 1 0 6 0 0 1
1 0 1 0 10 0 0 1 0 2 1 0 0
1 1 0 0 12 1 1 0 0 12 0 1 0
x7 x6 x 5 x4 x3 x2 x1 x0
y7 y6 y5 y4 y3 y2 y1 y0
0 A3 A2 A1 B3 B2 B1
I(A> A3 A2 A1 B3 B2 B1
I(A>
1 B)
Magnitude
A B B)
Magnitude
A B
0 I(A=Comparator I(A=Comparator
B)A<B A=B A>B B)A<B A=B A>B
PROCEDURE:
1) Check the IC and fix it to the socket.
2) Rig up the circuit as shown in the circuit diagram.
3) Apply various input data to the circuit via logic switches.
4) Note down the corresponding output and verify the truth table.
RESULT:
a. Gray to binary and binary to gray is designed and implemented and verified.
b. Ex-3 to binary and binary to Ex-3 is designed and implemented and verified.
c. One bit comparator has been designed and implemented as shown in the logic
diagram. Also a 4-Bit, magnitude comparator have been verified using IC 7485
and verified using the truth table.
31
EXPERIMENT NO. 4
a. Design and implement Multiplexers
AIM: To realize 4:1 multiplexer using basic gates and NAND gates.
Inputs Output
E S1 S0 Y
0 X X 0
1 0 0 I0
1 0 1 I1
1 1 0 I2
1 1 1 I3
BOOLEAN EXPRESSSION:
TRUTH TABLE:0
Inputs Output
E S1 S0 I0 I1 I2 I3 Y
0 X X X X X X 0
1 0 0 0 X X X 0
1 0 0 1 X X X 1
1 0 1 X 0 X X 0
1 0 1 X 1 X X 1
1 1 0 X X 0 X 0
1 1 0 X X 1 X 1
1 1 1 X X X 0 0
1 1 1 X X X 1 1
32
REFERING TRUTH TABLE 01:
33
PIN DIAGRAM:
IC 74151 (8:1 MUX)
TRUTH TABLE:
ENABLE I/P
Inputs Output
EN S2 S1 S0 D0 D1 D2 D3 D4 D5 D6 D7 Y
1 X X X X X X X X X X X 0
0 0 0 0 0 X X X X X X X 0
0 0 0 0 1 X X X X X X X 1
0 0 0 1 X 0 X X X X X X 0
0 0 0 1 X 1 X X X X X X 1
0 0 1 0 X X 0 X X X X X 0
0 0 1 0 X X 1 X X X X X 1
0 0 1 1 X X X 0 X X X X 0
0 0 1 1 X X X 1 X X X X 1
0 1 0 0 X X X X 0 X X X 0
0 1 0 0 X X X X 1 X X X 1
0 1 0 1 X X X X X 0 X X 0
0 1 0 1 X X X X X 1 X X 1
0 1 1 0 X X X X X X 0 X 0
0 1 1 0 X X X X X X 1 X 1
0 1 1 1 X X X X X X X 0 0
0 1 1 1 X X X X X X X 1 1
34
REALISATION OF 3-VRIABLE FUNCTION USING 8:1 MUX IC 74151:
i) F =f (x, y, z) = ∑ (1, 2, 4, 5, 7)
TRUTH TABLE:
Inputs Output
x y z F
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 0
1 1 1 1
35
ii) P = f(x, y, z) = ∑ (1, 3, 5, 6)
TRUTH TABLE:
Inputs Output
x y z P
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 0
PROCEDURE:
1) Rig up the circuit as shown in the logic diagram.
2) Apply various input data to the circuit via logic switches.
3) Note down the corresponding output and verify the truth table.
RESULT:
The 4:1 Mux is designed and implemented using both basic gates and NAND gates
and the truth table is verified and 8:1 Mux and 3- Variable function are implemented using
IC 74151 and the truth table is verified.
36
b. REALIZATION OF 1:8 DEMUX AND 3:8 DECODER USING IC 74138
PIN DIAGRAM:
IC 74138 (1:8 DEMUX)
IC 74138 AS A DECODER:
TRUTH TABLE:
ENABLE I/PS DATA I/PS OUTPUTS
G1 𝑮𝟐𝑨 𝑮𝟐𝑩 C B A 𝒀𝟎 𝒀𝟏 𝒀𝟐 𝒀𝟑 𝒀𝟒 𝒀𝟓 𝒀𝟔 𝒀𝟕
0 1 1 X X X 1 1 1 1 1 1 1 1
1 1 1 X X X 1 1 1 1 1 1 1 1
1 0 0 0 0 0 0 1 1 1 1 1 1 1
1 0 0 0 0 1 1 0 1 1 1 1 1 1
1 0 0 0 1 0 1 1 0 1 1 1 1 1
37
1 0 0 0 1 1 1 1 1 0 1 1 1 1
1 0 0 1 0 0 1 1 1 1 0 1 1 1
1 0 0 1 0 1 1 1 1 1 1 0 1 1
1 0 0 1 1 0 1 1 1 1 1 1 0 1
1 0 0 1 1 1 1 1 1 1 1 1 1 0
IMPLEMENTATION OF 3-VRIABLE FUNCTION USING IC 74138:
P = f(x, y, z) = ∑ (1, 2, 4, 5)
Q = f(x, y, z) = ∏ (4, 5, 6, 7)
TRUTH TABLE:
Inputs Outputs
x y z P Q
0 0 0 0 1
0 0 1 1 1
0 1 0 1 1
0 1 1 0 1
1 0 0 1 0
1 0 1 1 0
1 1 0 0 0
1 1 1 0 0
38
IC 74138 AS 1:8 DEMULTIPLEXERS:
TRUTH TABLE:
39
ENABLE I/P SELECT I/PS OUTPUTS
𝑮𝟐𝑨 C B A 𝒀𝟎 𝒀𝟏 𝒀𝟐 𝒀𝟑 𝒀𝟒 𝒀𝟓 𝒀𝟔 𝒀𝟕
0 0 0 0 0 1 1 1 1 1 1 1
1 0 0 0 1 1 1 1 1 1 1 1
0 0 0 1 1 0 1 1 1 1 1 1
1 0 0 1 1 1 1 1 1 1 1 1
0 0 1 0 1 1 0 1 1 1 1 1
1 0 1 0 1 1 1 1 1 1 1 1
0 0 1 1 1 1 1 0 1 1 1 1
1 0 1 1 1 1 1 1 1 1 1 1
0 1 0 0 1 1 1 1 0 1 1 1
1 1 0 0 1 1 1 1 1 1 1 1
0 1 0 1 1 1 1 1 1 0 1 1
1 1 0 1 1 1 1 1 1 1 1 1
0 1 1 0 1 1 1 1 1 1 0 1
1 1 1 0 1 1 1 1 1 1 1 1
0 1 1 1 1 1 1 1 1 1 1 0
1 1 1 1 1 1 1 1 1 1 1 1
PROCEDURE:
1) Rig up the circuit as shown in the logic diagram.
2) Apply various input data to the circuit via logic switches.
3) Note down the corresponding output and verify the truth table.
RESULT:
The 8:1 demultiplexers and 3:8 decoders are realized using IC 74138 and
the truth table is verified.
40
C. Priority Encoder
AIM:-To encode the binary inputs to Octal values.
PIN DIAGRAM:
PROCEDURE:
1) Rig up the circuit as shown in the logic diagram.
2) Apply various input data to the circuit via logic switches.
3) Note down the corresponding output and verify the truth table.
RESULT:
The 8:3 priority encoder are realized using IC 74148 and the truth table is verified.
41
EXPERIMENT NO. 5
a. REALIZATION OF THE FOLLOWING SHIFT REGISTERS USING IC 7474
(A) SISO (B) SIPO (C) PISO (D) PIPO
EQUIPMENT/APPARATUS USED:
BRIEF THEORY:
A register is a group of binary storage cells capable of holding binary information. A group
of flipflops constitutes a register, since each flip-flop can work as a binary cell. An n-bit
register has n flip-flops and is capable of holding n-bits of information. In addition to flip-
flops a register can have a combinational part that performs data-processing tasks.
Shift Register: A register capable of shifting its binary contents either to the left or to the
right iscalled a shift register. The shift register permits the stored data to move from a
particular locationto some other location within the register. Registers can be designed
using discrete flip-flops (S- R, J-K, and D-type). The data in a shift register can be shifted
in two possible ways: (a) serial shifting and (b) parallel shifting. The serial shifting
method shifts one bit at a time for each clock pulse in a serial manner, beginning with
either LSB or MSB. On the other hand, in parallel shiftingoperation, all the data (input or
output) gets shifted simultaneously during a single clock pulse. Hence, we may say that
parallel shifting operation is much faster than serial shifting operation.
8- bit Universal Shift Register: IC 74195 is a 4-bit TTL MSI having both serial/parallel
input andserial/parallel output capability. The pinout diagram of IC 74195 is shown in
Figure 1.
42
When the SH / LD input is LOW, the data on the parallel inputs, i.e., A, B, C, and D are
entered synchronously on the positive transition of the clock. When SH / LD is HIGH, the
stored data willshift right (QA to QD) synchronously with the clock. J and K are the serial
inputs to the first stageof the register (QA); QD can be used for getting a serial output
data. The active low clear is asynchronous.
TRUTH TABLE:
4-BIT SERIAL IN SERIAL OUT (SIPO) REGISTER:
DATA: 1011
TRUTH TABLE:
DATA: 1011
43
4-BIT PARALLEL IN SERIAL OUT (PISO) AND 4-BIT PARALLEL IN PARALLEL
OUT (PIPO) REGISTER:
PROCEDURE:
1) Rig up the circuit as shown in the logic diagram.
2) Apply various input data to the circuit via logic switches along with the clock pulse.
3) Note down the corresponding output and verify the truth table.
RESULT:
SISO, SIPO, PISO and PIPO Shift Register are implemented and realized using IC
7474 and verified using the truth table.
44
b. REALIZATIONS OF RING COUNTER AND JOHNSON COUNTER USING IC
7476
PIN DIAGRAM:
IC 7476(DUAL JK FLIP FLOP WITH PRESET AND CLEAR)
LOGIC SYMBOL:
45
RING COUNTER:
TRUTH TABLE:
Input Outputs
CLOCK
Q1 Q2 Q3 Q4
CLK
1 1 0 0 0
2 0 1 0 0
3 0 0 1 0
4 0 0 0 1
5 1 0 0 0 Output Repeats
46
JOHNSON COUNTER:
TRUTH TABLE:
Input Outputs
CLOCK
Q1 Q2 Q3 Q4
CLK
0 0 0 0
1 1 0 0 0
2 1 1 0 0
3 1 1 1 0
4 1 1 1 1
5 0 1 1 1
6 0 0 1 1
7 0 0 0 1
0 0 0 0 Output Repeats
PROCEDURE:
1) Rig up the circuit as shown in the logic diagram.
2) For Ring counter, set the first bit J1 then after that apply the clock pulse.
3) For Johnson counter, first clear all the inputs, then apply clock pulse.
4) Check the outputs corresponding to their inputs.
47
RESULT:
Ring counter and Johnson counter are realised using IC 7476 and the truth table is
verified
48
c. REALIZATION OF MOD-N COUNTERS USING IC 7490
PIN DIAGRAM:
INTERNAL DIAGRAM:
IC 7490
NC: No Connection
FUNCTION TABLE:
49
TIMING DIAGRAM:
Input Output
Q0
1 0
2 1
50
MOD - 5 COUNTER:
TRUTH TABLE:
Input Outputs
Q3 Q2 Q1
1 0 0 0
2 0 0 1
3 0 1 0
4 0 1 1
5 1 0 0
51
MOD -7 COUNTER:
TRUTH TABLE:
Input Outputs
Q3 Q2 Q1 Q0
1 0 0 0 0
2 0 0 0 1
3 0 0 1 0
4 0 0 1 1
5 0 1 0 0
6 0 1 0 1
7 0 1 1 0
MOD – 10 COUNTER:
52
TRUTH TABLE:
Input Outputs
Q3 Q2 Q1 Q0
1 0 0 0 0
2 0 0 0 1
3 0 0 1 0
4 0 0 1 1
5 0 1 0 0
6 0 1 0 1
7 0 1 1 0
8 0 1 1 1
9 1 0 0 0
10 1 0 0 1
PROCEDURE:
Check all the ICs and patch chords.
1)
Insert the appropriate IC into the IC base.
2)
Make connections as shown in the circuit diagram.
3)
4) Apply the clock pulse and verify the Truth Table, observe the outputs.
RESULT:
The MOD -2, MOD -5, MOD – 7 and MOD -10 Counters are realised and
implemented using IC -7490 and the truth table is verified.
53
EXPERIMENT NO. 6
a. Verify the functionality of logic gates
ii) AND GATE: A Logic circuit whose output is logic ‘1’ if and only if all of its
inputs are logic ‘1’.
Logic Symbol Truth Table Verilog Code
module and12(a,b,y);
input a,b;
Inputs Output output y;
A B Y assign y=a & b;
0 0 0 endmodule
0 1 0
1 0 0
1 1 1
54
iii) OR GATE: A logic gate whose output is logic ‘0’ if and only if all of its inputs
are logic ‘0’.
Logic Symbol Truth Table Verilog Code
iv) NAND GATE: A logic gate which gives logic ‘0’ output if and only if all
its inputs are logic‘1’.
Logic Symbol Truth Table Verilog Code
module nand12(a,b,y);
input a,b;
output y;
Inputs Output assign y=~(a & b);
endmodule
A B Y
0 0 1
0 1 1
1 0 1
1 1 0
55
v) NOR GATE: A logic gate whose output logic ‘1’ if and only if all of its inputs
are logic ‘0’
Logic Symbol Truth Table Verilog Code
module nor12(a,b,y);
Inputs Output input a,b;
A B Y output y;
0 0 1 assign y=~(a | b);
0 1 0 endmodule
1 0 0
1 1 0
vi) EX-OR (Exclusive OR): A logic gate whose output is logic ‘0’ when all
the inputs are equal andlogic ‘1’ when they are unequal.
Logic Symbol Truth Table Verilog Code
56
vii) EX-NOR (Exclusive -NOR) gate: A logic gate that produces a logic ‘1’
only when the two inputsare equal
Logic Symbol Truth Table Verilog Code
module xnor12(a,b,y);
input a,b;
Inputs Outp output y;
ut assign y=~(a ^ b);
A B Y endmodule
0 0 1
0 1 0
1 0 0
1 1 1
57
b. Verify the given SOP and POS equation
i. SOP equation, Y= f (a, b, c) = 𝑎 𝑏 𝑐 + a 𝑏 𝑐 + a 𝑏 c = ∑(0,4,5)
= 𝑏 𝑐 (𝑎 + a) + a 𝑏 c = 𝑏 𝑐 + a 𝑏 c = 𝑏 ( 𝑐 + a c)
= 𝑏 ( 𝑐 + a) ( 𝑐 + c)
= 𝑏 ( 𝑐 + a)
i) (0,4) 𝑏𝑐
ii) (4,5) a𝑏
Y= 𝑏 𝑐 + a 𝑏
Y= 𝑏 ( 𝑐 + a)
LOGIC DIAGRAM:
Verilog Code:
module SOP(a,b,c,d,y);
input a,b,c,d;
output y;
assign y=~b(~c | a);
endmodule
58
ii. POS equation Y= f (a, b, c, d) = 𝑎𝑏𝑐𝑑 + 𝑎𝑏𝑐𝑑 + 𝑎𝑏𝑐𝑑 + 𝑎𝑏 𝑐𝑑 +
𝑎𝑏𝑐𝑑 + 𝑎𝑏𝑐 𝑑 + 𝑎𝑏𝑐𝑑 + 𝑎𝑏𝑐𝑑 +abcd == ∑(3,6,7,9,11,12,13,14,15)
= 𝑎𝑏𝑐𝑑 + 𝑎𝑏𝑐𝑑 + 𝑎𝑏𝑐𝑑 + 𝑎𝑏𝑐𝑑 + 𝑎𝑏𝑐 𝑑 +abcd +𝑎𝑏 𝑐𝑑 + 𝑎𝑏 𝑐𝑑 + 𝑎𝑏𝑐𝑑 + 𝑎𝑏𝑐𝑑
= 𝑎𝑐𝑑(𝑏 + 𝑏) + 𝑏𝑐𝑑(𝑎 + 𝑎) + 𝑎𝑏𝑐 𝑑 +acd (𝑏 + 𝑏 ) + 𝑎 𝑐𝑑(𝑏 + 𝑏)
= 𝑎𝑐𝑑 + 𝑏𝑐𝑑 + 𝑎𝑏𝑐 𝑑 + acd + 𝑎 𝑐𝑑
= 𝑐𝑑 (𝑎 + 𝑎) + 𝑏𝑐𝑑 + 𝑎𝑏𝑐 𝑑 + 𝑎 𝑐𝑑
= 𝑐𝑑 + 𝑏𝑐𝑑 + 𝑎𝑏𝑐 𝑑 + 𝑎 𝑐𝑑 = 𝑑 (c + ac) + 𝑑(𝑏𝑐 + 𝑎𝑏𝑐 )
= 𝑑 (c + ac) + 𝑑𝑏(𝑐 + 𝑎𝑐 ) = (𝑑 + 𝑑𝑏)(𝑐 + 𝑎𝑐 ) = (𝑑 + 𝑑)(𝑑 + 𝑏)(𝑐 + 𝑎)(𝑐 + 𝑐)
=(𝑑 + 𝑏)(𝑐 + 𝑎)
Using K-Map Simplification:
i) (12,13,14,15) ab
ii) (9,11,13,15) ad
iii) (3,7,11,15) cd
iv) (7,6,14,15) bc
Y= 𝑎𝑏 + 𝑎𝑑 + 𝑐𝑑 + 𝑏𝑐
Y= 𝑎(𝑏 + 𝑑) + 𝑐(𝑑 + 𝑏)
Y= (𝑎 + 𝑐)(𝑏 + 𝑑)
LOGIC DIAGRAM:
Verilog Code:
module POS(a,b,c,d,y);
input a,b,c,d;
output y;
assign y=(d | b)& (a | c);
endmodule
59
EXPERIMENT NO. 7
a. Verify the functionality of Adder
AIM: Write a verilog code to verify the functionality of half adder, full adder and 4bit
parallel adder
i. Half Adder
Truth table Logic diagram Verilog Code
module HA(a,b,sum,carry);
input a,b;
output sum,carry;
assign sum=a ^ b;
assign carry=a & b;
endmodule
60
iii. 4 bit Parallel adder
Logic diagram:
Verilog Code:
module 4bitadder(a,b,cin,s,cout);
input [3:0]a, [3:0]b, cin;
output [3:0]s, cout;
wire [2:0]c;
FA a1(a[0], b[0], cin, s[0], c[0]);
FA a2(a[1], b[1], c[0], s[1], c[1]);
FA a3(a[2], b[2], c[1], s[2], c[2]);
FA a4(a[3], b[3], c[2], s[3], cout);
endmodule
module FA(a,b,cin,sum,carry);
input a,b,cin;
output sum,carry;
assign sum=a ^ b^cin;
assign carry=(a & b|(b & cin)|(cin & a);
endmodule
61
b. Verify the functionality of MUX
AIM: Write a verilog code to verify the functionality of 4:1 and 8:1 mux
i. 4:1 Mux
62
assign x[5]=I[5] & S[0] & ~S[1]
&S[2]&E;
assign x[6]=I[6] & ~S[0] & S[1]
&S[2]&E;
assign x[7]=I[7] & S[0] & S[1] &
S[2]&E;
assign y= x[0] | x[1] | x[2] | x[3] | x[4] |
x[5] | x[6] | x[7];
endmodule
63
c. Verify the functionality of Demux
AIM: Write a verilog code to verify the functionality of 1:4 DEMUX
64
e. Verify the functionality of Encoder
AIM: Write a verilog code to verify the functionality of 8:3 Encoder with Priority and
without priority
i. Without priority
65
ii. With priority
66
EXPERIMENT NO. 8
a. Verify the functionality of Adder using behavioural modelling
AIM: Write a verilog code to verify the functionality of half adder, full adder and 4bit
parallel adder
i. Half Adder
Truth table Logic diagram Verilog Code
module
HA(a,b,sum,carry);
input a,b;
output reg sum,carry;
always @ (a,b)
begin
sum=a ^ b;
carry=a & b;
endmodule
67
ii. 8:1 mux
68
d. Verify the functionality of Decoder
AIM: Write a verilog code to verify the functionality of 2:4 Decoder
69
AIM: Write a verilog code to verify the functionality of 8:3 Encoder with Priority and
without priority
i. Without priority
70
ii. with priority
71
Experiment No. 9:
a. Flip Flops
Aim: - Develop and simulate the Verilog code for the following flip-flopsSR
JK
D
T
Theory: -
SR flip-flop: A SR flip-flop is the simplest possible memory element. The SR flip flop has
two inputs Set and Reset. The SR flip-flop is a basic building block for other flip-flops.
D flip-flop: This is a flip-flop with a delay (D) equal to exactly equal to one cycle of the
clock. The defect with SR FF is the indeterminate output when the data inputs at S and R
are 1. In order to avoid this the input to R is through an inverter from S so that the input to
R is always the complement of S and never same. The S input is redesignated as D.
JK flip-flop: The JK flip-flop is called a “universal flip flop” because the other flip flops
like D, SR, T can be derived from it. The “racing or race around condition” takes place in a
JK FF when J=1 and K=1 and clock=1.
T flip-flop: T stands for toggling. It is obtained from JK FF by tying both the inputs J and
K.
Block diagram :
72
Truth Table :
Verilog Code :
73
Simulation Result of SR flip-flop:-
D Flip Flop :
Block diagram:
Truth Table
74
Simulation Results:-
J-K flip-flop :
Block diagram :
75
Truth table:
Verilog Code :
76
endcase
end
endmodule
T flip-flop :
Block diagram
77
Truth Table :
Verilog Code :
module t_ff (t, clk, rst, q, qb);
input t, clk, rst;
output q, qb;
reg q,qb;
always @ (posedge clk)
begin
div = div+1'b1;
clkdiv = div[22];
end
always @ (posedge clkdiv)
begin
if (rst==1)
begin
q=0;
qb=1;
end
else
case ( t)
1’b0:begin q=q; qb=qb; end
1’b1:begin q=~(q); qb=~(qb); end
default: begin end
endcase
end
endmodule
Results:-
Developed the HDL code for flip flops SR,JK,D,T and simulated the designs and
verified the truth table of all the flip-flops with simulation Results.
78
b. Counters
Objective: - Design and simulate the Verilog code for a 4-bit binary, BCD counters with
Synchronous Reset
Asynchronous Reset
Any sequence
Theory: -
Basically the counters are the sequential blocks where in we use to generate a
sequence of numbers with respect to the clock counts which is a control signal provided for
the design. Counter can count and store the number of time any particular event or process
have occurred, depending on a clock signal. Counters can be modeled of synchronous or
Asynchronous types based on the clock applied for the design to execute the logic,
Asynchronous counters are those whose output is free from the clock signal. Because the
flip flops in asynchronous counters are supplied with different clock signals, there may be
delay in producing output. Counters can start counting not only from the zero, In fact it can
be initiated to any random value to make a count from some non-zero number and it is also
possible to increment the counter with more than one in one clock period.
Block diagram :
Verilog Code :
module syncnt(clk, rst, bin_out)
input clk, rst;
output [3:0] bin_out;
reg [3:0] bin_out;
always @ (posedge clk)
begin
if(rst) begin
bin_out<=4‘b0;
end
else
bin_out<=bin_out +1;
end
endmodule
79
Simulation Results:-
Block diagram:
Verilog Code :
module asyncnt(clk, rst, bin_out);
input clk, rst;
output [3:0] bin_out;
reg [3:0] bin_out;
always @ (posedge clk or posedge rst)
begin
if(rst) begin
bin_out<=4'b0;
end
80
else
bin_out<=bin_out+1;
end
endmodule
Simulation Results:-
Block diagram :
81
Verilog Code :
Simulation Results
82
6 (d). 4-bit BCD counter with Asynchronous reset :
Block diagram :
rst BCD bcd_out
Asynchronous
inputs
Reset Counter outputs
clk
Verilog Code :
module Asyncnt_bcd(clk, rst, bcd_out);
input clk, rst;
output [3:0] bcd_out;
reg [3:0] temp;
assign bcd_out=temp;
always @ (posedge clk or posedge rst)
begin
if(rst)
begin
temp<=4'b0000;
end
else
begin
temp<=temp+1'b1;
if(temp==4'b1001)
temp<=4'b0000;
end
end
endmodule
83
Simulation Results :
Result: - Designed and simulated the HDL code for a 4-bit binary, BCD counters with
Synchronous Reset
Asynchronous Reset
And verified the simulation Results for the counting sequence
and theSynchronous and Asynchronous counting.
84