Sie sind auf Seite 1von 44

Combinational Logic Circuits

Part 1 – Arithmetic and Code


Converter
LOGCIRA113 – Logic Circuits and Switching Theory
Midterm Lecture 2 & 3

by: Engr. Ricrey E. Marquez, CpE, MSCS


Lecture Objectives
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits

• At the end of this lecture, you are able to:


– know the difference between combinational
logic circuits and sequential logic circuits;
– understand the basic elements/parts of
combinational logic circuits;
– know the design procedures in designing
combinational logic circuits;
– familiarize different applications of combination
logic circuits such arithmetic and code
converter circuits
Introduction
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits
• Logic circuits for digital systems may be
combinational or sequential.
– Combinational logic circuit consists of logic gates
whose outputs at any time are determined directly from
the present combination of inputs without regard to
previous inputs.
– combinational circuit performs a specific information-
processing operation fully specified logically by a set of
Boolean functions
– Sequential logic circuits employ memory elements
(binary cells) in addition to logic gates. Their outputs
are a function of the inputs and the state of the
memory elements.
Combinational Logic Circuit versus Sequential
Logic Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits
• Combinational Logic Circuit (CLC)
– logic circuit that consists of logic gates whose outputs at any time
are determined directly from the present combinations of inputs
without considering its previous output.
• Outputs are only function of current input combination
• Nothing is known about past events
• Repeating a sequence of inputs always gives the same output
sequence

Figure 1. Block diagram of Combinational Logic Circuits


Combinational Logic Circuit versus Sequential
Logic Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits
• Sequential Logic Circuits (SLC)
– logic circuit that employs memory elements (binary cells) in
addition to logic gates.
– outputs are function of the inputs and the state of the memory
elements.
• output value depends on input value and present state value
• must have some way of retaining state via memory devices.
• use a clock signal in a synchronous sequential system to control changes
between states

Figure 2. Block diagram of Sequential Logic Circuits


Elements of Combinational Logic Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits

• Input variable (n)


– binary values comes from external inputs such switches, sensors, and other
possible input source.
– n -input variables could have 2n possible combinations of binary input values.

• Output variable (m)


– generated variables for each possible combination of inputs.
• each possible input, combination, there is one and only one possible output combination.
• each output function is expressed in terms of n-input variable.

• Logic Gates
– digital logic circuits that accept signals from inputs and generate signals to the
output.
– could be any combination basic logic gates, these are the AND, OR, NAND, NOR,
XOR, INV, and BUF
Classifications of CLC
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits
Design Procedure of Combinational Logic
Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits
• Design of combinational circuits starts from the verbal
outline of the problem and ends in a logic circuit diagram
or a set of Boolean functions from which the logic diagram
can be easily obtained.
• Design procedure involves the following steps:
1. Problem is stated.
2. Determine the number of available input variables and required
output variables.
3. Assigned letter or symbols for input and output variables.
4. Derived a truth table that defines the required relationships
between inputs and outputs.
5. Obtained the simplified Boolean function for each output.
6. Draw the logic diagram.
Sample Design Applications of Combinational
Logic Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits

• Arithmetic circuits are the ones which perform


arithmetic operations like addition, subtraction,
multiplication, division, code conversion, and parity
calculation.
• Conversion circuit must be inserted between the two
systems if each uses different codes for the same
information and thus circuit that makes the two systems
compatible even though each uses a different binary code
• Most of the time, designing these circuits is the same as
designing multiplexer (muxers), encoders, and
decoders.
Design Applications of Combinational
Logic Circuit – Arithmetic Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits

• Adder Circuit
– basic building blocks of all arithmetic circuits
– circuits that add binary numbers and give out
sum (S) and carry (C) as output.
– Basically we have three types of adders:

• Half-Adder (HA)
• Full-Adder (FA)
• n-bit Parallel adder
Design Applications of Combinational
Logic Circuit – Arithmetic Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits

• Half-Adder (HA) - a combinational logic circuit


that performs the addition of two bits.

B B
A A
0 1 0 0
1 0 0 1
S=AB C=AB
Figure 3. Half-Adder Circuit
Design Applications of Combinational
Logic Circuit – Arithmetic Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits

• Full Adder (FA) – a combinational logic


circuit that adds three bits
BCin BCin
A A
0 1 0 1 0 0 1 0
1 0 1 0 0 1 1 1
S = A  B  Cin Cout= AB + Cin (A  B)

Figure 4. Full-Adder Circuit


Design Applications of Combinational
Logic Circuit – Arithmetic Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits
• n-bit Parallel Adder – a combinational logic circuit that add two n-bit
binary numbers and can be built by connecting nth full adders in
series.
– each full adder represents a bit position i (from 0 to n-1).
– each carry out (Cout) from a full adder at position i is connected to the
carry in (Cin) of the full adder at higher position i+1.
– output of a full adder at position i is given by:
• Si = (ai  bi)  Co(i-1)  NOTE: Co0 = Cin
• Coi = aibi + Co(i-1) (ai  bi) i = 1, 2, -- n

