Documente Academic
Documente Profesional
Documente Cultură
CS 202, Spring 2007 Epp, setions 1.4 and 1.5 Aaron Bloomfield
1
Or is a plus
0+0 = 0 0+1 = 1 1+0 = 1 1+1 = 1
And is multiplication
0*0 = 0 0*1 = 0 1*0 = 0 1*1 = 1
1
1 0 0
1
0 1 0
0
0 0 0
4
x y
x y
xy
x+y
x y z x y z
xyz
x+y+z
x y
x y x y
xy
x+y xy
5
x y y
Answer: (x+y)y
Or (xy)y
__
x+y (x+y)y y
x y
Answer: xy
___ __
xy
y
xy
Or (xy) xy
x y
x+y
x y
x+y
x+y
(x+y)x
x 1 1 0 0
y 1 0 1 0
xy 0 1 1 0
x y
x+y xy xy
(x+y)(xy)
10
211= 128 + 64 + 16 + 2 + 1
= 27 + 26 + 24 + 21 + 20 = 1*27 + 1*26 + 0*25 + 1*24 + 0*23 + 0*22 + 1*21 + 1*20 = 11010011 in binary
11
12
Carry is x AND y Sum is x XOR y The circuit to compute this is called a half-adder
x 0 0 1 1
y 0 1 0 1
Carry Sum 0 0 0 1 0 1 1 0
15
The half-adder
x y 0 1 0 1 Carry Sum 0 0 0 1 0 1 1 0
0 0 1 1
x y
x y
Sum Carry
Sum Carry
16
17
0 1 0 0 0 1 0 0 0
0 0 0
1 1 0
18
x y c s1 c1 carry sum
1 1 1 1 0 0 0 0
1 1 0 0 1 1 0 0
1 0 1 0 1 0 1 0
0 0 1 1 1 1 0 0
1 1 0 0 0 0 0 0
1 1 1 0 1 0 0 0
1 0 0 1 0 1 1 0
c x y
s1
X
HA
S S
s c
19
C C
HA
c1
x0 y0 x1 y1 x2 y2 x3 y3
HA
s0
C X Y C
FA
s1
C X Y C
FA
s2
C X Y C
FA
s3 c
21
...
To add n bit binary numbers, you need 1 HA and n-1 FAs To add 32 bit binary numbers, you need 1 HA and 31 FAs
Total of 4+9*31 = 283 logic gates
23
Flip-flops
Consider the following circuit:
24
Memory
A flip-flop holds a single bit of memory
The bit flip-flops between the two NAND gates
In reality, those transistors are split into 9 ICs of about 5 million transistors each
25
Hexadecimal
A numerical from 0-15 range
Where A is 10, B is 11, and F is 15
26
From ThinkGeek
(http://www.thinkgeek.com)
27
28
DEADBEEF
Many IBM machines would fill allocated (but uninitialized) memory with the hexadecimal pattern 0xDEADBEEF
Decimal -21524111 See http://www.jargon.net/jargonfile/d/DEADBEEF.html
29
30