logic and computers
DESCRIPTION
Logic and computers. Binary Arithmetic. Only two digits: the bits 0 and 1. (Think: 0 = F, 1 = T). 0 +1 ---- 1. 1 +0 ---- 1. 1 +1 ---- 10. 0 +0 ---- 0. Logic and Computers. A half adder: Two bits in (A, B: to be added together) Two bits out (S, C: sum and carry) - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Logic and computers](https://reader036.vdocuments.us/reader036/viewer/2022081511/568145aa550346895db2a149/html5/thumbnails/1.jpg)
Logic and computers
2/6/12
![Page 2: Logic and computers](https://reader036.vdocuments.us/reader036/viewer/2022081511/568145aa550346895db2a149/html5/thumbnails/2.jpg)
Binary Arithmetic
0+0----
0
2/6/12
0+1----
1
1+0----
1
1+1---- 10
Only two digits: the bits 0 and 1
(Think: 0 = F, 1 = T)
![Page 3: Logic and computers](https://reader036.vdocuments.us/reader036/viewer/2022081511/568145aa550346895db2a149/html5/thumbnails/3.jpg)
Logic and Computers
A half adder:Two bits in (A, B: to be added together)Two bits out (S, C: sum and carry)0+0=0, carry 00+1=1, carry 01+0=1, carry 01+1=0, carry 1
S := A⊕B C := A∧B
2/6/12
![Page 4: Logic and computers](https://reader036.vdocuments.us/reader036/viewer/2022081511/568145aa550346895db2a149/html5/thumbnails/4.jpg)
NOT
OR NOR
AND NAND
XOR NXOR (EQUIV)
2/6/12
![Page 5: Logic and computers](https://reader036.vdocuments.us/reader036/viewer/2022081511/568145aa550346895db2a149/html5/thumbnails/5.jpg)
Logic and Computers
• S := A⊕B
• C := A∧B
2/6/12
AS
B
C
![Page 6: Logic and computers](https://reader036.vdocuments.us/reader036/viewer/2022081511/568145aa550346895db2a149/html5/thumbnails/6.jpg)
Half Adder
2/6/12
A S
B C
HA
AS
B
C
![Page 7: Logic and computers](https://reader036.vdocuments.us/reader036/viewer/2022081511/568145aa550346895db2a149/html5/thumbnails/7.jpg)
A Longer Addition
11
+11
2/6/12
1
0
1
11
![Page 8: Logic and computers](https://reader036.vdocuments.us/reader036/viewer/2022081511/568145aa550346895db2a149/html5/thumbnails/8.jpg)
Full Adder
• Need a third input to create a component of a ripple-carry adder: the carry from the previous bit position
• Inputs: A, B, Cin
• Outputs: S, Cout
2/6/12
A B Cin S Cout
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
![Page 9: Logic and computers](https://reader036.vdocuments.us/reader036/viewer/2022081511/568145aa550346895db2a149/html5/thumbnails/9.jpg)
Full Adder
2/6/12
A B Cin S Cout
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1A
B
Cin S
CoutHA
HA
![Page 10: Logic and computers](https://reader036.vdocuments.us/reader036/viewer/2022081511/568145aa550346895db2a149/html5/thumbnails/10.jpg)
Full Adder
2/6/12
Cin
S A
B Cout
FA
A
B
Cin S
CoutHA
HA
![Page 11: Logic and computers](https://reader036.vdocuments.us/reader036/viewer/2022081511/568145aa550346895db2a149/html5/thumbnails/11.jpg)
Ripple carry adder
• 2-bit adder: a1a2+b1b2 = c1c2 with carryout
• Generalizes to n-bit addition• How does the time delay through the circuit
depend on n, the number of bits to be added?
2/6/12
0a2
b2
a1
b1
c2
c1
carryout
FA FA
![Page 12: Logic and computers](https://reader036.vdocuments.us/reader036/viewer/2022081511/568145aa550346895db2a149/html5/thumbnails/12.jpg)
Simplifying Circuits
• Simpler formulas turn into circuits that use less hardware!
• E.g. p ⋁ q ⋁ (p⋀q) is equivalent to p ⋁ q but would use more logic gates
• But the P=NP? question means that it may be hard to simplify formulas as much as possible– Any tautology is equivalent to p ⋁ ¬p so if
we could easily simplify formulas we could easily determine whether a formula is a tautology
2/6/12