• 沒有找到結果。

Boolean logic

N/A
N/A
Protected

Share "Boolean logic"

Copied!
27
0
0

(1)

2

3

4

(2)

5

6

7

8

(3)

AND truth table

9

10

11

(4)

(5)

(6)

Bubble Pushing Example

(7)

25

26

S

XY mux Z

27

16 Boolean functions of 2 variables.

every 4-bit value represents one

0

Truth table for all Boolean functions of 2 variables

1110

28

Truth table for all Boolean functions of 2 variables

(8)

All Boolean functions of 2 variables

Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org, Chapter 1: Boolean Logic slide 29

16 Boolean functions of 2 variables.

every 4-bit value represents one 8 bi l

2^(2^n) Boolean functions of n variables!

every 8-bit value represents one every 2n-bit value represents one

001

30

some functions of 3 variables

Form AND term for each 1 in Boolean function.

proves that { AND, OR, NOT } are universal

31

'

Expressing XOR Using AND, OR, NOT

32

(9)

33

35

36

(10)

37

38

39

40

(11)

41

42

43

44

(12)

45

46

47

48

(13)

49

50

51

52

(14)

53

54

55

56

(15)

And

Not

Not

Or

Not

And Not

59

60

(16)

61

62

63

64

(17)

65

66

67

68

(18)

Karnaugh Maps (K‐Maps)

• PA + PA = P

Y AB Y

B C AB 0 0 A

0 1

Y

C 00 01

0

11 10

1 0 0 0

C 00 01 0

11 10

ABC ABC ABC ABC 0 0

0 1 1 0 1 1 0 0 0 0

0 0 1

1 1 0 0 0

1 1 0 0 0 1 ABC ABC ABC ABC

0 1 1 0 1 1 1 1 1

0 0 0

(19)

(20)

Example Example

80

(21)

81

82

83

(22)

a b out

b And

0 0 0 0 1 0 1 0 0 1 1 1

}

Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org, Chapter 1: Boolean Logic slide 86

}

Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org, Chapter 1: Boolean Logic slide 87

}

Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org, Chapter 1: Boolean Logic slide 88

(23)

}

Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org, Chapter 1: Boolean Logic slide 89

Not(in = x, out = out)}

Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org, Chapter 1: Boolean Logic slide 90

programprogram

Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org, Chapter 1: Boolean Logic slide 91

HDL programprogram

Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org, Chapter 1: Boolean Logic slide 92

(24)

output file

Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org, Chapter 1: Boolean Logic slide 93

And hdlAnd.hdl , And.tst , And.cmp files

Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org, Chapter 1: Boolean Logic slide 94

 Do Project 0 (optional) Do Project 0 (optional)

Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org, Chapter 1: Boolean Logic slide 95

Gates for project #1 (Basic Gates)

Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org, Chapter 1: Boolean Logic slide 96

(25)

Gates for project #1

Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org, Chapter 1: Boolean Logic slide 97

Gates for project #1 (Multi-bit version)

Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org, Chapter 1: Boolean Logic slide 98

Gates for project #1 (Multi-way version)

Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org, Chapter 1: Boolean Logic slide 99

Gates for project #1 (Multi-way version)

Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org, Chapter 1: Boolean Logic slide 100

(26)

Gates for project #1 (Multi-way version)

Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org, Chapter 1: Boolean Logic slide 101

Gates for project #1 (Multi-way version)

Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org, Chapter 1: Boolean Logic slide 102

a

b and

c

or f(a,b,c)

and

 Gates, neurons, atoms, …

Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org, Chapter 1: Boolean Logic slide 103

Truth table of the "suspect" function

Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org, Chapter 1: Boolean Logic slide 104

(27)

w s ( a , m , w )  amw  amw  amw

a m w

and w

and or s

and

Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org, Chapter 1: Boolean Logic slide 105

b and

active fuse

blown fuse legend:

blown fuse

or f(a,b,c)

8 and terms connected to the same 3 inputs

single or term

and

single or term connected to the outputs of 8 and terms

PLD implementation of f(a,b,c)= a b c + a b c _ _ _

Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org, Chapter 1: Boolean Logic slide 106

(the on/off states of the fuses determine which gates participate in the computation)

Y

Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org, Chapter 1: Boolean Logic slide 107

Sections parallel to the xy-plane are ellipses; sections parallel to the other coordinate planes are parabolas.. Hence the term “elliptic paraboloid.” The surface is symmetric

circuit sat: Given a circuit, is there a truth assignment such that the circuit outputs true?.. • circuit sat ∈ NP: Guess a truth assignment and then evaluate the

Elements of Computing Systems, Nisan &amp; Schocken, MIT Press, www.nand2tetris.org , Chapter 1: Boolean Logic slide 29... Truth Table for Functions of 3 Variables

circuit sat: Given a circuit, is there a truth assignment such that the circuit outputs true?.. • circuit sat ∈ NP: Guess a truth assignment and then evaluate the

In addition, we automated the search of disjoint (respectively balanced) variable partition by ﬁnding a minimal unsatisﬁable core with incremental SAT solving under unit

Elements of Computing Systems, Nisan &amp; Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System slide 2.. Where we

Elements of Computing Systems, Nisan &amp; Schocken, MIT Press, www.nand2tetris.org , Chapter 9: High-Level Language slide 2.. Where we

Elements of Computing Systems, Nisan &amp; Schocken, MIT Press, www.nand2tetris.org , Chapter 1: Compiler II: Code Generation slide