自用学术垃圾桶
signed number |sign-magnitude|1’s complement(反码)|2’s complement(补码)| |—|—|—| |$\pm 0$|$-2^{n-1}+1\sim 2^{n-1}-1, \pm 0$|$-2^{n-1}\sim 2^{n-1}-1$| |0 101|0101|0101| |1 101|1010|1011|
Race: time delay between parallel signals Hazard: race causing incorrect transient output Hazard in $C+\bar{C}, C\bar{C}$ happens when switching from a variable to its complement (time delay). $Y=A\bar{C}+\bar{A}B+\bar{A}C$, both $A$ and $C$ have race; e.g. when $B=1,C=0$, $A$ arises hazard. Tangent circles in the K-map arises hazard.
How to avoid static hazard?
- modify logic design, add redundant terms $Y=B\bar{C}+AC\rightarrow Y=B\bar{C}+AC+AB$ (eliminate tangent circles)
- enable signal
- filtering
- all logics for S-R latch are reversed when using NAND (negative-OR)
- pay special attention to negative inputs: gated S-R latch inverts inputs so that they’re still active-high
- inverting bubbles can move along a line and cancel each other
- 对于negative input,可以$\overline{\text{input}}=\text{input_new}$,直接化为对应的negative output
- 可以通过工作时段判断类型: posedge-triggered FF对应slave在反时钟的low/posedge工作, 即为NOR型, 反之则为NAND型; master相反
实际上是将时序逻辑按状态机考虑,分离为迭代过程($Q^n\rightarrow Q^{n+1}$)与组合逻辑(f(状态,输入/控制变量), 表达式, 列表与k-map是不同的表示方式). 复杂问题建议用K-map, 输入为自变量, 输出为所求因变量.
Find $S,R$ or $D$ or $J,K$ for the logic relationship to organize it in form of the drive equation
Conversion between FFs: $\text{drive variable}=f(Q(\text{combination logic}))=g(\text{drive variable’})$ 可以出现反馈回路形式的输入, 只要组合逻辑关系符合即可
JK | T | D | |
---|---|---|---|
JK | $J=Q^{n+1},K=\bar{Q^{n+1}}$ | $J=K=T$ | $J=D,K=\bar{D}$ |
T | $T=J\bar{Q^n}+KQ^n$ | $T=Q^n\oplus Q^{n+1}$ | $T=D\oplus Q^n$ |
D | $D=J\bar{Q^n}+\bar{K}Q^n$ | $D=T\oplus Q^n$ | $D=Q^{n+1}$ |
看起来反手反脚的方法有望避免glitch
frequency dividing synchronous counter $CP_{i+1}=CLK, T_i=f(Q_0,\dots,Q_{i-1})$ 更低位全为0/1时翻转
考试的时候会给,不用背
$S_1S_0$ | operation |
---|---|
00 | keep |
01 | right shift, $D_{SR}$ in |
10 | left shift, $D_{SL}$ in |
11 | parallel data $ABCD$ in |
asynchronous decade counter 74LS290 (JK FF)
pin | meaning | operation |
---|---|---|
$\bar{A},Q_A$ | clk and output for $M=2$ | |
$\bar{B}, \left{Q_DQ_CQ_B\right}$ | clk and outputs for $M=5$ |
可以用来实现编码: 1. BCD(8421) 5*2; 2. 5421 2*5 低位信号有时候不一定需要复位信号 注意异步需要多一个!
synchronous counter 74LS163 (syn. clr)
pin | meaning | operation |
---|---|---|
$DCBA$ | ||
$\overline{CLR}, \overline{LD}$ | clear, load | priorty |
$P$ | parallel load enable | $PT=11$ enable |
$T$ | toggle enable | $PT=01/x0$ keep |
$RCO$ | ripple carry output (end mark) |
先级联后反馈: 1–P1–P2, 1–T1, RCO1–T2, LD–1/RCO2 先反馈后级联: 1–P1–T1, P2–T2–CLR1/LD1
synchronous counter 74LS161 (asyn. clr)
analysis steps:
design steps: