基本邏輯運算

Logic Gates

Not Gates

  • Symbol notgate
  • Truth Table
    XXorX’0110 \def\arraystrecth{1.5}\begin{array}{|c|c|}\hline \text{X}&\overline{\text{X}}\text{or}\text{X’}\\\hline 0&1\\\hline 1&0\\\hline \end{array}

And Gates

  • Symbol notgate
  • Truth Table
    XYZ=XY000010100111 \def\arraystrecth{1.5}\begin{array}{|c|c|c|}\hline \text{X}&\text{Y}&\text{Z=X}\cdot\text{Y}\\\hline 0&0&0\\\hline 0&1&0\\\hline 1&0&0\\\hline 1&1&1\\\hline \end{array}

Or Gates

  • Symbol notgate
  • Truth Table XYZ=X+Y000011101111 \def\arraystrecth{1.5}\begin{array}{|c|c|c|}\hline \text{X}&\text{Y}&\text{Z=X+Y}\\\hline 0&0&0\\\hline 0&1&1\\\hline 1&0&1\\\hline 1&1&1\\\hline \end{array}

布林表達式與真值表(Boolean Expression and Truth Table)

  • Boolean expression
    • ' 代表 NOT
    • + 代表 OR
    • . 代表 AND
    • 將輸入用上面的運算子表示成算式,如:(A+C)(B+C)(A+C)(B’+C)
  • Truth Table ABCBABAB+CA+CB+C(A+C)(B+C)000100010001101111010000000011001111100111111101111111110000100111001111 \def\arraystrecth{1.5}\begin{array}{ccc|cccccc} A&B&C&B’&AB’&AB’+C&A+C&B’+C&(A+C)(B’+C)\\\hline 0&0&0&1&0&0&0&1&0\\ 0&0&1&1&0&1&1&1&1\\ 0&1&0&0&0&0&0&0&0\\ 0&1&1&0&0&1&1&1&1\\ 1&0&0&1&1&1&1&1&1\\ 1&0&1&1&1&1&1&1&1\\ 1&1&0&0&0&0&1&0&0\\ 1&1&1&0&0&1&1&1&1\\ \end{array}

基本運算定理

NOT gate 的基本運算定理

(x)=x \boxed{ \def\arraystretch{1.5}\begin{array}{ccc} (x’)’&=&x \end{array} }

AND gate 的基本運算定理

x+0=xx+1=1x+x=xx+x=1 \boxed{ \def\arraystretch{1.5}\begin{array}{ccc} x+0&=&x\\ x+1&=&1\\ x+x&=&x\\ x+x’&=&1 \end{array} }

OR gate 的基本運算定理

x0=0x1=xxx=xxx=0 \boxed{ \def\arraystretch{1.5}\begin{array}{ccc} x\cdot 0&=&0\\ x\cdot 1&=&x\\ x\cdot x&=&x\\ x\cdot x’&=&0 \end{array} }

進階運算定理

交換律 Commutative Law

xy=yxx+y=y+x \boxed{ \def\arraystretch{1.5}\begin{array}{ccc} xy&=&yx\\ x+y&=&y+x \end{array} }

結合律 Associative Law

(xy)z=x(yz)(x+y)+z=x+(y+z) \boxed{ \def\arraystretch{1.5}\begin{array}{ccc} (xy)z&=&x(yz)\\ (x+y)+z&=&x+(y+z) \end{array} }

分配律 Distributive Law

x(y+z)=xy+xzx+yz=(x+y)(x+z) \boxed{ \def\arraystretch{1.5}\begin{array}{ccc} x(y+z)&=&xy+xz\\ x+yz&=&(x+y)(x+z) \end{array} }

Multiplying out and factoring

Sum of Product(SOP) form

  • 將算式化整成各個輸入端先 AND 後再 OR
  • 例: ABC+ABC+ABCABC+AB’C+AB’C’

Product of Sum(POS) form

  • 將算式化整成各個輸入端先 OR 後再 AND
  • 例: (A+B+C)(A+B+C)(A+B+C)(A+B+C)(A+B’+C)(A+B’+C’)

Multiplying out:

  • 將算式化簡成 SOP form
  • 善用(A+B)(A+C)=A+BC\boxed{(A+B)(A+C)=A+BC}
  • 範例:
    (A+BC)(A+D+E)(A+BC)(A+D+E)
    =(A+x)(A+y)=(A+x)(A+y)
    =A+xy=A+xy
    =A+BC(D+E)=A+BC(D+E)
    =A+BCD+BCE=A+BCD+BCE

Factoring:

  • 將算式化簡成 POS form
  • 善用A+BC=(A+B)(A+C)\boxed{A+BC=(A+B)(A+C)}
  • 範例:
    AB+CDAB’+C’D
    =(AB+C)(AB+D)=(AB’+C’)(AB’+D)
    =(A+C)(B+C)(A+D)(B+D))=(A+C’)(B’+C’)(A+D)(B’+D))

2-level realization

  • 利用 Multiplying out 與 Factoring 可以將電路簡化成 2-level circuit
  • 因為減少了 Delay propagation 可以減少 Total Time Delay

DeMorgan’s Laws and Duality

