Rangkain Kombinasional (Rangkaian Aritmatika)
Rangkain Kombinasional (Rangkaian Aritmatika)
Rangkaian
Kombinasional
(Rangkaian Aritmatika)
2
Unsigned Addition
cont’d…
X = x4x3x2x1x0 0 1 1 1 1 (15)10
+ Y = y 4y3y2y1y0 01010
(10)10 Generated carries
1 1 10 (c3c2c1c0)
S = s 4 s3 s2 s1 s0 1 1 0 0 1 (25)10
1 1 1 1
4
Ripple-Carry Adder
• Naïve implementation of addition us-
ingx full
y
adders. x y x y
n –1 n– 1 1 1 0 0
c1
cn FA cn - 1 c2 FA FA c0
sn – 1 s1 s0
MSB position LSB position
5
2’s complement
Adder/Subtractor yn – 1 y1 y0
Add /Sub
control
xn – 1 x1 x0
cn n-bit adder c0
sn – 1 s1 s0
6
Multiplexers
• Chooses ONE input based upon select signal.
s
w1 s f
0
1 f 0 w1
w2 1 w2
(a) Graphical symbol (b) Truth table
w1
s f
w2
f
s1 s0 f
w2
0 0 w0
0 1 w1
1 0 w2
1 1 w3 w3
8
Implementation
s1
s0
w0 0
w1 1
0
f
1
w2 0
w3 1
9
Synthesis of Logic Functions with Multiplexers
w2
f
(c) Circuit
10
Example: Majority
Function
w1 w2 w3 f
w1 w2 f
0 0 0 0
0 0 0
0 0 1 0 w3
0 1 w2
0 1 0 0 w3 w1
1 0
0 1 1 1 1 1 1
1 0 0 0 0
w3
1 0 1 1 (a) Modified truth f
1 1 0 1 table 1
1 1 1 1 (b) Circuit
11
Example: 3-input XOR
function
w1 w2 w3 f
0 0 0 0
w3
0 0 1 1 w2
0 1 0 1 w1
w3
0 1 1 0 w3
1 0 0 1 f
w3
1 0 1 0
1 1 0 0
w3
1 1 1 1
12
Decoders
• n bits => 2n possible combinations of 1’s
and 0’s
• Decoder : asserts ONE out of 2n output
signals to indicate which combination of
1’s and 0’s is on the input (output is “one
hot encoded”)
w0 y0
n
inputs 2n
wn – 1 outputs
y2n – 1
Enable En
An n-to-2n binary decoder (B&V: Figure 6.15)
13
Decoder Implementation
w0
y0
w1
En w1 w0 y0 y1 y2 y3
1 0 0 1 0 0 0 y1
1 0 1 0 1 0 0
1 1 0 0 0 1 0
1 1 1 0 0 0 1
0 x x 0 0 0 0 y2
y3
En
w0 y0 y4
w1 y1 y5
y2 y6
w2 w0 y0 y3 y7
En
w3 w1 y1
y2
En En y3 w0 y0 y8
w1 y1 y9
y2 y10
En y3 y11
w0 y0 y12
w1 y1 y13
y2 y14
En y3 y15
15
What are they good for?
Example:
m-to-2m decoder
Sel0
0/1 0/1 0/1
Sel1
Memory a0 Sel2
0/1 0/1 0/1
Address a1
am – 1
Sel2m – 1
0/1 0/1 0/1
Read
Data dn – 1 dn – 2 d0
16
Demultiplexer
• Inverse operation of a Multiplexer: Take 1 input, and
output it to one of m=2n outputs.
• Can implement using a Decoder
w0 y0
n-bit
selec 2n
t wn – 1 outputs
x y2n – 1
En
ys = x
(where s = wn-1wn-2…w0 in binary)
17
Encoders
• Performs the opposite operation of a decoder (!)
• Input = “one hot encoding”
• Output = binary representation of the “index” of the
wire that is “hot” (equal to 1)
w0
y0
2n n
inputs outputs
yn – 1
w2n – 1
18
Encoder Implementation
w0
w3 w2 w1 w0 y1 y0
w1
0 0 0 1 0 0 y0
0 0 1 0 0 1
w2
0 1 0 0 1 0
1 0 0 0 1 1 y1
w3
19
BCD To 7-Segment
w3 w2 w1 w0 a b c d e f g
a a 0 0 0 0 1 1 1 1 1 1 0
0 0 0 1 0 1 1 0 0 0 0
w0 b
c f b 0 0 1 0 1 1 0 1 1 0 1
w1 0 0 1 1 1 1 1 1 0 0 1
w2 d g
e e c 0 1 0 0 0 1 1 0 0 1 1
w3 0 1 0 1 1 0 1 1 0 1 1
f
g d 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
(a) Code converter (b) 7-segment display 1 0 0 1 1 1 1 1 0 1 1
20