Professional Documents
Culture Documents
Page 1 of 54
INDEX
Page 2 of 54
EXPERIMENT-1
AIM:
Construct and verify the basic logic gates (NOT, AND, OR,
NAND, NOR, XOR) using its truth table.
THEORY/OBSERVATION :
• AND GATE: gives a high output (1) only if all its inputs are high. The output is low level when any
one of the inputs is low.
Page 3 of 54
• NOT GATE: A circuit that produces an inverted version of the input at its output. The output is
high when the input is low. The output is low when the input is high.
• Also knaown as In
Page 4 of 54
• NAND GATE: The outputs of all NAND gates are high if any of the inputs are low. The output is
low level when both inputs are high.
Page 5 of 54
• NOR GATE: The outputs of all NOR gates are low if any of the inputs are high. The output is high
when all inputs are low.
• XOR GATE: A circuit which will give the output is high only when odd number of is high.
Page 6 of 54
EXPERIMENT-1 (Software)
AIM:
To design and simulate the combinational logic Gates using EDA Playground
Page 7 of 54
TOOLS:
Software: ModelSim
GATE-LEVEL MODELING:
Page 8 of 54
OUTPUT:
• XOR GATE
Page 9 of 54
BEHAVIORAL LEVEL MODELING:
GATE-LEVEL MODELING:
OUTPUT:
Page 10 of 54
• NAND GATE
BEHAVIORAL LEVEL MODELING:
Page 11 of 54
GATE-LEVEL MODELING:
OUTPUT:
• NOR GATE
BEHAVIORAL LEVEL MODELING:
Page 12 of 54
GATE-LEVEL MODELING:
INFERENCE:
Thus combinational logic gates (AND,XOR,NAND,NOR) are
constructed using three types of Verilog modeling and its
logical functions is verified by simulation.
The outputs have been verifies and objectives and behaviour
of these logic gates have been understood by the student.
Page 14 of 54
EXPERIMENT-2
TOOLS REQUIRED:
SOFTWARE: ModelSim
HARDWARE:
Page 15 of 54
IC PIN DIAGRAM:
LOGIC DIAGRAM:
Page 16 of 54
TRUTH TABLE:
PROCEDURE (Hardware) :
• Use 2 OR gates each for (A,B) and (C,D).
• The output of both the OR gates now acts a s a input for a new
NAND Gate.
• The output of this NAND gate is our final Output(F).
Page 17 of 54
VERILOG CODE:
GATE LEVEL MODELLING:
OUTPUT:
Page 18 of 54
RESULT: Thus F = ~((A+B).(C+D)) is verified in hardware by
designing the circuit and in software by using the different
models of code. Thus the student had now understood to
design logical circuits.
EXPERIMENT-3
AIM: Design and construct half adder circuits and full
adder circuits and verify the truth table using logic
gates and EDA Playground software.
a) Implement in trainer kit.
b) Data flow and Gate level modelling
Page 19 of 54
COMPONENTS REQUIRED:
HARDWARE->
a) Half Adder:
S. No COMPONENT SPECIFICA QUANTITY
TION
4 Connecting wires - -
b) Full Adder:
Page 20 of 54
GATE
5 Connecting wires - -
SOFTWARE-> ModelSim.
THEORY:
Page 21 of 54
TRUTH TABLE:
a) HALF ADDER:
LOGIC DIAGRAM:
Page 22 of 54
B)FULL ADDER:
Page 23 of 54
VERILOG CODE:
Half Adder:
Gate Model:
module ha_gl(output sum,carry,input a,b);
xor(sum,a,b);
and(carry,a,b);
endmodule
Behavioral Model:
module ha_b(output reg sum,carry,input a,b);
always@(a or b)
{carry,sum}=a+b;
endmodule
Page 24 of 54
assign carry=a&b;
endmodule
Full Adder:
Gate model:
module fa_gl(output sum,carry,input a,b,c, wire m,n,p);
xor(n,a,b);
xor(sum,n,c);
and(m,n,c);
and(p,a,b);
or(carry,m,p);
endmodule
Page 25 of 54
Behavioral model:
module fa_b(output reg sum,carry,input a,b,c);
always@(a or b or c)
{carry,sum}=a+b+c;
endmodule
OUTPUT:
a) HALF ADDER:
b) FULL ADDER:
Page 26 of 54
RESULT:
Thus, half adder logic circuits and full adder
logic circuits are constructed using basic
logic gates and their truth tables are verified
in both hardware and software .
Page 27 of 54
EXPERIMENT-4
AIM: Design and construct half-subtractors circuits
and full subtractors circuits and verify the truth table
using logic gates.Implement in trainer kit.
HARDWARE:
A) HALF SUBTRACTOR
TRUTH TABLE:
INPUTS OUTPUTS
A B DIFFERENCE BORROW
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0
LOGIC DIAGRAM:
Page 28 of 54
B) FULL SUBTRACTOR
Truth Table:
INPUTS OUTPUTS
A B Bin DIFFERNECE BORROW
0 0 0 0 0
0 0 1 1 1
0 1 0 1 1
0 1 1 0 1
1 0 0 1 0
1 0 1 0 0
1 1 0 0 0
1 1 1 1 1
LOGIC DIAGRAM:
Page 29 of 54
RESULT:
Page 30 of 54
EXPERIMENT-5
Aim: To implement MUX and DEMUX using logic gates
and verify using truth table and EDA Playground.
Components Required:
HARDWARE->
S. No. COMPONENT SPECIFICATION QUANTITY
1. 2-INPUT AND GATE IC 7408 2
2. 2-INPUT OR GATE IC 7432 1
3. 1-INPUT NOT GATE IC 7404 1
MUX:
4:1 Multiplexer: In the 4×1 multiplexer, there is a total of four
inputs, i.e., A0, A1, A2, and A3, 2 selection lines, i.e., S0 and
S1 and single output, i.e., Y.
Page 31 of 54
BLOCK DIAGRAM and CIRCUIT DIAGRAM
TRUTH TABLE:
Page 32 of 54
The logical expression of the term Y is as follows:
Y=S1'.S0'.A0+S1'.S0.A1+S1.S0'.A2+S1.S0 A3
DEMUX:
1:4 Demultiplexer: THEORY: A 1-to-4 demultiplexer has a
single input (D), two selection lines (S1 and S0) and four
outputs (Y0 to Y3).
BLOCK DIAGRAM
Page 33 of 54
TRUTH TABLE:
Page 34 of 54
Y0=S1' S0' A
y1=S1' S0' A
y2=S1' S0' A
y3=S1' S0' A
HARDWARE:
Page 35 of 54
PROCEDURE:
1. Place the IC on IC trainer kit
2. Connect the Vcc and ground to respective pins the of IC
trainer kit
3. Connections are given as per logic diagram
4. Connect the inputs to the input switches provided in the
IC trainer kit
5. Connect the outputs to the switches of output LED’s
6. Apply various combinations of input according to the truth
table
7. Observe the condition of output LED’s and verify the truth
table
Page 36 of 54
and (T1, a, s0bar, s1bar), (T2, b, s0bar, s1),(T3, c, s0, s1bar),
(T4, d, s0, s1);
or(out, T1, T2, T3, T4);
endmodule
module muxt_b;
reg [3:0] a;
reg [1:0] s;
Page 37 of 54
wire o;
initial begin
#10 a=4’b1010;
#10 s=2’b00;
#10 s=2’b01;
#10 s=2’b10;
#10 s=2’b11;
#10 $stop;
end
Endmodule
Page 38 of 54
OUTPUT:
Page 39 of 54
VERILOG CODE: DEMUX
GATE–LEVEL MODELLING:
module demux_1_to_4(
input d,
input s0,
input s1,
output y0,
output y1,
output y2,
output y3
);
not(s1n,s1),(s0n,s0);
and(y0,d,s0n,s1n),(y1,d,s0,s1n),(y2,d,s0n,s1),(y3,d,s0,s1);
endmodule
DATA-FLOW MODELLING :
module demux_1_to_4( input d, input s0, input s1, output
y0, output y1, output y2, output y3 );
assign s1n = ~ s1;
Page 40 of 54
assign s0n = ~ s0;
assign y0 = d& s0n & s1n;
assign y1 = d & s0 & s1n;
assign y2 = d & s0n & s1;
assign y3 = d & s0 & s1;
endmodule
Page 41 of 54
sel=2’b00;a=4’b0101;
#5
sel2’b01;a=4’b0101;
#5
sel2’b10;a=4’b0101;
#5
sel2’b11;a=4’b0101;
#5
$finish();
end
Endmodule
Page 42 of 54
OUTPUT:
Page 43 of 54
EXPERIMENT-6
Components
Required:
HARDWARE
S. No. COMPONENT SPECIFICATION QUANTITY
1. 2-INPUT AND GATE IC 7408 2
2. 2-INPUT OR GATE IC 7432 1
3. 1-INPUT NOT GATE IC 7404 1
Priority Encoder(4X2):-
The priority encoder is a combinational logic circuit that contains
2^n input lines and n output lines and represents the highest
priority input among all the input lines. When multiple input lines
are active high at the same time, then the input that has the
highest priority is considered first to generate the output.
Page 44 of 54
Block Diagram
Truth Table:
Verilog:
Page 45 of 54
Test Bench
Page 46 of 54
Decoder-
Decoder is a combinational circuit which transforms given
inputs to maximum number of outputs(2^n and n are
giveninputs).
Page 47 of 54
Page 48 of 54
Result-Hence 2x4 decoder and
Priority encoder were designed and
their outputs were verified.
Page 49 of 54
EXPERIMENT-7
AIM: Implementation of carry look ahead adder
for 3 bit numbers.
HARDWARE REQUIRED :
Ex-OR gates, AND gates, XOR gates
CIRCUIT DIAGRAM:
Page 50 of 54
Equation of carry being generated:
Gi=carry generator
Pi=carry propagator
Truth Table:
Page 51 of 54
Procedure:
• Begin by configuring the hardware
components according to the circuit
schematic given. Place the integrated circuits
(ICs) such as AND gates, OR gates, and XOR
gates on the breadboard or PCB. Connect
them to a power source.
• Assuring a consistent 5V DC source for the
circuit.
• Push buttons are used to enter two 3-bit
binary numbers indicating the values you
want to add. This step simulates actual data
entry.
• Logic Design: This is an important stage in the
experiment. Create the logic for the
• Look-ahead adder with three bits of carry.
Refer to the whole adder circuit in the
diagram.
• Define the terms "carry generate" (G_i)
Page 52 of 54
CONCLUSION :
In this hardware experiment, we successfully designed and implemented a 3-bit Carry Look-
Ahead Adder using logic gates for binary addition. We observed the operation of the adder
for various inputs and analyzed its performance.
Page 53 of 54
Page 54 of 54