Professional Documents
Culture Documents
www.idc.ac.il/tecs
Boolean Arithmetic
Usage and Copyright Notice:
Copyright 2005 Noam Nisan and Shimon Schocken
This presentation contains lecture materials that accompany the textbook The Elements of
Computing Systems by Noam Nisan & Shimon Schocken, MIT Press, 2005.
We provide both PPT and PDF versions.
The book web site, www.idc.ac.il/tecs , features 13 such presentations, one for each book
chapter. Each presentation is designed to support about 3 hours of classroom or self-study
instruction.
You are welcome to use or edit this presentation as you see fit for instructional and noncommercial purposes.
If you use our materials, we will appreciate it if you will include in them a reference to the books
web site.
If you have any questions or comments, you can reach us at tecs.ta@gmail.com
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.idc.ac.il/tecs , Chapter 2: Boolean Arithmetic
slide 1
Counting systems
quantity
decimal
binary
33-bit register
000
001
10
010
11
011
100
100
101
101
110
110
111
111
1000
overflow
1001
overflow
10
1010
overflow
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.idc.ac.il/tecs , Chapter 2: Boolean Arithmetic
slide 2
Rationale
(10011) two = 1 2 4 + 0 2 3 + 0 2 2 + 1 21 + 1 2 0 = 19
( xn xn1 ...x0 ) b = xi b
i =0
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.idc.ac.il/tecs , Chapter 2: Boolean Arithmetic
slide 3
Binary addition
0 0 0 1
1 0 0 1
0 1 0 1
1 1 1 1
1 0 1 1
0 1 1 1
0 1 1 1 0
1 0 0 1 0
no overflow
overflow
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.idc.ac.il/tecs , Chapter 2: Boolean Arithmetic
slide 4
0000
0001
1111
-1
0010
1110
-2
0011
1101
-3
0100
1100
-4
0101
1011
-5
0110
1010
-6
0111
1001
-7
1000
-8
Example:
2 - 5 = 2 + (-5) =
0010
+1011
1101
= -3
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.idc.ac.il/tecs , Chapter 2: Boolean Arithmetic
slide 5
16
a
16
1 6 -b it
ad d e r
16
o ut
Full adder:
Adder:
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.idc.ac.il/tecs , Chapter 2: Boolean Arithmetic
slide 6
carry sum
a
b
h alf
ad d er
s um
c arry
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.idc.ac.il/tecs , Chapter 2: Boolean Arithmetic
slide 7
a
s um
b
fu ll
ad d er
c arry
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.idc.ac.il/tecs , Chapter 2: Boolean Arithmetic
slide 8
n-bit Adder
16
1 6 -b it
ad d e r
16
16
o ut
...
out
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.idc.ac.il/tecs , Chapter 2: Boolean Arithmetic
slide 9
a
b
s um
h alf
ad d er
16
a
s um
fu ll
ad d e r
c arry
16
c arry
zx nx
zy
ny
no
16-bit
adder
16
out
x
16 bits
ALU
out
x, y, -x, -y,
16 bits
x!, y!,
16 bits
ng
x&y, x|y
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.idc.ac.il/tecs , Chapter 2: Boolean Arithmetic
slide 10
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.idc.ac.il/tecs , Chapter 2: Boolean Arithmetic
slide 11
c1,c2, ,c6
D register
A register
A
Mux
RAM
ALU
A/M
(selected
register)
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.idc.ac.il/tecs , Chapter 2: Boolean Arithmetic
slide 12
out
Perspective
Combinational logic
Our adder design is very basic: no parallelism
It pays to optimize adders
Our ALU is also very basic: no multiplication / division
Where is the seat of advanced math operations?
a typical hardware/software tradeoff.
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.idc.ac.il/tecs , Chapter 2: Boolean Arithmetic
slide 13
Leibnizs medallion
for the Duke of Brunswick
slide 14