Presentation is loading. Please wait.

Presentation is loading. Please wait.

Logic and computers 2/6/12. Binary Arithmetic 0 +0+0 ---- 0 2/6/12 0 +1 ---- 1 +0 ---- 1 +1 ---- 10 Only two digits: the bits 0 and 1 (Think: 0 = F, 1.

Similar presentations


Presentation on theme: "Logic and computers 2/6/12. Binary Arithmetic 0 +0+0 ---- 0 2/6/12 0 +1 ---- 1 +0 ---- 1 +1 ---- 10 Only two digits: the bits 0 and 1 (Think: 0 = F, 1."— Presentation transcript:

1 Logic and computers 2/6/12

2 Binary Arithmetic 0 +0+0 ---- 0 2/6/12 0 +1 ---- 1 +0 ---- 1 +1 ---- 10 Only two digits: the bits 0 and 1 (Think: 0 = F, 1 = T)

3 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 0  0+1=1, carry 0  1+0=1, carry 0  1+1=0, carry 1  S := A ⊕ B  C := A ∧ B 2/6/12

4 NOT OR NOR ANDNAND XORNXOR (EQUIV) 2/6/12

5 Logic and Computers S := A ⊕ B C := A ∧ B 2/6/12 ASBCASBC

6 Half Adder 2/6/12 A S B C HA ASBCASBC

7 A Longer Addition 11 +11 2/6/12 1 0 1 11

8 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, C in Outputs: S, C out 2/6/12 A BC in SC out 00000 00110 01010 01101 10010 10101 11001 11111

9 Full Adder 2/6/12 A BC in SC out 00000 00110 01010 01101 10010 10101 11001 11111 ABAB C in S C out HA

10 Full Adder 2/6/12 C in S A B C out FA ABAB C in S C out HA

11 Ripple carry adder 2-bit adder: a 1 a 2 +b 1 b 2 = c 1 c 2 with carry out 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 0a2b20a2b2 a1b1a1b1 c 2 c 1 carry out FA

12 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


Download ppt "Logic and computers 2/6/12. Binary Arithmetic 0 +0+0 ---- 0 2/6/12 0 +1 ---- 1 +0 ---- 1 +1 ---- 10 Only two digits: the bits 0 and 1 (Think: 0 = F, 1."

Similar presentations


Ads by Google