Figure 5. 4-bit Parallel Adder Circuit


Design Applications of Combinational
Logic Circuit – Arithmetic Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits
• Subtractor Circuit
– circuits take two binary numbers as input and subtract one binary
number input from the other binary number input.
– similar to adders, it gives out two outputs, difference and borrow
(carry-in the case of adder).
– circuit may be accomplished by taking the complement of the
subtrahend and adding it to minuend.
• subtracation of A – B can be done by taking the 2’s complement of B and
adding it to A because A - B = A + (-B)
• inverters is used to make 1’s complement of B (connecting each Bi to an
inverter) and then add 1 to the least significant bit (by setting carry C0 to 1) of
binary adder.
– Basically we have three types of subtractor:
• Half-Subtractor (HS)
• Full-Subtractor (FS)
• n-bit Parallel Subtractor
Design Applications of Combinational
Logic Circuit – Arithmetic Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits
• Half Subtractor (HS) – a combinational logic
circuit that performs the subtraction of two bits.

b b
a a B
0 1 0 1
1 0 0 0
D=ab B = a’ b

Figure 6. Half-Subtractor Circuit


Design Applications of Combinational
Logic Circuit – Arithmetic Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits
• Full-Subtractor (FS) - a combinational logic circuit that
performs the subtraction of three bits and can be obtain
by cascading two half-subtractor.
bBin bBin
a a
0 1 0 1 0 1 1 1
1 0 1 0 0 0 1 0
D = a  b  Bin Bo = a’b + Bin (a  b)’

Figure 7. Full-Subtractor Circuit


Design Applications of Combinational
Logic Circuit – Arithmetic Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits
• n-bit Parallel Subtractor - a combinational logic circuit
that subtract two n-bit binary numbers and can be built by
connecting nth full subtractor or nth full adder with inverted
subtrahend(B) in series.

Figure 8. 4-bit Parallel Subtractor Circuit

Di = ai  bi  Bo (i-1)  NOTE: Bo0 = Bin


Boi = a’ibi + Bo(i-1) (ai  bi)’
Design Applications of Combinational
Logic Circuit – Arithmetic Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits
• n-bit Parallel Adder/Subtractor
– a combinational logic circuit that add/subtract two n-bit binary
numbers and can be built by connecting nth full subtractor and
taking the XOR of subtrahend (B) and Ci (carry-in)

Figure 9. 4-bit Parallel Adder/Subtractor Circuit


 NOTE: Co0 = SUB / M
• Si/Di = ai  (bi  M)  Co(i-1)  M = 0 (Add)
• Coi = ai (bi  M) + Co(i-1) [ai  (bi  M)]  M = 1 (Subtract)
Design Applications of Combinational
Logic Circuit – Arithmetic Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits

Figure 10. 4-bit Parallel Adder/Subtractor Circuit using 7483 (4-bit


Parallel Adder IC)
Design Applications of Combinational Logic
Circuit – Arithmetic Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits
• Binary Coded Decimal (BCD) Adder
– combinational logic circuit used to perform the addition of BCD
numbers.
• BCD digit can have any of the ten possible four-bit binary
representations, that is, 0000, 0001, … , 1001, the equivalent of
decimal numbers 0, 1, … , 9.

Figure 11. Single-digit BCD adder.


Design Applications of Combinational Logic
Circuit – Arithmetic Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits
Table 1. Results in binary and the expected results in BCD using a four bit binary
adder to perform the addition of two BCD digits
Design Applications of Combinational Logic
Circuit – Arithmetic Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits

• Important notes about BCD adder design:


– 1st 7483 connections:
• A’s (A4 to A1) should be connected to BCD inputs (a4 to a1)
respectively
• B’s (B4 to B1) should be connected to BCD inputs (b4 to b1)
respectively
• CI/C0 (Carry-in) must be connected to Carry input (Cin)
• CO/C4 (K) should be part of the AND decoder circuits.
• Sum’s (S4 to S1) outputs are inputs of the second 7483 A’s
(A4 to A1) inputs.
Design Applications of Combinational Logic
Circuit – Arithmetic Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits

– 2nd 7483 connections:


• A’s (A4 to A1) should be connected to the sum
outputs of the 1st 7483(S4 to S1) respectively
• B4, B1, and C0/CI (Carry-in) must be connected to
Ground (0)
• B3 and B2 must be connected to the output of the
AND decoder
• CO/C4 (Carry-out) is no connection.
• Sum’s (S4 to S1) outputs are the BCD sums (S4 to
S1) outputs connected to LEDs
Design Applications of Combinational Logic
Circuit – Arithmetic Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits

