# [006]-数字电路

> source: 文章/digital-circuits/index.md

# [006]-数字电路

- [x] 1.数字编码、逻辑门
- [ ] 2.
- [ ] 3.
- [ ] 4.
- [ ] 5.
- [ ] 6.
- [ ] 7.
- [ ] 8.
- [ ] 9.



## 1 数字编码、逻辑门

1's complement and 2's complement，分别为反码和补码

1's complement 就是把二进制数的每一位0和1都互换

2's complement = (1's complement) + 1

为什么要使用2's complement

- 更方便做加法和减法
- 能够很容易地表示数字的正负

数字编码

- BCD(binary coded decimal)
- Grey code: exhibits only a single bit change from one code to the next in sequence

基础逻辑 与 或 非 AND OR NOT

NAND NOR XOR XNOR

布尔代数的计算规则

满足交换律 结合律 分配律

另外稍微特殊一点的：$A+BC = (A+B)(A+C)$

吸收法则：$A+AB=A$

De Morgan Theorem
$$
(AB)' = A' + B'
\\
(A + B)' = A'B'
$$

## 2
