Digital Report
Digital Report
Digital Report
Submitted by
BL.EN.U4ECE22023 G SATHWICK
COMPONENTS REQUIRED: Three dip switches(8 pin,6 pin,2 pin),Four bit magnitude comparator
(7485), Four bit parallel adder/subtractor (7483), XOR Gate (7486) Three, LED(5+3+4), Resisters(5+3+4).
THEORY:
A binary code represents text, computer processor instructions, or any other data using a twosymbol system.
The two-symbol system used is often "0" and "1" from the binary number system. The reflected binary code,
also known just as reflected binary or Gray code after Frank Gray, is an ordering of the binary numeral
system such that two successive values differ in only one bit. It is an unweighted code, as here like other
number systems, no particular weight is provided to various bit positions. Basically, binary code is changed
to gray equivalent in order to lessen the switching operations. As only a single bit is changed at a particular
time duration this leads to a reduction in switching from one bit to another.
• In the Gray code, the MSB will always be the same as the 1'st bit of the given binary number.
• In order to perform the 2nd bit of the gray code, perform the exclusive-or (XOR) of the 1'st and 2nd
bit of the binary number. It means that if both the bits are different, the result will be one else the
result will be 0.
• n order to get the 3rd bit of the gray code, perform the exclusive-or (XOR) of the 2nd and 3 rd bit of
the binary number. The process remains the same for the remaining bits of the Gray code.
Let's take an example to understand these steps. Consider a binary number 01101
Truth Table:
Logical Equation:
G3 = Ʃm (8,9,10,11,12,13,14,15)
G2 = Ʃm (4,5,6,7,8,9,10,11)
G1 = Ʃm (2,3,4,5,10,11,12,13)
G0 = Ʃm (1,2,5,6,9,10,13,14)
K-Map Simplification:
K map for g0 K map for g1
Truth Table:
Logic Equation:
B3 = Ʃm(8,9,10,11,12,13,14,15)
B2 = Ʃm (4,5,6,7,8,9,10,11)
B1 = Ʃm (2,3,4,5,8,9,10,11)
B0 = Ʃm (1,2,4,7,8,11,13,14)
K-Map Simplification
K map for b0 K map for b1
bo= g3 ⊕g2 ⊕g1 ⊕go b1=g3 ⊕g2 ⊕g1
Logic Diagram:
4-bit Magnitude Comparator:
A comparator used to compare two binary numbers each of four bits is called a 4-bit magnitude comparator.
It consists of eight inputs each for two four-bit numbers and three outputs to generate less than, equal to, and
greater than between two binary numbers.
In a 4-bit comparator, the condition of A>B can be possible in the following four cases.
1. If A3 = 1 and B3 = 0
2. If A3 = B3 and A2 = 1 and B2 = 0
3. If A3 = B3, A2 = B2 and A1 = 1 and B1 = 0
4. If A3 = B3, A2 = B2, A1 = B1 and A0 = 1 and B0 = 0
Similarly, the condition for A<B can be possible in the following four cases.
1. If A3 = 0 and B3 = 1
2. If A3 = B3 and A2 = 0 and B2 = 1
3. If A3 = B3, A2 = B2 and A1 = 0 and B1 = 1
4. If A3 = B3, A2 = B2, A1 = B1 and A0 = 0 and B0 = 1
The condition of A=B is possible only when all the individual bits of one number exactly coincide with the
corresponding bits of another number.
Parallel Adder/Subtractor:
A parallel adder/subtractor is a system consists of n full adders connected in series for an n bit addition. The
inputs for the system are two n bit numbers and carry-in, output for the system is n bit sum and carry-out.
The Arithmetic micro-operations like addition and subtraction can be combined into one common circuit by
including an exclusive-OR gate with each full adder. The Subtraction micro-operation can be done easily by
taking the 2's complement of addend bits and adding it to the augend bits.
Logic Diagram of Adder/Subtractor:
Parallel Adder/Subtractor using IC7483:
Example:
Assume two unsigned 4-bit numbers A and B where
A = 1011 B = 0110
To perform (A + B), use 4-bit Ripple carry adder where the carry-in Ci is 0.
For subtraction (A – B), A is added with 2’s complement of B i.e. A + (-B)
A = 1011 A = 1011
B = 0110 (-B) = 1001 1’s comp of B
+ 0˿ c0 + 1 (1’s comp + 1 = 2’s comp of B)
10001 10101
Another Inputs
A = 1010 B = 1110
A+B A-B
A=1010 A= 1010
B=1110 (-B)= 0001 1’s comp of B
+ 0-Cin + 1 (1’s comp + 1 = 2’s comp of B)
11000 01100
A = 1010 B = 0011
A+B A-B
A=1010 A= 1010
B=0011 (-B)= 1100 1’s comp of B
+ 0-Cin + 1 (1’s comp + 1 = 2’s comp of B)
01101 10111
BLOCK DIAGRAM CONSISTING ALL THE REQUIRED FUNCTIONS:
Pin description:
Dip switch’s
1 – a3
2 – a2
3 – a1
4 – a0
5 – b3
6 – b2
7 – b1
8 – b0
2 – (is used for connection between XOR IC’s of Binary to gray and Gray to Binary)
1 – a3
2 – a2
3 – o/p(g2)
4 – a2
5 – a3
6 – o/p(g1)
7 – GND
8 – o/p(g0)
9 – a0
10 – a3
14 – Vcc
1 – a3
2 – a2
3 – o/p(g2)
4 – g2
5 – a3
6 – o/p(g1)
7 – GND
8 – o/p(g0)
9 – a0
10 – g1
14 – Vcc
7486:-
1 – b3
2 – Cin
3 – o/p(b3)
4 – b2
5 – Cin
6 – o/p(b2)
7 – GND
8 – o/p(b1)
9 – Cin
10 – b1
11 – o/p(b0)
12 – Cin
13 – b0
14 –Vcc
7483:
1 – a3
2 – o/p(s2)
3 – a2
4 – b2(o/p of XOR)
5 – Vcc
6 – s1(o/p)
7 – b1(o/p of XOR)
8 – a1
9 – s0(o/p)
10 – a0
11 – b0(o/p of XOR)
12 – GND
13 – Cin
14 –Cout(o/p)
15 – s3(o/p)
16 – b3(o/p of 7486)
For Magnitude Comparator:
7485:-
1 – b3
2–
3 – 1(Vcc)
4–
5 – o/p(A>B)
6 – o/p(A=B)
7 – o/p(A<B)
8 – GND
9 – b0
10 – a0
11 – b1
12 – a1
13 – a2
14 –b2
Another Inputs
A = 1010 B = 1110
A+B A-B
A=1010 A= 1010
B=1110 (-B)= 0001 1’s comp of B
+ 0-Cin + 1 (1’s comp + 1 = 2’s comp of B)
11000 01100
A = 1010 B = 0011
A+B A-B
A=1010 A= 1010
B=0011 (-B)= 1100 1’s comp of B
+ 0-Cin + 1 (1’s comp + 1 = 2’s comp of B)
01101 10111
RESULT:
The implementation of system level design, where we asked to show
(1) Binary code to grey code
(2) Grey code to binary code
(3) Magnitude comparator
(4) Parallel adder/subtractor
has been performed successfully.
CONCLUSION:
The truth tables of all the experiments which were asked have been verified successful and
the outputs of respective experiments have been showcased using LED’s.
1. Encoders –
An encoder is a combinational circuit that converts binary information in the form of a 2N input lines into N
output lines, which represent N bit code for the input. For simple encoders, it is assumed that only one input
line is active at a time.
As an example, let’s consider Octal to Binary encoder. As shown in the following figure, an octal-to-binary
encoder takes 8 input lines and generates 3 output lines.
Truth Table –
D7 D6 D5 D4 D3 D2 D1 D0 X Y Z
0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 1 0 0 0 1
0 0 0 0 0 1 0 0 0 1 0
0 0 0 0 1 0 0 0 0 1 1
0 0 0 1 0 0 0 0 1 0 0
0 0 1 0 0 0 0 0 1 0 1
0 1 0 0 0 0 0 0 1 1 0
1 0 0 0 0 0 0 0 1 1 1
As seen from the truth table, the output is 000 when D0 is active; 001 when D1 is active; 010 when D2 is
active and so on.
Implementation –
From the truth table, the output line Z is active when the input octal digit is 1, 3, 5 or 7. Similarly, Y is 1
when input octal digit is 2, 3, 6 or 7 and X is 1 for input octal digits 4, 5, 6 or 7. Hence, the Boolean
functions would be:
X = D4 + D5 + D6 + D7
Y = D2 +D3 + D6 + D7
Z = D1 + D3 + D5 + D7
Hence, the encoder can be realised with OR gates as follows:
One limitation of this encoder is that only one input can be active at any given time. If more than one inputs
are active, then the output is undefined. For example, if D6 and D3 are both active, then, our output would
be 111 which is the output for D7. To overcome this, we use Priority Encoders.
Another ambiguity arises when all inputs are 0. In this case, encoder outputs 000 which actually is the output
for D0 active. In order to avoid this, an extra bit can be added to the output, called the valid bit which is 0
when all inputs are 0 and 1 otherwise.
Priority Encoder –
A priority encoder is an encoder circuit in which inputs are given priorities. When more than one inputs are
active at the same time, the input with higher priority takes precedence and the output corresponding to that
is generated.
Truth Table-
D3 D2 D1 D0 X Y V
0 0 0 0 x x 0
0 0 0 1 0 0 1
0 0 1 x 0 1 1
0 1 x x 1 0 1
1 x x x 1 1 1
Implementation –
It can clearly be seen that the condition for valid bit to be 1 is that at least any one of the inputs should be
high. Hence,
V = D0 + D1 + D2 + D3
For X: For Y:
Decoders –
A decoder does the opposite job of an encoder. It is a combinational circuit that converts n lines of input into
2n lines of output.
Truth Table –
X Y Z D0 D1 D2 D3 D4 D5 D6 D7
0 0 0 1 0 0 0 0 0 0 0
0 0 1 0 1 0 0 0 0 0 0
0 1 0 0 0 1 0 0 0 0 0
0 1 1 0 0 0 1 0 0 0 0
1 0 0 0 0 0 0 1 0 0 0
1 0 1 0 0 0 0 0 1 0 0
1 1 0 0 0 0 0 0 0 1 0
1 1 1 0 0 0 0 0 0 0 1
Implementation –
D0 is high when X = 0, Y = 0 and Z = 0. Hence,
D0 = X’ Y’ Z’
Similarly,
D1 = X’ Y’ Z
D2 = X’ Y Z’
D3 = X’ Y Z
D4 = X Y’ Z’
D5 = X Y’ Z
D6 = X Y Z’
D7 = X Y Z
Hence,
EXCESS-3 Code:
-By Emani Sandeep Reddy
B.EN.U4ECE22022
Excess-3, also called XS3, is a non weighted code used to express decimal numbers. It can be used for the
representation of multi-digit decimal numbers as can BCD.The code for each decimal number is obtained by
adding decimal 3 and then converting it to a 4-bit binary number. For e.g. decimal 2 is coded as 0010 + 0011
= 0101 in Excess-3 code.
This is self complementing code which means 1‘s complement of the coded number yields 9‘s complement
of the number itself. Self complementing property of this helps considerably in performing subtraction
operation in digital systems, so this code is used for certain arithmetic operations.
For converting 4 bit BCD code to Excess – 3, add 0011 i. e. decimal 3 to the respective code using rules of
binary addition.
The 4 bit Excess-3 coded digit can be converted into BCD code by subtracting decimal value 3 i.e. 0011
from 4 bit Excess-3 digit.
K-Map
For BCD to Excess 3
K-Map for z K-Map for y
z = D’
y =CD+C’D’
x= B’C+B’D+BC’D’
w = A+BC+BD
For Excess 3 to BCD
K-Map for D- K-Map for C-
A= wx+wyz
B= x’y’+x’z’+xyz
C= y’z+yz’
D= z’
Circuit Diagram:
Multiplexer
To construct a 4 to 1 multiplexer, we need to know how many selection lines we required to create a MUX?
We require n selection lines, where 2n represents total input lines and n represents selection lines. (In this
case, 22 that gives 4 input lines and 2 selection lines).
A multiplexer is often abbreviated as MUX or many to one circuit or parallel to serial circuit.
It is a data selector that provides the mechanism to select single binary information from many input lines
and passes it to output line
Types of Multiplexers
There are various types of multiplexers and few are given below:
2:1 MUX
4:1 MUX
8:1 MUX
16:1 MUX
32:1 MUX
Now we’ll be discussing 4:1 MUX.
Here are the steps to design or construct 4 to 1 Multiplexer or 4:1 MUX using Logic Gates :
1) Now, make a diagram of multiplexer with 4 input lines, 2 selection lines and 1 output. In below diagram,
A0 , A1 , A2 and A3 are input data lines, S0 and S1 are Selection lines and lastly one output line named Y
2) This is how a truth table for 4 to 1 MUX looks like . According to the truth table, the output of the
multiplexer fully depends on selection lines (binary data , 00,01,10 & 11) and one input would be selected
from all the input data lines as the output.
Truth table
3) In last step, design 4 to 1 multiplexer by using 4 AND gates and a single OR gate.
Explanation:
In above diagram, there were two selection lines along with their respective complements using Inverters.
Each and every AND gate were holding three inputs from S1, S0 and a particular input A. lastly, outputs of
all AND gates became the input for OR gate and providing a single output.
1x4 De-Multiplexer:-
1x4 De-Multiplexer has one input I, two selection lines, s1 & s0 and four outputs Y3, Y2, Y1 &Y0. The block
diagram of 1x4 De-Multiplexer is shown in the following figure.
The single input ‘I’ will be connected to one of the four outputs, Y3 to Y0 based on the values of selection
lines s1 & s0. The Truth table of 1x4 De-Multiplexer is shown below.
We can implement these Boolean functions using Inverters & 3-input AND gates. The circuit diagram of
1x4 De-Multiplexer is shown in the following figure.
To Convert BCD into Seven Segment Display
- By M Bhanu Charan
BL.EN.U4ECE22033
In Binary Coded Decimal (BCD) encoding scheme each of the decimal numbers(0-9) is represented by its
equivalent binary pattern(which is generally of 4-bits).
Whereas, Seven segment display is an electronic device which consists of seven Light Emitting Diodes
(LEDs) arranged in a some definite pattern (common cathode or common anode type), which is used to
display Hexadecimal numerals(in this case decimal numbers,as input is BCD i.e., 0-9).
But, seven segment display does not work by directly supplying voltage to different segments of LEDs.
First, our decimal number is changed to its BCD equivalent signal then BCD to seven segment decoder
converts that signals to the form which is fed to seven segment display.
This BCD to seven segment decoder has four input lines (A, B, C and D) and 7 output lines (a, b, c, d, e, f
and g), this output is given to seven segment LED display which displays the decimal number depending
upon inputs.
Truth Table – For common cathode type BCD to seven segment decoder:
Note –
For Common Anode type seven segment LED display, we only have to interchange all ‘0s’ and ‘1s’ in the
output side i.e., (for a, b, c, d, e, f, and g replace all ‘1’ by ‘0’ and vice versa) and solve using K-map.
Output for first combination of inputs (A, B, C and D) in Truth Table corresponds to ‘0’ and last
combination corresponds to ‘9’. Similarly rest corresponds from 2 to 8 from top to bottom.
BCD numbers only range from 0 to 9,thus rest inputs from 10-F are invalid inputs.
Explanation –
For combination where all the inputs (A, B, C and D) are zero (see Truth Table), our output lines are a = 1, b
= 1, c = 1, d = 1, e = 1, f = 1 and g = 0. So 7 segment display shows ‘zero’ as output.
Similarly, for combination where one of the input is one (D = 1) and rest are zero,our output lines are a = 0,
b = 1, c = 1, d = 0, e = 0, f = 0 and g = 0. So only LEDs ‘b’ and ‘c’ (see diagram above) will glow and 7
segment display shows ‘one’ as output.
K-Maps:
#for a: #for b:
#for c: #for d:
#for e: #for g:
Applications – Seven-segment displays are used to display the digits in calculators, clocks, various
measuring instruments, digital watches and digital counters.