Figure 12. Double-digit BCD adder (Note: To cascade the next BCD digit, the AND decoder
output will become the carry-input of next BCD adder)
Design Applications of Combinational
Logic Circuit – Arithmetic Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits

Figure 13. Block diagram of three-digit BCD adder.


Design Applications of Combinational Logic
Circuit – Arithmetic Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits

• Multiplier
– multiplication of binary numbers is usually
implemented in microprocessors and
microcomputers by using repeated addition
and shift operations.
• shift registers - for the multiplicand and multiplier
bits.
• accumulator register - for storing partial products.
• binary parallel adder – for finding sum of two
binary
• clock pulse generator - for time various operations
Design Applications of Combinational Logic
Circuit – Arithmetic Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits

Table 2. Truth table of 2-by-2 multiplier circuit


INPUTS (n) OUTPUTS (m)
DEC. 2-bit 2-bit PRODUCT
a1 a0 b1 b0 P3 P2 P1 P0
0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0
0
0 0 1 0 0 0 0 0
0 0 1 1 0 0 0 0
0 1 0 0 0 0 0 0
0 1 0 1 0 0 0 1
1
0 1 1 0 0 0 1 0
0 1 1 1 0 0 1 1
1 0 0 0 0 0 0 0
1 0 0 1 0 0 1 0
2
1 0 1 0 0 1 0 0
1 0 1 1 0 1 1 0
1 1 0 0 0 0 0 0
1 1 0 1 0 0 1 1
3
1 1 1 0 0 1 1 0
1 1 1 1 1 0 0 1
Design Applications of Combinational Logic
Circuit – Arithmetic Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits

Figure 14. Map Representation and simplification of a 2 x 2 Multiplier Circuit


Design Applications of Combinational Logic
Circuit – Arithmetic Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits

Figure 15. Logic diagram of 2-by-2 Multiplier Circuit


Design Applications of Combinational
Logic Circuit – Arithmetic Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits

• Some ICs used


for multiplier
circuit:
– 74261 (2 x 4
multiplier IC)
– 74284 & 74285
(4 x 4 multiplier
IC)
Figure 16. Block diagram of 4-by-4 multiplier
circuit using 74284 and 74285
VCC VCC VCC VCC

A4 A3 A2 A1

R2 R4 R6 R8 U1
5
6
A0 2^7 (MSB)
100 100 100 100 A1
7 LED-RED
A2
R1 R3 R5 R7 4
A3 D2
330 330 330 330 3 12
B0 Y4
2 11
B1 Y5
1 10
B2 Y6
15 9 LED-RED
B3 Y7
14 D3
E1
13
E2
74284 LED-RED
D4
U2
5 12 LED-RED
VCC VCC VCC VCC A0 Y0
6 11
A1 Y1
7 10
4
A2 Y2
9 D5
A3 Y3
3
B0
2
B1
1 LED-RED
B4 B3 B2 B1 15
B2
B3 D6
14
E1
R10 R12 R14 R16 13
E2
LED-RED
74285
100 100 100 100 D7
R9 R11 R13 R15
330 330 330 330
LED-RED

2^0 (LSB)
LED-RED

Figure 17. Schematic diagram of 4-by-4 multiplier circuit using 74284 and 74285
Design Applications of Combinational
Logic Circuit – Code Converter Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits

• Code Conversion
– circuits that are inserted between two systems if each
uses different codes for the same information.
– circuit that makes the two systems compatible even
though each uses different binary code.
– Some sample applications are:
• BCD to Excess - 3 code converter
• Binary Code to Gray Code Converter
• Binary Code to Octal Code Converter
• Gray Code to Binary Code Converter
• BCD to Biquinary Code Converter
• BCD to Seven-segment Display Decoder
Design Applications of Combinational
Logic Circuit – Code Converter Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits

• BCD to Excess-3 Code Converter


– a CLC that converts BCD code to excess-3 code.
Table 4. Truth Table of BCD to Excess-3 code converter
INPUTS (BCD) OUTPUTS (Excess-3)
d4 d3 d2 d1 E4 E3 E2 E1
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
Design Applications of Combinational
Logic Circuit – Code Converter Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits
• Binary Code (BC) to Gray Code (GC) converter cicruit
– a combinational logic circuit (CLC) that coverts n-bit binary code
to n-bit gray code.
– RECALL:

  

• BC = 1 0 1 12

• GC = 1 1 1 02
Design Applications of Combinational
Logic Circuit – Code Converter Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits

Table 4. Truth Table of 4-bit Binary code to Gray-code Converter


INPUTS (BC) OUTPUTS (Gray-code)

b3 b2 b1 b0 G3 G2 G1 G0

0 0 0 0 0 0 0 0

