Engs 31 / CoSc 56
DIGITAL ELECTRONICS
Day 2
Today: Tomorrow:
Logic functions (§2.4-2.6, App A) Basic electronics, logic circuits
(§§2.1-2.3)
2.1
Housekeeping
1) Lab Signups (Due Tomorrow at 12:30 pm)
2) Formatting Homework
3) Office Hours (starting today in Maclean 301)
1) Tuesday 2-4
2) Wednesday 2-3
3) Thursday 2-4 (1-3?)
4) Electronics Lab Crash Course
1) This Thursday 10-2 (stop by any time in that span) in the digital
lab
2.2
Review: What is a digital system?
Quantities represented as binary integers (strings of 1s and 0s).
1s and 0s are represented physically by high and low voltages, mathematically
by logical TRUE and FALSE
All math functions (arithmetic) and control functions (turning things on and off)
are implemented by logical operations on 1s and 0s.
Logical
Inputs Outputs
manipulation of
…
…
(data & control bits) (data & control bits)
1s and 0s
2.3
Digital representations: binary numbers
Decimal integers — based on powers of ten
20310 = 2 102 + 0 101 + 3 100
Binary integers — based on powers of two
20310 =128 + 64 + 8 + 2 + 1
= 1 27 + 1 26 + 0 25 + 0 24
+ 1 23 + 0 22 + 1 21 + 1 20
= 1 1 0 0 1 0 1 12
“bit” = “binary digit”
2.5
Why binary? Why bits?
We can manipulate bits with logic: 0=FALSE, 1=TRUE
There are convenient physical representations for TRUE and
FALSE
Electronic: LOW and HIGH voltages
Switches: OFF and ON
Polarization (optics, magnetics): UP/DOWN, CW/CCW
Electron spin (quantum computing): UP/DOWN
We can design circuits to manipulate bits
Logical
Inputs manipulation Outputs
…
…
(data & control bits) of 1s and 0s (data & control bits)
2.6
Counting with binary numbers
0 0 31 11111 5-bit (25-1)
1-bit
1 1 63 111111 6-bit (26-1)
2 10 127 11111117-bit (27-1)
3 11
2-bit
255 111111118 bit (28-1)
4 100
5 101
6 110 3-bit
7 111
8 1000
9 1001
10 1010
11 1011 4-bit
12 1100
13 1101
14 1110
15 1111
2.7
Know your powers of 2
20 1 211 = 2 210 2048 (2K)
21 2 212 = 4 210 4096 (4K)
22 4 213 = 8 210 8192 (8K)
23 8 214 = 16 210 16384 (16K)
24 16 …
25 32 220 = 1024 210 1M
26 64 (mega)
27 128 …
28 256 230 = 1024 220 1G
29 512 (giga)
210 1024 (1K, kilo) …
240 = 1024 230 1T (tera)
2.8
Example
How do you represent 14710 in 8-bit binary? What about 9-bit binary?
a) 1 1 0 0 1 0 0 1
b) 1 0 0 1 0 0 1 1
c) 0 1 0 0 1 0 0 1
d) 1 0 0 1 1 0 1 1
Solution:
2.9
Other digital codes
Decimal integers — based on powers of ten
20310 = 2 x 102 + 0 x 101 + 3 x 100
Binary coded decimal (BCD) — each decimal digit is represented by a binary
integer, 0000 through 1001.
20310 = 0010 0000 0011
Octal — based on powers of 8, uses digits 0-7; rarely seen anymore
Hexadecimal (hex) — based on powers of sixteen; uses digits 0-9 and letters
A-F (A=10 … F=15)
20310 = 12 x 16 + 11 x 1
= C x 161 + B x 160
= CB16
Signed integers, fractions, text — later
2.10
Examples
How do you represent 14710 in BCD? Hex?
Solution:
Convert 0xC9 to Binary, Hex, and BCD.
Solution:
Why is BCD not very common? 2.11
Logic: how we represent and manipulate bits
A logical statement “A” is either TRUE or FALSE.
The complement (NOT) of a TRUE statement is FALSE, and v.v.
Notation: A’, /A, A, A
Combinations of logical statements
AND — “A AND B” is true if A and B are individually true
Notation: A•B, AB, AB
OR — “A OR B” is true if either A or B is true (both may be true).
Notation: A+B, AB
2.12
Truth tables
One way of representing logical operations.
AND
OR NOT
2.13
Truth tables (2)
A more complex logical expression: “X is true if A is different than B.”
Using True = 1, False = 0
A B X A B X
F F F 0 0 0
F T T 0 1 1
T F T 1 0 1
T T F 1 1 0
Symbolic representation: X = (A • B’) + (A’ • B)
This is called exclusive-OR, or XOR, X = A B
2.14
Logic symbols
W
AND Y=W•X
X
Interconnect with
W wires to make more
OR Y=W+X complex logical
X
statements: “logic
diagram”
NOT W Y=W’
W Y=W X
XOR
X
2.15
Let’s design something: one-bit “half adder”
Add two one-bit numbers
A B S1 S0
0 0
0 1
1 0
1 1
Logic equations (0 = false, 1 = true)
S0 =
S1 =
2.16
Half adder logic diagram
Wires carry logical values (0, 1) or voltages (low, high).
AB’
A’B
2.17
Boolean algebra (1854)
Axioms look a lot like ordinary algebra.
Operations with 1 and 0
A•1 = A, A+1 = 1; A•0 = 0, A+0 = A
Idempotency
A•A = A, A+A = A George Boole
(1815-1864)
Double negation
(A’)’ = A
Complement
A•A’ = 0, A+A’ = 1
Commutative
A•B = B•A, A+B = B+A
Associative
(A•B)•C = A•(B•C), (A+B)+C = A+(B+C)
Distributive
A•(B+C) = A•B + A•C, A+(B•C) = (A+B) • (A+C)
2.19
Duality
If you swap 0 and 1, • and + in a Boolean expression, you get another valid
Boolean expression (though it is not an equivalent expression).
Each Boolean axiom has two dual forms, e.g.,
Identity
A•1 = A A+0 = A
Complement
A•A’ = 0 A+A’ = 1
Commutative
A•B = B•A A+B = B+A
Associative
(A•B)•C = A•(B•C) (A+B)+C = A+(B+C)
Distributive
A•(B+C) = A•B + A•C A+(B•C) = (A+B) • (A+C)
2.20
DeMorgan’s laws
Y = AB: Both A and B must be true to make Y true.
Either A or B can be false to make Y false: ( AB )’ = A’ + B’
Augustus DeMorgan
(1806-1871)
Y = A+B: Either A or B true will make Y true.
Both A and B must be false to make Y false: ( A + B )’ = A’
B’
Generalizes to multiple variables.
( X1 X2 … Xn )’ = X1’ + X2’ + … + Xn’
( X1 + X2 + … + Xn )’ = X1’ X2’ … Xn’ 2.21