Académique Documents
Professionnel Documents
Culture Documents
Culminating lecture.
George Boole (1815 – 1864) Claude Shannon (1916 – 2001) ! Putting it all together and building a TOY machine.
Basic abstractions. 1 1
! On, off.
! Switch that can turn something on or off. 1
1
Digital circuits and you.
! Computer microprocessors. Input Output
! Antilock brakes.
! Cell phones.
3 4
Logic Gates Multiway AND Gates
Logical gates. AND(x0, x1, x2, x3, x4, x5, x6, x7).
! Fundamental building blocks. !1 if all inputs are 1.
!0 otherwise.
x x' x x
xy x+y
y y
0 0
0 0
0 0
0 0
0 1 0 1
1 1
1 1
1 0 0 1
0 0
1 1
1 1
1 1
NOT AND OR
5 6
Basics.
! Boolean variable: value is 0 or 1.
! Boolean function: function whose inputs and outputs are 0, 1.
Relationship to circuits.
! Boolean variables: signals.
! Boolean functions: circuits.
7 8
Truth Table Truth Table for Functions of 2 Variables
Truth table. Any Boolean function can be expressed using AND, OR, NOT.
! 16 Boolean functions of 2 variables. !"Universal."
– every 4-bit value represents one !XOR(x,y) = xy' + x'y
! 256 Boolean functions of 3 variables.
– every 8-bit value represents one
Expressing XOR Using AND, OR, NOT
2^(2^N) Boolean functions of N variables!
x y x' y' x'y xy' x'y + xy' XOR
!
0 0 1 1 0 0 0 0
Some Functions of 3 Variables 0 1 1 0 1 0 1 1
x y z AND OR MAJ ODD 1 0 0 1 0 1 1 1
0 0 0 0 0 0 0 1 1 0 0 0 0 0 0
0 0 1 0 1 0 1
0 1 0 0 1 0 1 Notation Meaning
x' NOT x
0 1 1 0 1 1 0
xy x AND y
1 0 0 0 1 0 1
x+y x OR y
1 0 1 0 1 1 0
1 1 0 0 1 1 0
Exercise: {AND, NOT}, {OR, NOT}, {NAND}, {AND, XOR} are universal.
1 1 1 1 1 1 1
11 12
Sum-of-Products Translate Boolean Formula to Boolean Circuit
Any Boolean function can be expressed using AND, OR, NOT. Use sum-of-products form.
!Sum-of-products is systematic procedure. ! XOR(x, y) = xy' + x'y.
– form AND term for each 1 in truth table of Boolean function
– OR terms together
13 14
Use sum-of-products form. Many possible circuits for each Boolean function.
! MAJ(x, y, z) = x'yz + xy'z + xyz' + xyz. !Sum-of-products not necessarily optimal in:
– number of gates (space)
– depth of circuit (time)
Instructions. x y z ODD x'y'z x'yz' xy'z' xyz x'y'z + x'yz' + xy'z' + xyz
0 0 0 0 0 0 0 0 0
! Step 1: represent input and output signals with Boolean variables.
0 0 1 1 1 0 0 0 1
Step 2: construct truth table to carry out computation.
0 1 0 1 0 1 0 0 1
!
17 18
Step 1.
! Represent input and output in binary.
1 1 0 0
x3 0 0 1 0
x2 + 0 1 1 1
x1
1 0 0 1
x0 z3
+ z2
z1
x3 x2 x1 x0
z0
y3
+ y3 y2 y1 y0
y2
y1
c0 z3 z2 z1 z0
y0
19 20
Let's Make an Adder Circuit Let's Make an Adder Circuit
c0 c3 c2 c1 c0 = 0
Goal: x + y = z for 4-bit integers. Goal: x + y = z for 4-bit integers.
x3 x2 x1 x0 x3 x2 x1 x0
Step 2. (first attempt) + y3 y2 y1 y0 Step 2. (do one bit at a time) + y3 y2 y1 y0
Build truth table. Build truth table for carry bit.
z3 z2 z1 z0 z3 z2 z1 z0
! !
! Why is this a bad idea? ! Build truth table for summand bit.
– 128-bit adder: 2256+1 rows > # electrons in universe!
c3 c2 c1 c0 = 0
Goal: x + y = z for 4-bit integers. Goal: x + y = z for 4-bit integers.
x3 x2 x1 x0
Step 3. + y3 y2 y1 y0 Step 4.
Derive (simplified) Boolean expression. Transform Boolean expression into circuit.
z3 z2 z1 z0
! !
23 24
Let's Make an Adder Circuit Subtractor
- y3 z0
x-y
y2
r ry
y1 ca
y y0
1
ALU Interface. 16
!Add, subtract, bitwise and, bitwise xor, shift left, shift right, copy. Input 1
000
16 +
!Associate 3-bit integer with 5 primary ALU operations. Input 2
– ALU performs operations in parallel ~ carry in
– control wires select which result ALU outputs
& 001
16 16
Input 1
op 2 1 0 MUX
+, - 0 0 0
ALU 16
^
^
010
& 0 0 1
^ 0 1 0
<<, >> 0 1 1 << 011
input 2 1 0 0 16 >>
Input 2 3 op 2 1 0
+, - 0 0 0 100
ALU & 0 0 1
3
select ^ 0 1 0
shift subtract <<, >> 0 1 1
subtract shift direction ALU control
direction 27
input 2 1 0 0
28
Summary
29