DeMorgan’s Laws

  • 方法:
    • ANDORAND\leftrightarrow OR
    • AAA\leftrightarrow A’
      (x+y+z+)=xyz(xyz)=x+y+z \boxed{ \def\arraystretch{1.5}\begin{array}{ccc} (x+y+z+…)’&=&x’ y’ z’…\\ (xyz…)’&=&x’+y’+z’… \end{array} }
  • Truth Table 證明
    xyzxyzx+y+z(x+y+z)xyz000111011001110100010101100011100100100011100101010100110001100111000100 \def\arraystretch{1.5}\begin{array}{ccc|ccc|c|c|c} x&y&z&x’&y’&z’&x+y+z&(x+y+z)’&x’ y’ z’\\\hline 0&0&0&1&1&1&0&1&1\\ 0&0&1&1&1&0&1&0&0\\ 0&1&0&1&0&1&1&0&0\\ 0&1&1&1&0&0&1&0&0\\ 1&0&0&0&1&1&1&0&0\\ 1&0&1&0&1&0&1&0&0\\ 1&1&0&0&0&1&1&0&0\\ 1&1&1&0&0&0&1&0&0\\ \end{array}
  • 範例
    [(AB+C)(D+EF)+GH+W][(A’ B+C’)(D’+EF’)+GH+W]’
    =[(A+B)C+D(E+F)](G+H)W=[(A+B’)C+D(E’+F)] (G’+H’)W’

Duality

  • 方法

    • ANDORAND\leftrightarrow OR
    • 010\leftrightarrow 1
      [f(x1,x2,,xn,0,1,+,)]D=f(x1,x2,,xn,1,0,,+) \boxed{ \def\arraystretch{1.5}\begin{array}{cccccccccc} [f(&x_1,&x_2,&…,&x_n,&0,&1,&+,&\cdot&)]^D\\ =f(&x_1,&x_2,&…,&x_n,&1,&0,&\cdot,&+&) \end{array} }
  • 性質

    • F=GFD=GD\boxed{F=G\rightarrow F^D=G^D}
  • 範例
    (x+y)y=xyxy+y=x+y(x+y’)y=xy\rightarrow x\cdot y’+y=x+y

  • 回顧分配律 Distributive Law,即為 Duality 的表現。
    x(y+z)=xy+xzx+yz=(x+y)(x+z) \boxed{ \def\arraystretch{1.5}\begin{array}{ccc} x(y+z)&=&xy+xz\\ x+yz&=&(x+y)(x+z) \end{array} }

Exclusive-OR and equivalence operations

Exlusive-OR(XOR,\oplus)

  • Symbol xorgate
  • Truth Table
    XYZ=XY000011101110 \def\arraystrecth{1.5}\begin{array}{|c|c|c|}\hline \text{X}&\text{Y}&\text{Z=X}\oplus\text{Y}\\\hline 0&0&0\\\hline 0&1&1\\\hline 1&0&1\\\hline 1&1&0\\\hline \end{array}
  • 性質:
    x0=xx1=xxx=0xx=1xy=yx(xy)z=x(yz)x(yz)=xyxzxy=xy+xy \boxed{ \def\arraystretch{1.5}\begin{array}{ccc} x\oplus 0&=&x\\ x\oplus 1&=&x’\\ x\oplus x&=&0\\ x\oplus x’&=&1\\ x\oplus y&=&y\oplus x\\ (x\oplus y)\oplus z&=&x\oplus (y\oplus z)\\ x(y\oplus z)&=&xy\oplus xz\\ x\oplus y&=&xy+x’ y' \end{array} }

Equivalence(\equiv)

  • Symbol equivgate
  • Truth Table
    XYZ=XY001010100111 \def\arraystrecth{1.5}\begin{array}{|c|c|c|}\hline \text{X}&\text{Y}&\text{Z=X}\equiv{Y}\\\hline 0&0&1\\\hline 0&1&0\\\hline 1&0&0\\\hline 1&1&1\\\hline \end{array}
  • 性質:
    x0=xx1=xxx=1xx=0xy=yx(xy)z=x(yz)x(yz)=xyxzxy=xy+xy \boxed{ \def\arraystretch{1.5}\begin{array}{ccc} x\equiv 0&=&x’\\ x\equiv 1&=&x\\ x\equiv x&=&1\\ x\equiv x’&=&0\\ x\equiv y&=&y\equiv x\\ (x\equiv y)\equiv z&=&x\equiv (y\equiv z)\\ x(y\equiv z)&=&xy\equiv xz\\ x\equiv y&=&xy’+x’ y \end{array} }

連鎖律 The consensus thorem

  • 公式:
    • xy+xz+yz=xy+xz\boxed{xy+x’ z+yz=xy+x’ z}
    • (x+y)(x+z)(y+z)=(x+y)(x+z)\boxed{(x+y)(x’+z)(y+z)=(x+y)(x’+z)}
  • 證明:
    xy+xz+yzxy+x’ z+yz
    =xy+xz+(x+x)yz=xy+x’ z + (x+x’)yz
    =xy+xyz+xz+xyz=xy+xyz+x’ z+x’ yz
    =xy(1+z)+xz(1+y)=xy(1+z)+x’ z(1+y)
    =xy+xz=xy+x’ z

簡化布林表達式的流程

  1. 利用 xy+xy=x(y+y)=x\boxed{xy+xy’=x(y+y’)=x}(AND性質)
  2. 利用 x+xy+=x(1+y+)=x\boxed{x+xy+…=x(1+y+…)=x}(OR性質)
  3. 利用 xy+xz+yz=xy+xz\boxed{xy+x’ z+yz=xy+x’z }(連鎖律)
  4. 利用 x+xy=x(y+y)+xy=xy+xy+xy=x+y\boxed{x+x’y=x(y+y’)+x’y=xy+xy’+x’ y=x+y}
  5. 必要時加入 redundant terms
  • Lec3會使用圖表法,較不容易出錯。

如何證明布林表達式的正確性?

  1. 建構 Truth Table
  2. 簡化 LHS 和 RHS