SCAU数字电路Digital Circuits and Logic Design复习
ch2-1-1
Binary 二进制 Octal 八进制 Hexadecimal 十六进制
Number representation in radix r
r: radix (基数)
ri: weight of digit di(权重)
dp-1: Most Significant Digit (MSD)
d-n: Least Significant Digit (LSD)
Binary Addition and Subtraction
里面有cout 和 cin 一般是指加法的进位,out是出去的,in进去的。bout 和 bin 则是减法的。
Number System Conversion
Binary to Octal/Hexadecimal
Partition the binary number into groups of three/four bits, starting at binary point and
integer part: going left
Fractional part: going right
Both the lefthand and righthand sides can be padded with ‘0’ if necessary
Each group corresponds to a single octal/hexadecimal digit.
从二进制点开始,将二进制数分成3/4位
整数部分:向左
分数部分:向右
如果需要,可以用“0”填充左侧和右侧
每组对应一个八进制/十六进制数字
ch2-2-1
Signed-Magnitude Representation (原码)SMR
The MSB position is 0 for positive numbers and 1 for negative numbers.
就是在符号位是1则是负数,是0则是正数,其他的位置不变。
One’s Complement Representation (反码)OCR
Positive number: same as the positive SM numbers
Negative numbers: complement each bit of the SM of corresponding positive number including the sign bit
There are two representations of zero as well.
就是说正数的反码就是正数,负数的反码是对其原码逐位取反,但符号位除外。
Two’s Complement Representation (补码)TCR
Positive number:same as its SMR and OCR.
Negative number:add “1” to the one’s complement of the number.
Only one representation to “0”.
正数依然不变,但是尼,负数则是反码加一。
为什么我们要搞那么多的码呢,因为计算机只会进行加法,不会进行减法,那怎么办呢。
比如5-8我们可以看作5+(-8),那不就可以看作一个加法了吗,所以就会出现补码这个东西,来表示-8。
Addition/Subtraction in TCR
[A+B]two’s=[A]two’s+[B]two’s
[A-B]two’s=[A]two’s-[B]two’s
Overflow
If the signs of the addends are the same but the sign of the sum is different, there is addition overflow.
很明显可以看出,如果计算完后,符号位变了,则说明overflow了,并且,在计算过程中,多出的位是要直接舍弃的,比如上图中蓝色的一就是被舍弃的。
overflow的原因也很简单,就是结果超出了这个bit的承受范围。
Sign Extension
Two’s-complement number X:
(X)n-bit -----> (X)m-bit
Case 1: n > m. Discard the leftmost bits when they are the same as the sign bit.
Case 2: n < m. Append the sign bit to the left of X.
Exercise: (1011)two’s = (11111011)two’s
关键就是符号位啦。注意这是补码的extension噢,不是原码的,原码补0他不香吗。
Binary Codes for Decimal Numbers
Binary-Coded Decimal (BCD, 8421)
这个你就看出普普通通的二进制就好了
2421 Code
A weighted code. (21, 22, 21, 20)
Self-complementing code for 9s’ complement.
就是以中心为轴,然后上下加起来,你会发现都为1111 (对9的自补码)
Excess-3 Code
Self-complementing code for 9s’ complement.
The corresponding BCD code plus 00112.
Follow a standard binary counting sequence.
Not weighted.
余三码,就是BCD码加个(0011)2
Gray Code
Only one bit changes between each pair of successive code words.
Reduce the chance of making mistakes via coding.
你会发现相邻两个code只有一个bit不同
or
Gray code 的生成方法
ch 3
Logic Functions and Gates
AND (与门)
Function: Output 1 if and only if all of its inputs are 1 (输入有0,输出为0).
Expression: Z=A AND B; Z=A·B; Z=AB
OR (或门)
Function: Output 1 if and only if at least one of its inputs is 1 (输入有1,输出为1)
Expression: Z=A OR B; Z=A+B
NOT (非门, 反相器)
Function: Output a value that is opposite to the input value (输出对输入取反)
Expression: Z=NOT A; Z=A’; Z= Ā
CMOS Logic
Positive logic (正逻辑) and Negative logic (负逻辑)
Positive logic: assigning 0 to low and 1 to high
Negative logic: assigning 1 to low and 0 to high
Logic Family:
Bipolar junction transistor circuits: TTL, ECL
MOS transistor circuits: NMOS, PMOS, CMOS
CMOS is the most commonly used logic family.
MOS Transistors
Principle: The gate voltage creates an electric field that enhances or retards the flow of current between source and drain.
也就是根据输入的gate,来判断drain和source是否连接
当N-channel的gate为1的时候,drain和source连通(接地)
当P-channel的gate为0的时候,drain和source连通(接高电压)
反之则不连通
CMOS Static Electrical Behavior
1.Logic Levels and Noise Margins (逻辑电平和噪声容限)
VILmax: when the range of input voltage is between ground and VILmax, recognized as the low by input.
VIHmin: when the range of input voltage is between Vcc and VIHmin, recognized as the high by input.
VOLmax: when output in the low state, Vout: 0~VOLmax.
VOHmin: when output in the high state, Vout: VOHmin~Vcc.
也就是说,低电压是指0-2.4(0),高电压是指2.6-5(1)
2.Propagation delay (传输延迟): tp
tpHL: the time required for the output to change from HIGH to LOW caused by input change.
tpLH: the time required for the output to change from LOW to HIGH caused by input change.
3.Power consumption (功耗)
When output is not changing, the power consumption --> static power dissipation is very low.
When output experiences transitions, the power consumption --> dynamic power dissipation is high, and the transition frequency is the primary reason.