Digital Electronics - Part II

advertisement
Digital Electronics and Computer
Interfacing
Tim Mewes
3. Digital Electronics
3.5 Adder
• An adder is a device that will calculate the
sum of two numbers
• In digital electronics an adder needs to be able
to add two binary numbers
• Idea: create an adder for one bit numbers –
numbers with more bits can then be added by
chaining multiple adders together
Digital Electronics and Computer Interfacing
2
3.5.1 Half Adder
• Two input bits A and B and two outputs:
the sum S and the carry output Co
• Truth table
S  AB
C0  A  B
Problem: how to use the carry output for the next bit?!
Digital Electronics and Computer Interfacing
3
3.5.2 Full Adder
• Takes three input bits A, B and the input carry Ci
• Has again two outputs the sum S and the carry output Co
• Truth table
S  ( A  B)  Ci
C0  ( A  B)  (Ci  ( A  B))
How to add two n-bit numbers?!
Digital Electronics and Computer Interfacing
4
3.5.3 Ripple carry adder
• Chain multiple 1 bit full adders – each carry bit
ripples to the next full adder
A (bit n) B (bit n)
Co
A (bit 1) B (bit 1)
Ci
1 bit
full adder
S (bit n)
…
Co
Ci
A (bit 0) B (bit 0)
Co
1 bit
full adder
S (bit 1)
Ci
0
1 bit
full adder
S (bit 0)
If the most significant bit produces a carry output an overflow has occurred
Digital Electronics and Computer Interfacing
5
3.6.1 Digital 2 Channel Multiplexer
• Multiplexer outputs one of its inputs A or B
depending on a third input S
A
Q
B
S
• S=0 selects A
• S=1 selects B
Q  ( A  S)  (B  S)
Digital Electronics and Computer Interfacing
6
3.6 Multiplexer
• A multiplexer combines multiple inputs into one
single output
• What is it good for?
• Transmit multiple data streams over one
physical link
• Practical example: telephone
Synchronized switches
Digital Electronics and Computer Interfacing
7
3.6.2 Digital 2n channel multiplexer
• 2n-Channel multiplexer outputs one of its 2n inputs
(I0- I2n-1) depending on the n inputs (S0-Sn-1)
I0
I1
Q
.
.
.
I2n-1
…
S1
S0
Sn-1
Digital Electronics and Computer Interfacing
8
3.6.2 Digital 2n channel multiplexer
• Example n=2  2n=4 Channel multiplexer
X: Don’t care
Digital Electronics and Computer Interfacing
9
3.6.2 Digital 2n channel multiplexer
• A 2n channel multiplexer is more:
You can create any logic function with n inputs!!
S1
0
0
1
1
S0
0
1
0
1
I3
I2
I1
I0
Q
Put your own example here
Digital Electronics and Computer Interfacing
10
3.6.2 Digital 2n channel multiplexer
• A 2n channel multiplexer is more:
You can create any logic function with n inputs!!
Example 1: AND
Q  S0  S1
I0
I1
Q
I2
I3
3V
S1
S0
Digital Electronics and Computer Interfacing
11
3.6.2 Digital 2n channel multiplexer
Example 2: XOR
Q  S0  S1
I0
I1
Q
I2
I3
3V
S1
S0
Digital Electronics and Computer Interfacing
12
Precaution: turn fully counter clockwise!
Vcc=5 V
GND
7486
horizontal
lines are
connected
8 Boolean
indicators
74151
Leave in
+5 position
8 Boolean
controls
Digital Electronics and Computer Interfacing
13
Download