0 0 0 1 0 0 0 1

0 0 1 0 0 0 1 1

0 0 1 1 0 0 1 0

0 1 0 0 0 1 1 0

0 1 0 1 0 1 1 1

0 1 1 0 0 1 0 1

0 1 1 1 0 1 0 0

1 0 0 0 1 1 0 0

1 0 0 1 1 1 0 1
1 0 1 0 1 1 1 1

1 0 1 1 1 1 1 0
1 1 0 0 1 0 1 0

1 1 0 1 1 0 1 1

1 1 1 0 1 0 0 1

1 1 1 1 1 0 0 0
Design Applications of Combinational
Logic Circuit – Code Converter Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits

Binary Code to Gray-Code Code Converter

• General algorithm of n-bit BC to GC


• G(n-1) = b(n-1)
• G(n-2) = b(n-1)  b(n-2)
• G(n-3) = b(n-2)  b(n-3)
.
.
.
• G1 = b2  b1
• G0 = b1  b0
Design Applications of Combinational
Logic Circuit – Code Converter Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits

• Example. Design a 4-bit


binary code to gray code
converter circuit.
– n=4
• G3 = b3
• G2 = b3  b2
• G1 = b2  b1
• G0 = b1  b0
Design Applications of Combinational
Logic Circuit – Code Converter Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits
• Gary Code (GC) to Binary Code (BC) converter circuit
– a combinational logic circuit (CLC) that coverts n-bit gray code to
n-bit binary code.
– RECALL:

• GC = 1 1 1 02
  
• BC = 1 0 1 12
Design Applications of Combinational
Logic Circuit – Code Converter Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits

• General algorithm of n-bit GC to BC


• B(n-1) = g(n-1)
• B(n-2) = B(n-1)  g(n-2)
• B(n-3) = B(n-2)  g(n-3)
• B(n-4) = B(n-3)  g(n-4)
.
.
• B0 = B1 g0
Design Applications of Combinational
Logic Circuit – Code Converter Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits

• Gray Code (GC) to Table 6. Truth Table of 3-bit Gray code to


binary code converter
Binary Code (BC)
INPUTS (n) OUTPUTS (m)
Code
g2 g1 g0 B2 B1 B0
• Example. Design a 3-bit 0 0 0 0 0 0
GC to BC code 0 0 1 0 0 1
converter circuit 0 1 1 0 1 0
• Applying the
0 1 0 0 1 1
algorithm for n = 3:
1 1 0 1 0 0
1 1 1 1 0 1
• B 2 = g2
1 0 1 1 1 0
• B1 = B2  g1
1 0 0 1 1 1
• B0 = B1  g0
Design Applications of Combinational
Logic Circuit – Code Converter Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits
Design Applications of Combinational
Logic Circuit – Code Converter Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits
• BCD to Seven-Segment Display Decoder
Table 7. Truth Table of BCD to Seven-Segment
Display Code Converter (Common Cathode)
OUTPUTS (Seven-Segment
INPUTS (BCD)
DEC Display Code Converter) HEX

a b c d Fg Ff Fe Fd Fc Fb Fa

0 0 0 0 0 0 1 1 1 1 1 1 3F
1 0 0 0 1 0 0 0 0 1 1 0 06
2 0 0 1 0 1 0 1 1 0 1 1 5B
3 0 0 1 1 1 0 0 1 1 1 1 4F
4 0 1 0 0 1 1 0 0 1 1 0 66
5 0 1 0 1 1 1 0 1 1 0 1 6D
6 0 1 1 0 1 1 1 1 1 0 1 7D
7 0 1 1 1 0 0 0 0 1 1 1 07
8 1 0 0 0 1 1 1 1 1 1 1 7F
9 1 0 0 1 1 1 0 1 1 1 1 6F
Design Applications of Combinational
Logic Circuit – Code Converter Circuit
Combinational Logic Circuits Part 1 – Arithmetic and Code
Conversion Circuits

• Two important types of 7-segment LED


digital display.
– Common Cathode (CC) Display – all the
Cathode (-) connections of the LED’s are
joined together to logic “0” or ground. The
individual segments are illuminated by
application of a “HIGH” or “logic 1” signal to
the individual Anode (+) terminals
– Common Anode (CA) Display – all the
Anode (+) connections of the LED’s are joined
together to logic “1” and the individual
segments are illuminated by connecting the
individual Cathode (-) terminals to a “LOW” or
“logic 0” signal
Assignment No. 2 – Arithmetic & Code
Converter Circuits
(due date: 04 April 2018)

• Problem 1. Design a three-digit BCD


adder.
• Problem 2. Design a Octal to seven-
segment display (common anode) using
NOR gate only.
• Problem 3. Design a 8-bit GC to BC code
converter using 7486 only.

Das könnte Ihnen auch gefallen