Lab Manual
Lab Manual
Lab Manual
HOD / ECE
HOD / ECE
EXPT. PAGE
NAME OF THE EXPERIMENT
NO NO
Study of Logic Gates 2
HOD / ECE
AND gate:
HOD / ECE
STUDY OF LOGIC GATES
AIM:
APPARATUS REQUIRED:
THOERY:
Logic gates are the basic elements that make up a digital system. The gate is a digital
circuit with one or more inputs, but only one output. By connecting the different gates in
different ways, we can build circuits that perform arithmetic and other functions.
The operation of a logic gate can be easily understood with the help of “truth table”. A
truth table is a table that shows all the input-output possibilities of a logic circuit ie., the truth
table indicates the outputs for different possibilities of the inputs.
The types of gates available are the AND, OR, NOT, NAND, NOR, exclusive-OR and
the exclusive-NOR. Except for the exclusive-NOR gate they are available in monolithic
integrated form.
AND gate:
The AND gates has two or more inputs. It performs a logical multiplication. The output
is HIGH (1), when both the inputs are 1; otherwise the output from the gate is LOW (0). The
output from the AND gate is written as A.B.
HOD / ECE
OR gate:
NOT gate:
HOD / ECE
OR gate:
The OR gates has two or more inputs. It performs a logical addition. The output is
HIGH (1), if any of the inputs are 1; the output is LOW (0) if and only if all the inputs are 0.
The output from the OR gate is written as A+B.
NOT gate:
The NOT gate has only one input. It performs a basic logic function called inversion.
The output is HIGH (1), when the input is 0; the output is LOW (0) when the input is 1. The
output from the NOT gate is written as A’.
NAND gate:
The NAND gate is a contraction of AND-NOT. It has two or more inputs. The output
is HIGH (1), when any of the inputs are 0; the output is LOW (0), if and only if all the inputs
are 1. The output from the AND gate is written as (A.B)’. It is a universal gate.
NOR gate:
The NOR gate is a contraction of OR-NOT. It has two or more inputs. The output is
HIGH (1), when all inputs are 0; the output is LOW (0), when any of the inputs are 1. The
output from the AND gate is written as (A+B)’. It is a universal gate.
EX-OR gate:
The EX-OR gate has two or more inputs. The output is HIGH (1), when odd number of
inputs is 1. The output from the AND gate is written as (AB).
PROCEDURE:
1. Connections are given as per the logic diagram.
2. Logic inputs are given as per the truth table.
3. Observe the logic output and verify with the truth table.
HOD / ECE
2-Input NAND gate:
HOD / ECE
NOR gate:
EX-OR gate:
RESULT:
Thus the logic gates are studied and their truth tables are verified.
HOD / ECE
HALF ADDER:
TRUTH TABLE:
Inputs Outputs
A B Carry (C) Sum (S)
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
K- MAP SIMPLIFICATION:
LOGIC DIAGRAM:
FULL ADDER:
TRUTH TABLE:
Inputs Outputs
A B Cin Sum (S) Carry (Cout)
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
HOD / ECE
AIM:
To design and construct a half adder, full adder, half subtractor and full subtractor
circuits and verify their truth table using logic gates.
APPARATUS REQUIRED:
THEORY:
Half Adder:
A half-adder is a combinational circuit that can be used to add two binary bits. It has
two inputs that represent the two bits to be added and two outputs, with one producing the SUM
output and the other producing the CARRY. The Sum can be applied using EX-OR gate, carry
output can be applied using an AND gate.
Full Adder:
A full adder is a combinational circuit that forms the arithmetic sum of three input bits.
It consists of 3 inputs and 2 outputs. Two of the input variables, represent the significant bits
to be added. The third input represents the carry from previous lower significant position.
The logic diagram of the full adder can also be implemented with two half-
adders and one OR gate. The S output from the second half adder is the exclusive-OR
of Cin and the output of the first half-adder
HOD / ECE
K-MAP SIMPLIFICATION:
LOGIC DIAGRAM:
Full Adder:
HOD / ECE
Half Subtractor:
A half-subtractor is a combinational circuit that can be used to subtract one binary digit
from another to produce a DIFFERENCE output and a BORROW output. The BORROW
output here specifies whether a ‘1’ has been borrowed to perform the subtraction. The
difference can be applied using EX-OR gate, borrow output can be applied using an AND gate
and an inverter.
Full Subtractor:
A full subtractor performs subtraction operation on two bits, a minuend and a
subtrahend, and also takes into consideration whether a ‘1’ has already been borrowed by the
previous adjacent lower minuend bit or not.
As a result, there are three bits to be handled at the input of a full subtractor, namely
the two bits to be subtracted and a borrow bit designated as Bin. There are two outputs, namely
the DIFFERENCE output D and the BORROW output Bo. The BORROW output bit tells
whether the minuend bit needs to borrow a ‘1’ from the next possible higher minuend bit.
PROCEDURE:
1. Connections are given as per the logic diagram.
2. Logic inputs are given as per the truth table.
3. Observe the logic output and verify with their truth tables.
HALF SUBTRACTOR:
HOD / ECE
TRUTH TABLE:
Input Output
A B Difference (D) Borrow (Bout)
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0
K- MAP SIMPLIFICATION:
LOGIC DIAGRAM:
FULL SUBTRACTOR:
TRUTH TABLE:
Inputs Outputs
A B Bin Difference(D) Borrow(Bout)
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
K- MAP SIMPLIFICATION:
HOD / ECE
LOGIC DIAGRAM:
Full Subtractor:
RESULT:
Thus half adder, full adder, half subtractor and full subtractor circuits was designed
using logic gates and their truth tables were verified.
BINARY TO GRAY CODE CONVERTER:
HOD / ECE
TRUTH TABLE:
K- Map Simplification:
HOD / ECE
AIM:
To design and implement 4-bit
1. Binary to Gray code Converter
2. Gray to Binary code Converter
3. BCD to Excess-3 code Converter
4. Excess-3 code to BCD Converter
APPARATUS REQUIRED:
THEORY:
An availability of large variety of codes for the same discrete elements of information
results in the use of different codes by different systems. A conversion circuit must be inserted
between the two systems if each uses different codes for the same information. Thus, code
converter is a circuit that makes the two systems compatible even though each uses different
binary code.
The input variable are designed as B3,B2,B1,B0 and the output variables are designed
as G3,G2,G1,G0. From the truth table, combinational circuit is designed. The Boolean functions
are obtained from K-Map for each output variable.
HOD / ECE
Logic Diagram:
HOD / ECE
To convert from binary code to Excess-3 code, the input lines must supply the bit
combination of elements as specified by code and the output lines generate the corresponding
bit combination of code. Each one of the four maps represents one of the four outputs of the
circuit as a function of the four input variables.
A two-level logic diagram may be obtained directly from the Boolean expressions
derived by the maps. These are various other possibilities for a logic diagram that implements
this circuit.
PROCEDURE:
1. Connections are given as per the logic diagram.
2. Logic inputs are given as per the truth table.
3. Observe the logic output and verify with the truth tables.
HOD / ECE
K-Map Simplification:
Logic Diagram:
HOD / ECE
BCD TO EXCESS-3 CODE:
Truth table:
BCD code Excess-3 code
B3 B2 B1 B0 E3 E2 E1 E0
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
K-Map Simplification:
HOD / ECE
Logic Diagram:
HOD / ECE
EXCESS-3 TO BCD CONVERTER:
Truth Table:
Excess-3 code BCD code
E3 E2 E1 E0 B3 B2 B1 B0
0 0 1 1 0 0 0 0
0 1 0 0 0 0 0 1
0 1 0 1 0 0 1 0
0 1 1 0 0 0 1 1
0 1 1 1 0 1 0 0
1 0 0 0 0 1 0 1
1 0 0 1 0 1 1 0
1 0 1 0 0 1 1 1
1 0 1 1 1 0 0 0
1 1 0 0 1 0 0 1
K-Map Simplification:
HOD / ECE
Logic Diagram:
RESULT:
HOD / ECE
4- BIT BINARY ADDER/ SUBTRACTOR:
PIN DIAGRAM:
LOGIC DIAGRAM:
HOD / ECE
AIM:
To Design and implement the 4-bit adder/ subtractor and BCD adder using IC 7483.
APPARATUS REQUIRED:
SL.NO COMPONENT SPECIFICATION QUANTITY
HOD / ECE
1. IC Trainer kit - 1
2. 4-bit binary full adder IC 7483 2
3. EX-OR gate IC 7486 1
4. AND gate IC 7408 1
5. OR gate IC 7432 1
6. Patch cords - Few
THEORY:
4-Bit binary adder/ subtractor:
The 4-bit binary adder/ subtractor circuit performs the operation of both addition and
subtraction. It has two 4-bit inputs A0, A1, A2, A3 and B0, B1, B2, B3. The mode input M controls
the operation of the circuit. When M= 0, the circuit is an adder and when M=1, the circuit
becomes a Subtractor. Each exclusive-OR gate receives input M and one of the inputs of B.
When M=0, the operation is B 0= B. The full adders receive the value of B and the
input carry is 0, and the circuit performs the addition operation, A+ B.
When M=1, the operation is B 1= B’ and C0=1. The B inputs are all complemented
and a 1 is added through the input carry. Thus the circuit performs the subtraction operation,
i.e., A+ (2’s complement of B) = A- B.
TRUTH TABLE:
BCD ADDER:
HOD / ECE
LOGIC DIAGRAM:
HOD / ECE
The two decimal digits, together with the input carry, are first added in the top 4-bit
binary adder to provide the binary sum. When the output carry is equal to zero, nothing is added
to the binary sum. When it is equal to one, binary (0110)2 is added to the binary sum through
the bottom 4-bit adder. The output carry generated from the bottom adder can be ignored, since
it supplies information already available at the output carry terminal. The output carry from
one stage must be connected to the input carry of the next higher-order stage.
PROCEDURE:
Truth table:
HOD / ECE
RESULT:
Thus the 4-bit adder/ subtractor and BCD adder using IC 7483 was designed and
implemented.
HOD / ECE
TRUTH TABLE:
Inputs Outputs
A1 A0 B1 B0 A>B A=B A<B
0 0 0 0 0 1 0
0 0 0 1 0 0 1
0 0 1 0 0 0 1
0 0 1 1 0 0 1
0 1 0 0 1 0 0
0 1 0 1 0 1 0
0 1 1 0 0 0 1
0 1 1 1 0 0 1
1 0 0 0 1 0 0
1 0 0 1 1 0 0
1 0 1 0 0 1 0
1 0 1 1 0 0 1
1 1 0 0 1 0 0
1 1 0 1 1 0 0
1 1 1 0 1 0 0
1 1 1 1 0 1 0
DESIGN:
A = A1A0
B = B1 B0
Xi = AiBi + Ai′Bi′
Xi = (Ai Bi)′ for i = 0,1
(A = B) = X1 X0
(A>B) = A1B1′ +X1A0B0′
(A<B) = A1′B1 +X1A0′B0
HOD / ECE
AIM:
To design and implement
(i) 2-bit magnitude comparator using logic gates.
(ii) 8-bit magnitude comparator using IC 7485.
APPARATUS REQUIRED:
THEORY:
HOD / ECE
LOGIC DIAGRAM:
HOD / ECE
Xi = AiBi + Ai′Bi′ for i = 1, 2, 3, 4.
Or, Xi = (A B)′ or, Xi ′ = A B
Or, Xi = (AiBi′ + Ai′Bi)′
where,
Xi =1 only if the pair of bits in position i are equal
To satisfy the equality condition of two numbers A and B, it is necessary that all
Xi must be equal to logic 1. This indicates the AND operation of all Xi variables. In other
words, we can write the Boolean expression for two equal 2-bit numbers.
(A = B) = X1 X0.
The binary variable (A=B) is equal to 1 only if all pairs of digits of the two numbers are equal.
To determine if A is greater than or less than B, we inspect the relative magnitudes of
pairs of significant bits starting from the most significant bit. If the two digits of the most
significant position are equal, the next significant pair of digits is compared. The comparison
process is continued until a pair of unequal digits is found. It may be concluded that A>B, if
the corresponding digit of A is 1 and B is 0. If the corresponding digit of A is 0 and B is 1, we
conclude that A<B. Therefore, we can derive the logical expression of such sequential
comparison by the following two Boolean functions,
The symbols (A>B) and (A<B) are binary output variables that are equal to 1 when A>B or
A<B, respectively.
HOD / ECE
Truth Table:
PROCEDURE:
1. Connections are given as per the logic diagram.
2. Logic inputs are given as per the truth table.
3. Observe the logic output and verify with the truth tables.
RESULT:
Thus the 2-bit magnitude comparator was designed and implemented using logic
gates and 8-bit magnitude comparator using IC 7485.
4:1 MULTIPLEXER:
HOD / ECE
Truth table:
S1 S0 OUTPUTS, (Y)
0 0 D0
0 1 D1
1 0 D2
1 1 D3
HOD / ECE
AIM:
To design and implement multiplexer and demultiplexer using logic gates.
APPARATUS REQUIRED:
THEORY:
Multiplexer:
Multiplexer means transmitting a large number of information units over a small number
of channels or lines. A digital multiplexer is a combinational circuit that selects binary
information from one of many input lines and directs it to a single output line. The selection of
a particular input line is controlled by a set of selection lines. Normally there are 2n input line
and ‘n’ selection lines whose bit combination determine which input is selected. It is called as
data selector, because the output depends on the input data bit that is selected.
Demultiplexer:
The function of Demultiplexer is in contrast to multiplexer function. It takes
information from one line and distributes it to a given number of output lines. For this reason,
the demultiplexer is also known as a data distributor. Decoder can also be used as
Demultiplexer.
In the 1:4 demultiplexer circuit, the data input line goes to all of the AND gates. The
data select lines enable only one gate at a time and the data on the data input line will pass
through the selected gate to the associated data output line.
HOD / ECE
1: 4 DEMULTIPLEXER:
Truth Table:
INPUT OUTPUT
S1 S0 I/P D0 D1 D2 D3
0 0 0 0 0 0 0
0 0 1 1 0 0 0
0 1 0 0 0 0 0
0 1 1 0 1 0 0
1 0 0 0 0 0 0
1 0 1 0 0 1 0
1 1 0 0 0 0 0
1 1 1 0 0 0 1
HOD / ECE
PROCEDURE:
1. Connections are given as per the logic diagram.
2. Logic inputs are given as per the truth table.
3. Observe the logic output and verify with the truth tables.
RESULT:
Thus the multiplexer and demultiplexer was designed and implemented using logic
gates.
HOD / ECE
Logic Diagram ( 2-to-4- Line Decoder with Enable Input):
Truth Table:
INPUTS OUTPUTS
E A B D0 D1 D2 D3
1 x x 1 1 1 1
0 0 0 0 1 1 1
0 0 1 1 0 1 1
0 1 0 1 1 0 1
0 1 1 1 1 1 0
HOD / ECE
AIM:
To design and implementation encoder and decoder using logic gates.
APPARATUS REQUIRED:
THEORY:
Encoder:
An encoder is a digital circuit that performs inverse operation of a decoder. An encoder
has 2n input lines and ‘n’ output lines. In encoder the output lines generates the binary code
corresponding to the input value. In octal to binary encoder it has eight inputs, one for each
octal digit and three output that generates the corresponding binary code. In encoder it is
assumed that only one input has a value of one at any given time otherwise the circuit is
meaningless. It has an ambiguila that when all inputs are zero the outputs are zero. The zero
outputs can also be generated when D0=1.
Decoder:
A decoder is a multiple output logic circuit which converts input into coded output
where input and output codes are different. The input code generally has few bits than the
output code. Each input code word produces a different output code word i.e., there is one to
one mapping can be expressed in truth table. In block diagram of decoder circuit the encoded
information is present as n input producing 2n possible outputs. The 2n output values are from
0 through out 2n-1.
HOD / ECE
ENCODER:
Logic Diagram:
Truth Table:
INPUTS OUTPUTS
Y1 Y2 Y3 Y4 Y5 Y6 Y7 A B C
1 0 0 0 0 0 0 0 0 1
0 1 0 0 0 0 0 0 1 0
0 0 1 0 0 0 0 0 1 1
0 0 0 1 0 0 0 1 0 0
0 0 0 0 1 0 0 1 0 1
0 0 0 0 0 1 0 1 1 0
0 0 0 0 0 0 1 1 1 1
HOD / ECE
PROCEDURE:
1. Connections are given as per the logic diagram.
2. Logic inputs are given as per the truth table.
3. Observe the logic output and verify with the truth tables.
RESULT:
Thus the design and implementation of encoder and decoder using logic gates.
HOD / ECE
8- Bit ODD/EVEN PARITY GENERATOR/ CHECKER:
PIN DIAGRAM:
FUNCTION TABLE:
INPUTS OUTPUTS
Number of Data Inputs
PE PO ∑E ∑O
(D0 - D7)
EVEN 1 0 1 0
ODD 1 0 0 1
EVEN 0 1 0 1
ODD 0 1 1 0
X 1 1 0 0
X 0 0 1 1
HOD / ECE
AIM:
To design and implement 16 bit odd /even parity checker generator using IC 74180.
APPARATUS REQUIRED:
THEORY:
A Parity is a very useful tool in information processing in digital computers to indicate
any presence of error in binary information. External noise and loss of signal strength causes
loss of data bit information while transporting data from one device to other device, located
inside the computer or externally. To indicate any occurrence of error, an extra bit is included
with the message according to the total number of 1s in a set of data, which is called parity.
HOD / ECE
If the extra bit is considered 0 if the total number of 1s is even and 1 for odd quantities
of 1s in a set of data, then it is called even parity. On the other hand, if the extra bit is 1 for
even quantities of 1s and 0 for an odd number of 1s, then it is called odd parity.
The message including the parity is transmitted and then checked at the receiving end
for errors. An error is detected if the checked parity does not correspond with the one
transmitted. The circuit that generates the parity bit in the transmitter is called a parity generator
and the circuit that checks the parity in the receiver is called a parity checker.
TRUTH TABLE:
D7 D6 D5 D4 D3 D2 D1 D0 D7 D6 D5 D4 D3 D2 D1 D0 PE PO ∑E ∑O
1 1 0 0 0 0 0 1 1 0 0 0 0 0
1 0 1 0
0 0
1 1 0 0 0 0 0 1 1 0 0 0 0 0
0 1 0 1
0 0
1 1 0 0 0 0 0 0 1 0 0 0 0 0
0 1 1 0
0 0
TRUTH TABLE:
HOD / ECE
D7’ D6’ D5’ D4’ D3’ D2’
D7 D6 D5 D4 D3 D2 D1 D0 PE PO ∑E ∑O
D1’D0’
0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 1 1 0
1
0 0 0 0 0 1 1
0 0 0 0 0 1 1 0 1 0 1 0
0
0 0 0 0 0 1 1
0 0 0 0 0 1 1 0 0 1 0 1
0
The parity checker circuit produces a check bit and is very similar to the parity generator
circuit. If the check bit is 1, then it is assumed that the received data is incorrect. The check bit
will be 0 if the received data is correct. The table shows the truth table for the even parity
checker.
In even parity, the added parity bit will make the total number 1’s even amount. In odd
parity, the added parity bit will make the total number 1’s odd amount. The parity checker
circuit checks for possible errors in the transmission. If the information is passed in even parity,
the bits required must have an even number of 1’s. An error occur during transmission, if the
received bits have an odd number of 1’s indicating that one bit has changed in value during
transmission.
PROCEDURE:
1. Connections are given as per the logic diagram.
2. Logic inputs are given as per the truth table.
3. Observe the logic output and verify with the truth tables
HOD / ECE
RESULT:
Thus the 16 bit odd /even parity checker generator was designed and implemented using
IC 74180.
HOD / ECE
Inputs Outputs
Preset Clear Clock J K Q Q’
0 1 X X X 1 0
1 0 X X X 0 1
0 0 X X X 1 1
1 1 0 0 No Change
1 1 0 1 0 1
1 1 1 0 1 0
1 1 1 1 Toggle
AIM:
To construct and verify 4 bit ripple counter, MOD-10 and MOD-12 ripple counter.
APPARATUS REQUIRED:
THEORY:
A counter is a register capable of counting number of clock pulse arriving at its clock
input. Counter represents the number of clock pulse arrived. A specified
HOD / ECE
sequence of states appears as counter output. This is the main difference between a register and
a counter. There are two types of counter, synchronous and asynchronous. In synchronous
common clock is given to all flip flop and in asynchronous, first flip flop is clocked by external
pulse and then each successive flip flop is clocked by Q or Q’ output of pervious stage.
A ripple counter is a cascaded arrangement of flip-flops where the output of one flip-
flop drives the clock input of the following flip-flop. The number of flip-flops in the cascaded
arrangement depends upon the number of different logic states that it goes through before it
repeats the sequence, a parameter known as the modulus of the counter.
In a ripple counter, also called an asynchronous counter or a serial counter, the clock
input is applied only to the first flip-flop, also called the input flip-flop, in the cascaded
arrangement. The clock input to any subsequent flip-flop comes from the output of its
immediately preceding flip-flop. For instance, the output of the first flip-flop acts as the clock
input to the second flip-flop, the output of the second flip-flop feeds the clock input of the third
flip-flop and so on.
TRUTH TABLE:
CLK QA QB QC QD
0 0 0 0 0
HOD / ECE
1 1 0 0 0
2 0 1 0 0
3 1 1 0 0
4 0 0 1 0
5 1 0 1 0
6 0 1 1 0
7 1 1 1 0
8 0 0 0 1
9 1 0 0 1
10 0 1 0 1
11 1 1 0 1
12 0 0 1 1
13 1 0 1 1
14 0 1 1 1
15 1 1 1 1
A four-bit ripple counter is implemented with negative edge-triggered J-K flip-flops
wired as toggle flip-flops. The output of the first flip-flop feeds the clock input of the second,
and the output of the second flip-flop feeds the clock input of the third, the output of which in
turn feeds the clock input of the fourth flip-flop. The outputs of the four flip-flops are
designated as Q0 (LSB flip-flop), Q1, Q2 and Q3 (MSB flip-flop).
HOD / ECE
TRUTH TABLE:
CLK QA QB QC QD
0 0 0 0 0
1 1 0 0 0
2 0 1 0 0
3 1 1 0 0
4 0 0 1 0
5 1 0 1 0
6 0 1 1 0
7 1 1 1 0
8 0 0 0 1
9 1 0 0 1
10 0 0 0 0
LOGIC DIAGRAM: (MOD-12 Ripple Counter)
HOD / ECE
TRUTH TABLE:
CLK QA QB QC QD
0 0 0 0 0
1 1 0 0 0
2 0 1 0 0
3 1 1 0 0
4 0 0 1 0
5 1 0 1 0
6 0 1 1 0
7 1 1 1 0
8 0 0 0 1
9 1 0 0 1
10 0 1 0 1
11 1 1 0 1
12 0 0 0 0
PROCEDURE:
1. Connections are given as per the logic diagram.
2. Logic inputs are given as per the logic diagram.
3. Observe the logic output and verify with the truth tables.
RESULT: Thus 4-bit ripple counter, MOD-10 and MOD-12 ripple counter was constructed
and verified successfully.
3- BIT SYNCHRONOUS UP/DOWN COUNTER:
HOD / ECE
STATE DIAGRAM:
TRUTH TABLE:
HOD / ECE
AIM:
To design and implement 3 bit synchronous up/down counter using JK flip-flop.
APPARATUS REQUIRED:
THEORY:
A Counter is a register capable of counting number of clock pulse arriving at its clock
input. Counter represents the number of clock pulses arrived. An up/down counter is one that
is capable of progressing in increasing order or decreasing order through a certain sequence.
An up/down counter is also called bi-directional counter. Usually up/down operation of the
counter is controlled by up/down signal. When this signal high counter goes through up
sequence and when up/down signal is low counter follows reverse sequence.
The counter counts upwards when UP control are logic ‘1’ and DOWN control is logic
‘0’. In this case the clock input of each flip-flop other than the LSB flip-flop is fed from the
normal output of the immediately preceding flip-flop. The counter counts downwards when the
UP controls input are logic ‘0’ and DOWN control is logic ‘1’. In this case, the clock input of
each flip-flop other than the LSB flip-flop is fed from the complemented output of the
immediately preceding flip-flop.
HOD / ECE
EXCITATION TABLE: (JK Flip-Flop)
Q Q t+1 J K
0 0 0 x
0 1 1 x
1 0 x 1
1 1 x 0
K-MAP SIMPLIFICATION:
HOD / ECE
LOGIC DIAGRAM:
PROCEDURE:
RESULT:
Thus 3- bit synchronous up/down counter was designed and implemented
successfully.
HOD / ECE
SHIFT REGISTER:
PIN DIAGRAM: (D-Flip-Flop)
Function Table:
Inputs Outputs
Preset Clear Clock D Q Q’
0 1 X X 1 0
1 0 X X 0 1
0 0 X X 1 1
1 1 0 0 1
1 1 1 1 0
1 1 0 X No Change
HOD / ECE
AIM:
To design and implement
1. Serial in serial Out(SISO)
2. Serial in parallel Out(SIPO)
3. Parallel in serial Out(PISO)
4. Parallel in parallel Out(PIPO)
APPARATUS REQUIRED:
THEORY:
A register is capable of shifting its binary information in one or both directions is known
as shift register. A logical configuration of shift register consist of a D flip flop cascaded with
output of one flip flop connected to input of next flip flop. All flip flops receive common clock
pulses which causes the shift in the output of the flip flop. The simplest possible shift register
is one that uses only flip flop. The output of a given flip flop is connected to the input of next
flip flop of the register. Each clock pulse shifts the content of register one bit position to right.
HOD / ECE
Function Table: (74157)
TRUTH TABLE:
HOD / ECE
Serial IN Parallel OUT:
LOGIC DIAGRAM:
TRUTH TABLE:
OUTPUT
CLK DATA
Q3 Q2 Q1 Q0
1 1 1 0 0 0
2 0 0 1 0 0
3 0 0 0 1 0
4 1 1 0 0 1
HOD / ECE
Parallel IN Serial OUT:
LOGIC DIAGRAM:
TRUTH TABLE:
HOD / ECE
Parallel IN Parallel OUT:
Logic Diagram:
TRUTH TABLE:
PROCEDURE:
HOD / ECE
Logic Diagram:
Fulladder using two half adders:
Truth Table:
Inputs Outputs
x y Cin Sum (S) Carry (Cout)
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
HOD / ECE
Aim:
To design the following experiment using Verilog HDL
Software Used:
1. Xilinx 9.1i
Program:
HOD / ECE
Logic Diagram:
Full Subtractor using two half subtractors:
Truth table:
Inputs Outputs
x y Bin Difference(D) Borrow(Bout)
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
HOD / ECE
Program:
//Gate-level description of Full Subtractor using two Half Subtractor
//Description of Half Subtractor
module halfsubtractor(d,bo,x,y);
input x,y;
output d,bo;
wire z; //Output of NOT gate
//Instatiate primitive gates
xor (d,x,y);
not (z,x);
and (bo,z,y);
endmodule
//Description of Full Subtractor
module fullsubtractor(d,bo,x,y,bi);
input x,y,bi;
output d,bo;
wire a,g1,g2; //Outputs of first XOR and AND gates
//Instantiate Half Subtractor
halfsubtractor hs_1(a,g1,x,y);
halfsubtractor hs_2(d,g2,a,bi);
or or_gate(bo,g2,g1);
endmodule
HOD / ECE
Logic Diagram:
4 to 1 Multiplexer:
Truth table:
INPUT OUTPUT
s[1] s[0] y
0 0 D[0]
0 1 D[1]
1 0 D[2]
1 1 D[3]
HOD / ECE
//Gate-level description of 4 to 1 Multiplexer
module multiplexer(y,d,s);
output y;
input [3:0] d;
input [1:0] s;
wire a,b,c,e,f,g,h,i;
//Instantiate Primitive gates
not (a,s[1]);
not (b,s[0]);
and (c,d[0],b,a);
and (e,d[1],s[0],a);
and (f,d[2],b,s[1]);
and (g,d[3],s[0],s[1]);
or (h,c,e);
or (i,f,g);
or (y,h,i);
endmodule
Logic Diagram:
1 to 4 Demultiplexer:
HOD / ECE
Truth Table:
INPUT OUTPUT
s[1] s[0] D y[0] y[1] y[2] y[3]
0 0 0 0 0 0 0
0 0 1 1 0 0 0
0 1 0 0 0 0 0
0 1 1 0 1 0 0
1 0 0 0 0 0 0
1 0 1 0 0 1 0
1 1 0 0 0 0 0
1 1 1 0 0 0 1
TRUTH TABLE:
HOD / ECE
COUNT A0 A1 A2 A3
0 0 0 0 0
1 1 0 0 0
2 0 1 0 0
3 1 1 0 0
4 0 0 1 0
5 1 0 1 0
6 0 1 1 0
7 1 1 1 0
8 0 0 0 1
9 1 0 0 1
10 0 1 0 1
11 1 1 0 1
12 0 0 1 1
13 1 0 1 1
14 0 1 1 1
15 1 1 1 1
HOD / ECE
MOD-10 Ripple Counter:
TRUTH TABLE:
COUNT A0 A1 A2 A3
0 0 0 0 0
1 1 0 0 0
2 0 1 0 0
3 1 1 0 0
4 0 0 1 0
5 1 0 1 0
6 0 1 1 0
7 1 1 1 0
8 0 0 0 1
9 1 0 0 1
10 0 0 0 0
HOD / ECE
module MOD10(A0,A1,A2,A3,COUNT);
output A0,A1,A2,A3;
input COUNT;
wire RESET;
//Instantiate Flip-Flop
FF F0(A0,COUNT,RESET);
FF F1(A1,A0,RESET);
FF F2(A2,A1,RESET);
FF F3(A3,A2,RESET);
//Instantiate Primitive gate
nand (RESET,A1,A3);
endmodule
//Description of Flip-Flop
module FF(Q,CLK,RESET);
output Q;
input CLK,RESET;
reg Q=1'b0;
always @(negedge CLK or negedge RESET)
if(~RESET)
Q=1'b0;
else
Q=(~Q);
endmodule
HOD / ECE
LOGIC DIAGRAM:
MOD-12 Ripple Counter:
TRUTH TABLE:
COUNT A0 A1 A2 A3
0 0 0 0 0
1 1 0 0 0
2 0 1 0 0
3 1 1 0 0
4 0 0 1 0
5 1 0 1 0
6 0 1 1 0
7 1 1 1 0
8 0 0 0 1
9 1 0 0 1
10 0 1 0 1
11 1 1 0 1
12 0 0 0 0
HOD / ECE
//Structural description of MOD12 Counter
module MOD12(A0,A1,A2,A3,COUNT);
output A0,A1,A2,A3;
input COUNT;
wire RESET;
//Instantiate Flip-Flop
FF F0(A0,COUNT,RESET);
FF F1(A1,A0,RESET);
FF F2(A2,A1,RESET);
FF F3(A3,A2,RESET);
//Instantiate Primitive gates
nand (RESET,A2,A3);
endmodule
//Description of Flip-Flop
module FF(Q,CLK,RESET);
output Q;
input CLK,RESET;
reg Q=1'b0;
always @(negedge CLK or negedge RESET)
if(~RESET)
Q=1'b0;
else
Q=(~Q);
endmodule
LOGIC DIAGRAM:
SERIAL IN SERIAL OUT:
TRUTH TABLE:
HOD / ECE
Clk d q
1 1 0
2 1 0
3 1 0
4 1 1
5 0 1
6 0 1
7 0 1
8 0 0
//Description of D - Flipflop
module dff(q,d,clk);
output q;
input d,clk;
reg q=1'b0;
always @(posedge clk)
q=#5 d;
endmodule
LOGIC DIAGRAM:
Serial IN Parallel OUT:
HOD / ECE
TRUTH TABLE:
OUTPUT
Clk d
Q[3] Q[2] Q[1] Q[0]
1 1 1 0 0 0
2 1 1 1 0 0
3 1 1 1 1 0
4 1 1 1 1 1
//Description of D - Flipflop
module dff(q,d,clk);
output q;
input d,clk;
reg q=1'b0;
always @(posedge clk)
q=#5 d;
endmodule
LOGIC DIAGRAM:
Parallel IN Serial OUT:
HOD / ECE
TRUTH TABLE:
INPUT OUTPUT
Sl Clk
i[3] i[2] i[1] i[0] q
0 0 1 0 0 1 1
1 1 1 0 0 1 0
1 2 1 0 0 1 0
1 3 1 0 0 1 1
HOD / ECE
output q;
wire [2:0] a;
wire [6:0] b;
wire [2:0] c;
wire d;
input clk,sl;
input [3:0]i;
//Instantiate D – Flipflop
dff df1(a[0],b[0],clk);
dff df2(a[1],c[0],clk);
dff df3(a[2],c[1],clk);
dff df4(q,c[2],clk);
//Instantiate Primitive gates
not (d,sl);
and (b[0],d,i[3]);
and (b[1],a[0],sl);
and (b[2],d,i[2]);
and (b[3],a[1],sl);
and (b[4],d,i[1]);
and (b[5],a[2],sl);
and (b[6],d,i[0]);
or (c[0],b[1],b[2]);
or (c[1],b[3],b[4]);
or (c[2],b[5],b[6]);
endmodule
//Description of D - Flipflop
module dff(q,d,clk);
output q;
input d,clk;
reg q=1'b0;
always @(posedge clk)
q=d;
endmodule
Logic Diagram:
Parallel IN Parallel OUT:
HOD / ECE
TRUTH TABLE:
INPUT OUTPUT
Clk
d[3] d[2] d[1] d[0] q[3] q[2] q[1] q[0]
1 1 0 1 0 1 0 1 0
2 1 0 0 1 1 0 0 1
//Description of D - Flipflop
module dff(q,d,clk);
output q;
input d,clk;
reg q=1'b0;
always @(posedge clk)
q=#5 d;
endmodule
HOD / ECE