Professional Documents
Culture Documents
Capter 6
Capter 6
CHAPTER 6 :
FUNCTIONS OF
COMBINATIONAL LOGIC
Chapter 6 :
2
FUNCTIONS OF COMBINATIONAL LOGIC
Example :
1 111 1 1
01 (1) 1001 (9) 11001
(25)
+ 11 (3) + 1111 (15) +
11001 (25)
100 (4) 11000 (24)
110010 (50)
2) Binary Subtraction (-)
5 The four basic rules for subtracting binary digits
(bits) are as follows :
0-0=0
1-1=0
1-0=1
10 - 1 = 1 -> 0-1 with a borrow of 1
Example :
Example :
a) 110 / 11 b) 110 / 10
10 2 11 3
11 110 3 6 10 110 2 6
11 6 10 6
000 0 10 0
00
2.6 Signed Number
8
= 11100110
2.6 Signed Number
11
c) 2’s Complement form
Positive number in 2’s Complement = positive
sign-magnitude numbers.
Example :
+25 = 00011001 positive sign magnitude
+25 = 00011001 positive in 2’s Complement
But negative number = 2’s complement of the
corresponding positive number
Example :
-25 is expressed as the 2’s complement of
+25 (00011001)
= 1’s Complement + 1 = 11100110 + 1
= 11100111
2.7 Arithmetic Operation with
Signed Numbers
12
a) Addition
Discard carry
2.7Arithmetic Operation
13 with
Signed
Addition (cont..)Numbers
Discard carry
2.7 Arithmetic Operation with
Signed Numbers
14
Subtraction
Discard carry
2.7 Arithmetic Operation with
Signed Numbers
15
Multiplication
The numbers in multiplication are the multiplicand and multiplier
Example : 8 (Multiplicand)
X 3 (Multiplier)
24 (Product)
Multiplication
A) Direct Addition
Example : 0100 1101 (multiplicand) and 0000 0100 (multiplier)
Since both numbers are positive, the product will be positive.
Multiplication
B) Partial Product
Example :
0101 0011 (multiplicand, 83) and 1100 0101 (multiplier, 59)
1010011 (multiplicand)
18
X 0111011 (multiplier)
1010011 1st partial product
+ 1010011 2nd partial product
11111001 Sum 1st and 2nd
+ 0000000 3rd partial product
011111001 Sum
+ 1010011 4th partial product
1110010001 Sum
+ 1010011 5th partial product
10001100001 Sum
+ 1010011 6th partial product
100110010001 Sum
+ 0000000 7th partial product
1001100100001 Final product
Partial Product
Step 5 : Since the sign of product is 1 as determined in step 1,
take the 2’s complement of the product.
19
b) Division
dividend = quotient
divisor
Cout = AB
Output carry is 1 only when A and B are 1s.
S=A+B
Sum output is a 1, if A and B are not equal.
23
a) Half Adder
Half adder Truth Table
A B Cout Σ
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
= A + B = AB + AB
A
B . . Cout = AB
24
b) Full Adder
Accepts two input bits and an input carry and generates
a sum output and an output carry.
Σ
A Σ Sum
Full adder
Β Logic
Cout Output Carry
Input Carry Cin
Symbol
A B Cin Cout
.
0 0 0 0 0
0 0 1 0 1
Full adder
0 1 0 0 1
Truth Table
0 1 1 1 0
1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1
25
b) Full Adder : Example
26 Full adder Logic Diagram
A A+B
B
Cin = (A + B) + Cout
Cout = AB + (A + B) Cin
b) Full Adder : Exercise
For each of the three full adders, determine
the outputs for the inputs shown :
Σ
1 A Σ Sum
0 Β
Cout Output Carry Σ
0 Cin 1 A Σ Sum
0 Β
Cout Output Carry
Cin
1
Σ
1 A Σ Sum
1 Β
Cout Output Carry
Cin
0
27
6.2Parallel Binary Adder
Two or more full adders are connected to
28
11
+ 01
100
In this case, the
carry bit from 2nd
column becomes a
sum bit
Parallel Adder : Example
29
Parallel Adder : Exercise
30 Determine the sum generated by the 3-bit
parallel adder below and show the
intermediate carries when the binary numbers
101 and 011 are being added.
Figure 6.9 A 4-bit parallel adder
31
6.4Comparators
Compares two n-bit binary values to determine
which one is larger.
Inputs : 2 single-bit inputs (X and Y).
Outputs : 3 lines: X>Y, X=Y, X<Y.
32
Figure 6.19 Basic comparator operation. Equality
33
Figure 6.20 Logic diagram for equality comparison of two 2-bit
numbers.
34
Example
35
Figure 6.23 Logic symbol for a 4-bit comparator with inequality
indication.
Perduaan BCD
A Y0
B Penyahkod Y1
C Y2
D Y3
PerduaankeBCD
Types of Decoder
39
1) Binary decoder
2) 3-Bits decoder (1 from 8) = 3-line to 8-line
3) 4-Bit decoder (1 from 16) = 4-line to 16-line
4) Binary to BCD decoder
5) BCD to Decimal decoder
6) BCD to 7-segments
1) Binary decoder
40
1 A0 (LSB)
1 A1
0 A1
1 X=A3A2A1A0
0
1 A2
1 A2
A3 (LSB)
Decoding logic for the binary code 1001 with an active-HIGH output
The output is 1 if only when A0=1, A1=0, A2=0, A3=1 are applied to the
inputs.
2) 3-Bits decoder A B C
41
Q0
A B C Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7
0 0 0 1 0 0 0 0 0 0 0
0 0 1 0 1 0 0 0 0 0 0 Q1
0 1 0 0 0 1 0 0 0 0 0
0 1 1 0 0 0 1 0 0 0 0 Q2
1 0 0 0 0 0 0 1 0 0 0
1 0 1 0 0 0 0 0 1 0 0 Q3
1 1 0 0 0 0 0 0 0 1 0
1 1 1 0 0 0 0 0 0 0 1
Q4
Truth Table for 3 bits decoder
Q5
with active-HIGH
Q6
Q7
3) 4-Bits decoder
42
CLASS …
Please construct a truth table for
this type of decoder
SHOW ME !!!
Figure 6-31 A simplified computer I/O port system with a port address
decoder with
only four address lines shown.
43
4) Binary to BCD decoder
A B C D Y4 Y3 Y2 Y1 Y0 Penyahkod jenis ini mengambil nilai-
44 nilai atau nombor-nombor perduaan
0 0 0 0 0 0 0 0 0
dan menukarnya kepada kod-kod BCD
0 0 0 1 0 0 0 0 1
A B C D
0 0 1 0 0 0 0 1 0
0 0 1 1 0 0 0 1 1
0 1 0 0 0 0 1 0 0
0 1 0 1 0 0 1 0 1 Y4
0 1 1 0 0 0 1 1 0
0 1 1 1 0 0 1 1 1 Y3
1 0 0 0 0 1 0 0 0
Y2
1 0 0 1 0 1 0 0 1
Y1
1 0 1 0 1 0 0 0 0
1 0 1 1 1 0 0 0 0
Y0
1 1 0 0 1 0 0 0 0
1 1 0 1 1 0 0 0 0
1 1 1 0 1 0 0 0 0
1 1 1 1 1 0 0 0 0
Review ..Binary Coded
Decimal (BCD)
BCD is a way to express each of the
0000 0001 0010 0011 0100 0101 0110 0111 1000 1001
45
5) BCD to Decimal decoder
Decima A3 A2 A1 A0 Decoding
46l digit Function
0 0 0 0 0 A3 A2 A1 A0
1 0 0 0 1 A3 A2 A1 A0
2 0 0 1 0 A3 A2 A1 A0
3 0 0 1 1 A3 A2 A1 A0
4 0 1 0 0 A3 A2 A1 A0
5 0 1 0 1 A3 A2 A1 A0
6 0 1 1 0 A3 A2 A1 A0
7 0 1 1 1 A3 A2 A1 A0
8 1 0 0 0 A3 A2 A1 A0
9 1 0 0 1 A3 A2 A1 A0
Figure 6.33 : BCD to Decimal decoder example
47
6) Binary to 7-segments
decoder
48
The function of a BCD to 7-segment decoder is to
convert the logic states at the outputs of a BCD counter
which will drive a 7-segment display.
The display shows the decimal numbers 0-9 and is
easily understood.
The individual segments making up a 7-segment display
are identified by letters as follows:
6) Binary to 7-segments
decoder
49
BCD inputs segment outputs
display
D C B A a b c d e f g
0 0 0 0 1 1 1 1 1 1 0
0 0 0 1 0 1 1 0 0 0 0
0 0 1 0 1 1 0 1 1 0 1
0 0 1 1 1 1 1 1 0 0 1
0 1 0 0 0 1 1 0 0 1 1
0 1 0 1 1 0 1 1 0 1 1
0 1 1 0 1 0 1 1 1 1 1
0 1 1 1 1 1 1 0 0 0 0
1 0 0 0 1 1 1 1 1 1 1
1 0 0 1 1 1 1 1 0 1 1
6.6Encoders
Encoder does the opposite from decoder
50
Decimal-to-BCD encoder
51
Please Identify :
S0 A0 = ?,
S1
A1 = ?,
AA0
S2
S3
Pengekod BA1 A2 = ?,
S4 CA2
S5 (Encoder)
DA A3 = ?
3
S6 (Kod BCD)
S7
S8 Logic symbols for a
S9
decimal to BCD encoder.
52
Figure 6.38 Basic logic diagram of a decimal-to-BCD encoder. A 0-digit input is not
needed because the BCD outputs are all LOW when there are no HIGH inputs.
53
www.allaboutcircuits.com/vol_4/chpt_9/index.html
www.opamp-electronics.com/tutorials/digital_theory_ch_009.htm
55
END OF CHAPTER 6