forked from HITSZ-OpenCS/HITSZ-OpenCS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
来自 criwits 的 2022 春《计算方法》和 2021 秋《数字逻辑设计》笔记 (HITSZ-OpenCS#78)
* 添加 2022 春计算方法笔记 * 添加 2021 秋《数字逻辑设计》笔记
- Loading branch information
Showing
79 changed files
with
2,160 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+4.51 MB
...2021_hanswan/Digital Logic Design 05bbc93ece5d4edd95c960bf21bada63/Untitled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
93 changes: 93 additions & 0 deletions
93
...sign 05bbc93ece5d4edd95c960bf21bada63/基本逻辑门 c5a80174c1ca46d7ae2c7190d0d77fa8.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# 基本逻辑门 | ||
|
||
Logic gates are the basic building blocks of any digital system. A logic gate is a electronic circuit having one or more than one *input port(s)* and only one *output port*. The relationship between its input(s) and output is determined by a certain logic. | ||
|
||
It’s necessary to memorise the function, symbol as well as algebraic expression of some common logic gates introduced in this chapter. | ||
|
||
# Basic Operations | ||
|
||
## AND Gate | ||
|
||
The AND gate only outputs a positive signal when all of its inputs are getting positive signal. | ||
|
||
Expression: $F=A\cdot B=AB$. Intuitively the AND logic can be treated as multiplication. | ||
|
||
Symbol: | ||
|
||
 | ||
|
||
## OR Gate | ||
|
||
The OR gate only outputs a negative signal when all of its inputs are getting negative signal. | ||
|
||
Expression: $F=A+B$. Intuitively the OR logic can be treated as addition. | ||
|
||
Symbol: | ||
|
||
 | ||
|
||
## NOT Gate | ||
|
||
The NOT gate will produce a signal different from its input. | ||
|
||
Expression: $F=\bar{A}=A'$. | ||
|
||
Symbol: | ||
|
||
 | ||
|
||
# Other Operations | ||
|
||
## NAND Gate | ||
|
||
NAND = NOT + AND, i.e. $F=\overline{AB}$. | ||
|
||
Symbol: | ||
|
||
 | ||
|
||
## NOR Gate | ||
|
||
NOR = NOT + OR, i.e. $F=\overline{A+B}$. | ||
|
||
Symbol: | ||
|
||
 | ||
|
||
The symbol on the right side is so ugly that I’m wondering if my teacher drew it with line & curve tools in PowerPoint. | ||
|
||
## AND-OR-NOT Gate | ||
|
||
**This is not a common logic gate**. | ||
|
||
This kind of logic gate has 4 input ports, wiring them with AND gate two by two and then connects the two outputs with a NOR gate. | ||
|
||
Expression: $F=\overline{AB+CD}$. | ||
|
||
Symbol: | ||
|
||
 | ||
|
||
The fact is, I hold the opinion that this is not a logic gate. It’s a kind of combinational logic block. | ||
|
||
## XOR Gate | ||
|
||
Exclusive OR gate, or XOR gate, outputs a positive signal only when its two input signals are different from each other. | ||
|
||
Expression: $F=A\oplus B=\bar{A}B+A\bar{B}$. | ||
|
||
Symbol: | ||
|
||
 | ||
|
||
## XNOR Gate | ||
|
||
XNOR = NOT + XOR, i.e. $F=AB+\bar{A}\bar{B}$. | ||
|
||
XNOR gate outputs a positive signal only when its two input signals are the same one. | ||
|
||
Symbol: | ||
|
||
 | ||
|
||
The bottom-left symbol is more or less... rough. |
Binary file added
BIN
+7.16 KB
...ece5d4edd95c960bf21bada63/基本逻辑门 c5a80174c1ca46d7ae2c7190d0d77fa8/Untitled 1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.53 KB
...ece5d4edd95c960bf21bada63/基本逻辑门 c5a80174c1ca46d7ae2c7190d0d77fa8/Untitled 2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.31 KB
...ece5d4edd95c960bf21bada63/基本逻辑门 c5a80174c1ca46d7ae2c7190d0d77fa8/Untitled 3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.94 KB
...ece5d4edd95c960bf21bada63/基本逻辑门 c5a80174c1ca46d7ae2c7190d0d77fa8/Untitled 4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.74 KB
...ece5d4edd95c960bf21bada63/基本逻辑门 c5a80174c1ca46d7ae2c7190d0d77fa8/Untitled 5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8 KB
...ece5d4edd95c960bf21bada63/基本逻辑门 c5a80174c1ca46d7ae2c7190d0d77fa8/Untitled 6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.8 KB
...ece5d4edd95c960bf21bada63/基本逻辑门 c5a80174c1ca46d7ae2c7190d0d77fa8/Untitled 7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.1 KB
...93ece5d4edd95c960bf21bada63/基本逻辑门 c5a80174c1ca46d7ae2c7190d0d77fa8/Untitled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
167 changes: 167 additions & 0 deletions
167
...esign 05bbc93ece5d4edd95c960bf21bada63/布尔代数 68f91aab71134af48483ec3eda18e153.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
# 布尔代数 | ||
|
||
The Boolean algebra is used to describe certain logic design made up with several logic gates and wires connecting them. | ||
|
||
# Laws and Theorems in Boolean Algebra | ||
|
||
## Basic Theorems | ||
|
||
- $A+B=B+A$, and $AB=BA$. | ||
- $(A+B)+C=A+(B+C)$, and $(AB)C=A(BC)$. | ||
- $A(B+C)=AB+AC$. | ||
- $A+AB=A$, and $A(A+B)=A$. | ||
|
||
This theorem shows that $B$ will be ‘absorbed’ in this form of expression. | ||
|
||
- $AB+A\bar{B}=A$, and $(A+B)(A+\bar{B})=A$. | ||
- $A+\bar{A}B=A+B$. | ||
|
||
$A+\bar{A}B=A+AB+\bar{A}B=A+(A+\bar{A})B=A+B$. | ||
|
||
- ${A+BC=(A+B)(A+C)}$ | ||
|
||
Why: $(A+B)(A+C)=A+AC+BA+BC$, and $A+AC+BA=A$. | ||
|
||
- $AB+\bar{A}C+BC=AB+\bar{A}C$, and $AB+\bar{A}C+BCD=AB+\bar{A}C$. | ||
|
||
Use $BC$ to absorb $BCD$. | ||
|
||
- $\overline{A\bar{B}+\bar{A}B}=\bar{A}\bar{B}+AB$. | ||
|
||
XNOR = XOR + NOT. | ||
|
||
|
||
## DeMorgan’s Law | ||
|
||
$$ | ||
\begin{align*}\overline{X_1X_2\cdots X_n}=\bar{X}_1+\bar{X}_2+\cdots+\bar{X}_n\\\overline{X_1+X_2+\cdots+X_n}=\bar{X}_1\bar{X}_2\cdots\bar{X}_n\end{align*} | ||
$$ | ||
|
||
## Dual Rule | ||
|
||
By changing operators in an expression in this way you get its dual expression: | ||
|
||
- $+\leftrightarrow\cdot$ | ||
- $\oplus\leftrightarrow\odot$ | ||
|
||
For a equation it’s dual expression is still valid. For example: | ||
|
||
$$ | ||
A+BCD=(A+B)(A+C)(A+D)\Leftrightarrow A(B+C+D)=AB+AC+AD | ||
$$ | ||
|
||
# Maxterm and Minterm | ||
|
||
It’s easy for us to realise that for a boolean expression containing some variables—say, $A$, $B$, $C$ and $D$—it can be written in this form: only several AND items added together, i.e. addiction of multiplications. An example: | ||
|
||
$$ | ||
f(A, B, C, D)=AB+ACD+D | ||
$$ | ||
|
||
And if we add invisible items (which is always 1) such as $(A+A')$ and $(D+D')$ to make each AND item has all four variables appear, then the formula can be expanded to: | ||
|
||
$$ | ||
f(A,B,C,D)=AB(C+C')(D+D')+A(B+B')CD+(A+A')(B+B')(C+C')D | ||
$$ | ||
|
||
Simplify this expression using the law $A(B+C)=AB+AC$, we will get | ||
|
||
$$ | ||
f(A,B,C,D)=ABCD+ABCD'+ABC'D+ABC'D'+AB'CD+A'BCD+A'B'CD+A'BC'D+A'B'C'D | ||
$$ | ||
|
||
If we use $1011$ to represent $AB'CD$, use $0110$ to represent $A'BCD'$, then the items in the formula above are: | ||
|
||
$$ | ||
1111, 1110, 1101, 1100, 1011, 0111, 0011, 0101, 0001 | ||
$$ | ||
|
||
All of them are 4-bit binary numbers so we just transform them into decimal numbers. They are | ||
|
||
$$ | ||
15, 14, 13, 12, 11, 7, 3, 5, 1 | ||
$$ | ||
|
||
Intuitively, the original boolean expression can be expressed with a series of numbers. This is called the *minterm* expression. More detailed, we use minterm expression in this algebraic way: | ||
|
||
$$ | ||
f(A,B,C,D)=\sum m(1, 3, 5, 7, 11, 12, 13, 14, 15) | ||
$$ | ||
|
||
Dually, an expression can also be written in this way: | ||
|
||
$$ | ||
g(A, B, C)=(A'+B+C)(A+B+C')(A'+B'+C) | ||
$$ | ||
|
||
Treat $(A'+B+C)$ as binary number $100$, then we have the *maxterm* expression. It is expressed in this way: | ||
|
||
$$ | ||
g(A,B,C)=\prod M(1, 5, 6) | ||
$$ | ||
|
||
According to the dual rule it’s easy for us to change an expression into the other one. For instance: | ||
|
||
$$ | ||
f(A,B,C)=\sum m(1, 4, 5, 7)=\prod M(0, 2, 3, 6) | ||
$$ | ||
|
||
This figure shows some interesting relationships. | ||
|
||
 | ||
|
||
# Karnaugh Map | ||
|
||
Karnaugh Map (K. Map) is a powerful tool used in expression simplification and other scenarios. | ||
|
||
K. Map is a table containing $2^n$ element cells. Each cell stands for a minterm. The cells are arranged in a Gray code way, which means the two cells next to each other have only one different bit. For 4 variables the K. Map usually likes this: | ||
|
||
 | ||
|
||
Steps when using K. Map to simplify logic expression: | ||
|
||
## Fulfil the K. Map | ||
|
||
To fulfil the K. Map you firstly transform your expression into the form ‘addiction of multiplications’. For example, | ||
|
||
$$ | ||
F=\overline{A\oplus C\cdot\overline{\bar{B}(A\bar{C}\bar{D}+\bar{A}C\bar{D})}}=AC+\bar{A}\bar{C}+A\bar{B}\bar{C}\bar{D}+\bar{A}\bar{B}C\bar{D} | ||
$$ | ||
|
||
Then for each multiplication fill its corresponding K. Map cells with 1. For example, for $\bar{A}\bar{C}$, we find the row where $A$ is 0, and mark 1 in those rows whose $C$ is 0. Finally we will have a K. Map like this: | ||
|
||
 | ||
|
||
*An interesting fact is that you can now read the minterm expression directly on this K. Map.* | ||
|
||
## Circle the Prime Implicants in K. Map | ||
|
||
Now, we make rectangular groups containing total terms in power of 2 and try to cover as many elements as you can in one group. | ||
|
||
 | ||
|
||
Note that the four red groups are the same group for the parallel edges and corners of such K. Map are connected together. | ||
|
||
This kind of rectangular groups, or circles, are called ‘prime implicants’. ‘Implicant’ means the rectangular group only consists 1 and ‘prime’ means it has been expanded as large as possible. | ||
|
||
## Get Simplified Expression from the Implicants | ||
|
||
Each group in the figure above stands for a multiplication item. Just write them and add them together and you get a simplified addiction of multiplications. | ||
|
||
Look at the figure above. | ||
|
||
- For four elements in the red circle, they have both $B$ and $D$ as 0, while their $A$ and $C$ values differ. So for this group it’s implicant is $B'D'$. | ||
- For four elements in the green circle, they have both $A$ and $C$ as 0, so this group represents $A'C'$. | ||
- For four elements in the yellow circle, they have both $A$ and $C$ as 1, so this group represents $AC$. | ||
|
||
So finally we can read out this expression: | ||
|
||
$$ | ||
F=A'C'+AC+B'D' | ||
$$ | ||
|
||
## Distinguished 1-Cell and Essential Prime Implicant | ||
|
||
- Distinguished 1-cell means the cell in a K. map who is only covered by one prime implicant. | ||
- Essential prime implicant means the prime implicant containing distinguished 1-cell. |
Binary file added
BIN
+35.2 KB
...3ece5d4edd95c960bf21bada63/布尔代数 68f91aab71134af48483ec3eda18e153/Untitled 1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13.3 KB
...3ece5d4edd95c960bf21bada63/布尔代数 68f91aab71134af48483ec3eda18e153/Untitled 2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+16.6 KB
...3ece5d4edd95c960bf21bada63/布尔代数 68f91aab71134af48483ec3eda18e153/Untitled 3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+84.8 KB
...c93ece5d4edd95c960bf21bada63/布尔代数 68f91aab71134af48483ec3eda18e153/Untitled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.