Skip to content

Digital Logic Design

University Electrical Engineering Topic 3 8:05 English narration · English and 中文 subtitles you can switch

space play · ←/→ 5s · j/l 10s · f fullscreen · c subtitles · ,/. speed

Chapters

Transcript
Digital logic needs only two voltage levels, a handful of gates, and time. 数字逻辑只需要两个电压电平、少量逻辑门和时间。
A three-input function has just eight rows, so checking every row is free, on paper or in a loop. 一个三输入函数只有八行,因此无论在纸上还是用循环,逐行检查都不费什么工夫。
That habit carries the whole course: truth tables, Karnaugh maps and hardware testbenches are the same exhaustive check at three levels of automation. 这种习惯贯穿整门课:真值表、卡诺图和硬件测试平台,是自动化程度不同的三种穷举检查。
Binary conversions check themselves by re-adding the weights: 156 is 128 plus 16 plus 8 plus 4, which is 1 0 0 1 1 1 0 0, or 9 C in hex. 二进制转换可以通过重新相加各位的权值来检验:156 是 128 加 16 加 8 加 4,也就是 1 0 0 1 1 1 0 0,十六进制表示为 9 C。
Two's complement negates by inverting and adding one. 补码通过按位取反再加一来求相反数。
Adding 90 and 70 gives 160, beyond the 8-bit limit of 127, so the result reads minus 96: overflow. 90 加 70 得 160,超过了 8 位数的上限 127,所以结果读作负 96:这就是溢出。
Write the weights from 128 down to 1 under each bit, and add the weights where a 1 sits: 1 0 0 1 1 1 0 0 is 156. 在每一位下面写出从 128 到 1 的权值,把数字为 1 的位置对应的权值相加:1 0 0 1 1 1 0 0 就是 156。
Group the bits in fours for hex: 9 and C. 将二进制数每四位分一组,得到十六进制数:9 和 C。
Two's complement is arithmetic modulo 2 to the N. 补码运算是模 2 的 N 次方的运算。
Overflow is spotted by the sign rule, not the carry: 100 plus 50 reads minus 106. 判断溢出要看符号规则,而不是进位:100 加 50 的结果读作负 106。
In 8-bit two's complement, the numbers run from minus 128, written 10000000, to plus 127, 01111111. 在 8 位补码中,数的范围是从负 128,写作 10000000,到正 127,写作 01111111。
Every number with a leading 1 is negative. 最高位为 1 的数都是负数。
Minus 1 is all ones, 11111111, and sits just below zero, all zeros. 负 1 的各位全是 1,即 11111111,它紧挨着全为 0 的零。
Adding 1 to minus 1 wraps round to zero. 负 1 加 1 会回绕到零。
A Karnaugh map rearranges a truth table so that neighbouring cells differ in one variable, and that adjacency is simplification. 卡诺图重新排列真值表,使相邻单元格只在一个变量上不同,而这种相邻关系可以用来化简。
Groups of 2, 4 or 8 cells each remove variables. 每组 2、4 或 8 个单元格都能消去一些变量。
The odd minterms 1, 3, 5 and 7 all share only C, so F equals C. 奇数最小项 1、3、5 和 7 只有 C 相同,所以 F 等于 C。
De Morgan breaks the bar and changes the sign. 德摩根定律将上方的非号拆开,同时改变运算符。
Don't-cares may only enlarge groups. 无关项只能用来扩大分组。
The four odd minterms form one group of four cells, and inside that group only C stays constant, so A and B drop out: F equals C, checked on all eight rows. 四个奇数最小项组成一个四格的组,在这个组里只有 C 保持不变,所以 A 和 B 被消去:F 等于 C,在全部八行上都可以验证。
For a majority of four inputs, the map gives A B times C plus D, plus C D times A plus B, checked on all sixteen rows. 对于四输入多数表决函数,卡诺图给出 A B 乘以 C 加 D,再加上 C D 乘以 A 加 B,在全部十六行上都可以验证。
In the three-variable map, a loop of four down the first two columns gives not A, and a loop of four that wraps round the outer columns gives not B. 在三变量卡诺图中,圈住前两列的四格得到非 A,圈住两侧边缘列的四格得到非 B。
In the four-variable map, the four corner ones form a single loop, because the map wraps in both directions. 在四变量卡诺图中,四个角上的 1 构成一个圈,因为卡诺图在两个方向上都首尾相接。
The bigger the loop, the fewer variables remain. 圈越大,剩下的变量就越少。
A multiplexer routes one data input, chosen by the select lines. 多路选择器根据选择线选通一路数据输入。
A decoder raises exactly one output. 译码器恰好使一个输出为高电平。
A full adder obeys 2 times carry out plus sum equals A plus B plus carry in, so three ones give binary 1 1. 全加器满足 2 乘以进位输出加上和等于 A 加 B 加进位输入,所以三个 1 得到二进制数 1 1。
Ripple-adding 1011 and 0110 gives 10001, which is 17. 用串行进位方式将 1011 和 0110 相加得到 10001,也就是 17。
Unequal path delays cause glitches; a consensus term covers them. 路径延迟不相等会产生毛刺;加入共识项可以消除毛刺。
Memorise this schematic, because every arithmetic circuit reuses it. 记住这个电路图,因为所有算术电路都会用到它。
Two XOR gates make the sum, and two ANDs feeding an OR make the carry: five gates, three inputs, two outputs. 两个异或门产生和,两个与门的输出接入一个或门产生进位:一共五个门、三个输入、两个输出。
Chain them to add longer numbers, as 11 plus 01 gives 100. 将它们级联就能相加更长的数,例如 11 加 01 得到 100。
But each carry must ripple through every stage, and that chain sets the speed limit. 但是每个进位都必须逐级传递,这条进位链决定了速度上限。
A latch is transparent while it is enabled; a flip-flop samples its input only at the clock edge. 锁存器在使能期间是透明的;触发器只在时钟边沿对输入采样。
If D reads 1, 0 and 1 at three edges, Q becomes 1, 0 and 1, and any wiggles between edges are ignored. 如果 D 在三个边沿分别为 1、0 和 1,Q 就依次变为 1、0 和 1,边沿之间的任何变化都会被忽略。
A J-K flip-flop toggles when both inputs are 1. 当两个输入都为 1 时,J-K 触发器会翻转。
Excitation tables run backwards, from a desired change to the inputs needed. 激励表反过来查:从期望的状态变化出发,找出所需的输入。
Read this timing diagram as the flip-flop's contract. 把这张时序图看作触发器的工作约定。
D wiggles freely between clock edges, but Q copies it only at each rising edge: 1, then 0, then 1. D 在时钟边沿之间可以自由变化,但 Q 只在每个上升沿复制 D:先是 1,然后是 0,再是 1。
Nothing between edges matters. 边沿之间的变化都不影响结果。
Once you can read this trace, designing sequential circuits becomes a matter of looking up what the inputs must be before each edge. 一旦会读这条波形,设计时序电路就变成了查找每个边沿之前所需输入的过程。
Each NOR gate feeds its output back into the other. 每个或非门都将自己的输出反馈到另一个门。
With S and R both 0, the latch holds whatever it last stored. S 和 R 都为 0 时,锁存器保持上一次存储的状态。
S equals 1 sets Q to 1, and R equals 1 resets Q to 0. S 等于 1 将 Q 置为 1,R 等于 1 将 Q 复位为 0。
Both 1 at once forces both outputs low, which is invalid. 两者同时为 1 会强制两个输出都为低电平,这是无效状态。
Design a state machine in five steps: draw the diagram, write the table, choose an encoding, derive the excitation, and minimise. 设计状态机分五步:画状态图、写状态表、选择编码、推导激励并化简。
Moore outputs depend only on the state; Mealy outputs also depend on the inputs. Moore 输出只取决于状态;Mealy 输出还取决于输入。
A parity checker has two states, even and odd, and the next state is Q XOR input. 奇偶校验器有偶和奇两个状态,下一状态是 Q 与输入的异或。
The input 1, 0, 1, 1 ends in odd. 输入 1、0、1、1 后,最终处于奇状态。
Two bubbles and four arrows carry this whole design. 两个状态圆圈和四条箭头就构成了整个设计。
Input 1 swaps between even and odd; input 0 stays put. 输入 1 时在偶和奇之间切换;输入 0 时保持原状态。
The output is 1 in the odd state. 在奇状态下输出为 1。
The next-state logic is a single XOR feeding one flip-flop. 下一状态逻辑是一个异或门,输出接到一个触发器。
For a sequence detector, think about overlap: after matching 1 0 1 1, the final 1 can start the next match. 设计序列检测器时要考虑重叠:匹配 1 0 1 1 后,最后一个 1 可以作为下一次匹配的开头。
A register loads n bits on each clock edge, and a shift register marches bits along, turning serial data into parallel. 寄存器在每个时钟边沿加载 n 位,移位寄存器则将各位依次移动,把串行数据转换成并行数据。
In a synchronous up-counter, bit k toggles when all the lower bits are 1, and the count must have exactly 2 to the n states. 在同步加法计数器中,当所有低位都是 1 时,第 k 位翻转,而且计数必须恰好有 2 的 n 次方个状态。
A memory of 8K by 8 needs 13 address lines, since 8K is 2 to the 13, and 8 data lines. 一个 8K 乘 8 的存储器需要 13 条地址线,因为 8K 是 2 的 13 次方,还需要 8 条数据线。
Every counter is a register plus logic on one shared clock. 每个计数器都是由一个寄存器和逻辑电路组成,共用同一个时钟。
Here the toggle logic says which bits flip: T0 equals 1, T1 equals Q0, and T2 equals Q1 and Q0. 这里的翻转逻辑决定哪些位翻转:T0 等于 1,T1 等于 Q0,T2 等于 Q1 与 Q0。
The trace runs 000, 001, 010, 011. 波形依次为 000、001、010、011。
For a counter that wraps at 6, make sure every unused state, including 110 and 111, leads back to 000. 对于计数到 6 时回绕的计数器,要确保所有未使用的状态,包括 110 和 111,都返回 000。
This figure closes the course. 这幅图为课程收尾。
On the left is the full adder written as a Verilog module. 左边是写成 Verilog 模块的全加器。
On the right, the testbench waveform drives all eight input combinations and checks that sum and carry track a plus b plus carry in. 右边的测试平台波形驱动全部八种输入组合,并检查 sum 和 carry 是否符合 a 加 b 加 carry_in。
The reference model is arithmetic, independent of the gates. 参考模型基于算术运算,独立于逻辑门。
Ship your code together with its proof. 交付代码时,要同时附上它正确的证明。
A hardware description language separates synthesizable code, which becomes gates, from the testbench, which only simulates. 硬件描述语言区分可综合代码和测试平台:前者会变成逻辑门,后者只用于仿真。
The full adder module assigns sum as a XOR b XOR carry in. 全加器模块将 sum 赋值为 a 异或 b 异或输入进位。
The testbench loops i from 0 to 7, drives the inputs, and asserts 2 times carry out plus sum equals a plus b plus carry in. 测试平台让 i 从 0 循环到 7,驱动输入,并断言 2 乘以输出进位加 sum 等于 a 加 b 加输入进位。
That loop automates the truth table check. 这个循环将真值表检查自动化。
Now test yourself from memory. 现在凭记忆自测。
What do the minterms 1, 3, 5 and 7 of A, B and C simplify to? A、B 和 C 的最小项 1、3、5 和 7 化简后是什么?
In a 4-bit synchronous up-counter, when does bit 2 toggle? 在一个 4 位同步加法计数器中,第 2 位什么时候翻转?
Which construct belongs only in a testbench and never becomes hardware? 哪种结构只属于测试平台,绝不会变成硬件?
Pause, answer each one, then evaluate it to check. 暂停一下,逐一回答,然后求值检查。

Comments

    Log in or create account

    IGCSE, A-Level & AP