电子电气工程导论9月22日第一节

实时字幕历史

I just finished the task. before we begin the new lecture. And the question eight is convert the following decimal numbers to 8421 BCD. If you still remember this times,

我刚完成这项任务。在我们开始新的讲座之前。第八题是将下面的十进制数转换为8421 BCD码。如果大家还记得当时的情况,

so the last sentence, to express any decimal number in BCD system, replace each digit or each binary number by an appropriate 4-bit. so if you have a decimal number, just replace it.

那么最后一句话是:要用BCD系统表示任何十进制数,就要把每一位数字或每一个二进制数替换成相应的4位二进制数。所以,如果你有一个十进制数,直接替换就可以了。

with the appropriate 4-bit BCD code. For example, if you have 14, right? so the last sentence, to express any decimal number in BCD system, and it should be replaced by 4 bit. 4 bit BCD code.

用相应的4位BCD码来替换。比如说,如果你有14,对吧?第八题。你有14。它应该被替换成4位。也就是4位的BCD码。

BCD code has weight of 8421.

BCD码的权重是8421。

and this digit should also be replaced by 4 bits.

这个数字也应该被替换成4位。

this is 4, exactly it should be 1.

这是4,准确地说应该是1。

the other 0.

另一个是0。

and similarly for question nine. the BCD number is given. and they want you to convert the BCD number to decimal.

同样地,对于第九题。给出了一个BCD数。他们要求你把这个BCD数转换成十进制数。

but here the question doesn't say it's 8421. BCD, right?

但是这里,题目并没有说明它是8421码。是BCD码,对吧?

but as we mentioned in the slides, 8421 is the most frequently used. so if the question doesn't say it's 8421 BCD, we can assume it's 8421 by default.

但是正如我们在幻灯片中提到的,8421是最常用的。所以,如果题目没有明确说明是8421 BCD,我们可以默认它是8421码。

here is the explanation. The BCD is the commonly is 8421. it's the commonest BCD code. if the question doesn't say it's 8421, it should be 8421 BCD by default.

这里是对它的解释。BCD通常指的是8421码。这是最常用的一种BCD码。如果题目没有说明是8421,那么默认也应该是8421 BCD。

okay, let's come back to the question. and similarly, you just group every four digits. let's take the example of a and b.

好的,我们回到题目上来。同样地,你把每四位数字分成一组。我们以a和b为例。

okay, this is the number of the question b, right? question 9b. so, just the other way around. you group every four digits. and then convert them. into corresponding BCD decimal code.

好的,这就是题目b中的数字,对吧?第9题的b部分。那么,方法正好相反。把每四位数字分成一组。然后进行转换。转换成对应的BCD码。

and remember this has weight 8, 4, 2, 1, right? so the corresponding decimal is 0, right? oh, 6, sorry.

记住,它的权重是8、4、2、1,对吧?所以对应的十进制数是0,对吗?哦,是6,抱歉。

and this one is 4, right?

这个是4,对吧?

so finally you will get 346.

那么最后,你会得到346。

okay, let's go to the following.

好的,我们来看下一个。

i will not do the complete task because for other questions, the process will be similar. so i just take one as an example. the last question is just add the binary number together. so at the very beginning we have introduced how to add. the binary numbers together, right? and how to subtract him.

我不会把整个任务都做完,因为对于其他题目,步骤是相似的。所以我只拿一个作为例子。最后一个问题就是把二进制数相加。那么,在一开始,我们就已经介绍过如何进行加法了。就是把二进制数加在一起,对吧?还有如何进行减法。

but i give a very interesting question last day i think some people ask me whether we should consider the carry here or not. because, okay, this one doesn't have carry, right? but maybe for the second one.

不过,昨天我提了一个很有趣的问题,我想有些人问过我。那就是,我们在这里是否应该考虑进位的问题。因为,你看,这个没有进位,对吧?但是,也许第二个例子会有。

the second one you will have carry, right?

第二个例子会有进位,对吧?

yeah.

是的。

okay, but this time you should keep the carry. because

好的,但这次你应该保留进位。因为

in the lecture, we only say three conditions. and we should ignore the carry.

在课上,我们只讲了三种情况。所以应该忽略进位。

first one is when you want to compute the two's complement of a negative number, right? you should ignore. the second situation is

第一种情况是,当你想要计算一个负数的二进制补码时,对吧?你应该忽略进位。第二种情况是,

when you convert binary to

当你把二进制转换为

gray code.

格雷码时。

here is the second situation. when you convert from binary to gray.

这就是第二种情况。就是从二进制转换为格雷码。

the last sentence is disregard carries.

最后一句话就是忽略进位。

the third situation is from gray to binary. you also disregard carries. so these are the only three situations. that means we ignore carries. But for the other situation, just like normal. normal addition, right? so for example, when you plus six with seven, you will get thirteen, right? but not only three.

第三种情况是从格雷码转换为二进制。同样,也要忽略进位。所以,就只有这三种情况。也就是说,我们要忽略进位。但对于其他情况,就和正常的一样。就是普通的加法,对吧?比如,当你把6和7相加时,会得到13,对吧?但这里不是3。

so that's all the three remaining questions.

是的,剩下的三个问题就讲完了。

any question? any questions until now?

大家有什么问题吗?到目前为止,还有问题吗?

okay. if there's no questions,

好的。如果没有问题的话,

i would like to

我想

begin our second lecture.

开始第二节课了。

Our second lecture is the digital logic.

我们的第二节课是关于数字逻辑的。

Because we have known how to use different number systems, to express the numbers. And now we want to understand how to combine them. how to combine different numbers. And how to operate them.

因为我们已经了解了如何使用不同的数制,可以用它们来表示数字。现在,我们想要了解如何将它们组合起来。如何对不同的数字进行运算。以及如何对它们进行操作。

And here we will learn a very important concept. It defines as a logical gate.

在这里,我们将学习一个非常重要的概念。它被称为逻辑门。

You probably have

大家可能已经

known, for example, if we

知道了,比如,如果我们

just plus zero is a binary number, right? one is also binary number. If you pass them together, this plus is a logical gate.

把0和0相加,0就是一个二进制数,对吧?1也是一个二进制数。如果你把它们放在一起,这个加号就是一个逻辑门。

multiplication is also a logical gate.

乘法也是一个逻辑门。

Yeah. So, but these two are very simple logical gate. When you have multiple logical gates, you can make up a very complex digital system. So all the digital systems, complex digital systems, are made up

是的。不过,这两个是非常简单的逻辑门。当你拥有多个逻辑门时,你就可以构建出非常复杂的数字系统。所以,所有的数字系统,复杂的数字系统,都是由

very simple logical gates. So when you combine very simple logic gate together, you will get a finally you will get very complex digital system.

非常简单的逻辑门组成的。所以,当你把非常简单的逻辑门组合在一起时,你就会得到一个非常复杂的数字系统。

And each gate has a function. that can be expressed in Boolean.

而且,每个门都有一个功能。这个功能可以用布尔逻辑来表示。

So this is a function, yeah. It's addition. this logic gate is multiplication. Each gate has a function.

所以,这是一个函数,是的。它是加法。而这个逻辑门是乘法。每个门都有一个功能。

And you can combine the functions. you can combine addition with multiplication.

而且,你可以将这些功能组合起来。你可以将加法与乘法结合起来。

to get a different gate.

从而得到不同的逻辑门。

And the Boolean logic. only operate on binary variables.

这就是布尔逻辑。它只对二进制变量进行运算。

operates on binary variables. if you have a digital circuit,

它操作的是二进制变量。如果你有一个数字电路,

and if the input is binary one, which means the input has a high. has a high input.

如果输入是二进制1,这意味着输入具有高电平。即高输入。

And for this gate,

而对于这个门电路,

if the input is high, you will get also high input. the magnitude of the output is consistent with the magnitude of the input.

如果输入是高电平,输出也会是高电平。输出的幅度与输入的幅度是一致的。

and similarly here, if the input is low, it's binary zero. and the input is low.

同样地,在这里,如果输入是低电平,也就是二进制0。输入也是低电平。

so the output is also low.

所以输出也是低电平。

Okay, this is the key points. in this lecture. So, first we will learn what logical symbols, what logical symbols are. and then how can we do algebraic expression. between different logical symbols.

好的,这就是关键点。在本节课中。首先,我们将学习什么是逻辑符号,以及它们的定义。然后,我们如何进行代数运算?表达式。也就是在不同逻辑符号之间进行运算。

and then what is truth table is. and what is the purpose what is the purpose of Karnaugh maps. so these are the main purpose of this lecture.

接下来,什么是真值表。以及它的用途是什么。还有卡诺图的作用是什么。所以,这就是本节课的主要目标。

okay, first let's learn logical symbols. the first symbol is not function.

好的,首先,我们来学习逻辑符号。第一个符号是“非”函数。

not function is expressed by

“非”函数用

just add one line at the top. at the top of the variable. this is the expression of not function.

在顶部加一条横线来表示。也就是在变量的上方。这就是“非”函数的表达式。

so the not function is the complement. of the variable. if it is applied to

所以,“非”函数就是取反操作。对变量进行取反。如果应用于

so if a variable is one,

一个变量,如果它的值是1,

and the not function gives you zero. so if a is one,

那么“非”函数就会得到0。所以,如果a是1,

not a is zero. similarly, if a is zero,

那么非a就是0。同样地,如果a是0,

not a is one. so this is the first logical symbol. we have learned.

那么非a就是1。所以,这是第一个逻辑符号。我们已经学过了。

and here's a table. a is zero, a not is one. a is one, a not is zero. and you should remember the symbol. of the not function.

这里有一个表格。当a为0时,非a就是1。当a为1时,非a就是0。而且,大家应该记住这个符号。就是非函数的符号。

because finally, you may have to draw very complex digital circuit. And a complex digital circuit.

因为最终,你可能需要绘制非常复杂的数字电路。而复杂的数字电路,

consists of many such kind of small logical gates. and how can we express, for example, how can we express not function?

是由许多这种小的逻辑门组成的。那么,我们该如何表达呢?比如,如何表示非函数?

the symbol is you have an input, and you have a triangle.

它的符号是:有一个输入,还有一个三角形。

and pay attention to the circle here. this is the meaning. this is the meaning of a not function.

请注意这里的圆圈。这就是它的意思。这就是非函数的含义。

and there are two different ways. either you can use the triangle, or you can use a square. so this represent the not function. especially the left one, the triangle, is the most way

有两种不同的表示方法。一种是用三角形,另一种是用正方形。所以,这表示非函数。尤其是左边的三角形,是最常用的。

okay, second logical symbol is and function. it's and function.

好的,第二个逻辑符号是与函数。它是与函数。

a and b can be written by ab. just put them together.

A和B,可以写成AB。就是把它们放在一起。

a and b equals to ab.

A与B等于AB。

and it's also very straightforward. so if there's a and b, if any variable is zero, you will get zero.

而且这也非常简单明了。所以,如果有A和B,只要其中任何一个变量是零,结果就是零。

if a and b, any of them is zero, you will get zero. right?

如果A和B中有一个是零,结果就是零。对吧?

and it will only gives you one

只有当它们都是1的时候,结果才会是1。

once both a and b are one.

也就是A和B同时为1。

it will gives you one only if a and b both are one.

只有当A和B都是1时,才会得到1。

and the symbols is like this. you can either use this

它的符号是这样的。你可以用这个

yeah, this shape. or use the screen.

形状。或者用这个符号。

but on the left side, this shape is the most frequently used.

但是在左边,这个形状是最常用的。

in order to express an AND gate function,

为了表示与门的功能,

you can use the symbol like this. yeah, so this is the symbol to express the AND function.

你可以用这个符号。是的,这就是表示与门功能的符号。

okay, or. or function, third one. the third logical symbol. or function. A or B. A or B can be rewritten. as A plus B.

好的,或者。或门功能,第三个。第三个逻辑符号。或门功能。A或B。A或B可以改写为。A加B。

And the logic is also simple. If there is one, in any of the variables, the final output will be one. so here you can see b is one. and the final will be one.

而且逻辑也很简单。如果有一个是1,在任何一个变量中,最终的输出就是1。所以在这里你可以看到,B是1。最终结果也是1。

so if there's only one in the variables, the final output will be one. and it only happens when a and b are both zero. you will get finally zero.

所以,如果变量中只有一个1,最终输出就是1。只有当A和B都为0时,才会出现这种情况。最终结果就是0。

So this is the or function. and this is the symbol to express or function.

所以,这就是“或”函数。这是表示“或”函数的符号。

It's not a triangle, it's like this shape. It's a little bit different.

它不是三角形,而是像这样的形状。有点不一样。

You have a shape of a moon, right?

它看起来像一个月亮,对吧?

and also similarly, there are two symbols to express or function. The left one is the most frequently used. People usually use this symbol.

同样地,这里有两个符号用来表示“或”函数。左边的是最常用的。人们通常使用这个符号。

to express or function. We have learned log function. and function and or function.

来表示“或”函数。我们已经学过了对数函数。还有“与”函数和“或”函数。

okay, let's learn something a little bit complex.

好的,接下来我们来学一些稍微复杂一点的内容。

lunch function. and function is actually log and.

那就是“与”函数。“与”函数实际上就是“与”门。

so it's called and, right?

所以,它就叫“与”,对吧?

it's actually it's not and.

其实它并不是“与”门。

we have know the and, the and can be expressed by let's go back to the previous slide.

我们已经知道“与”门了,“与”门可以用回到上一页来展示。

a and b.

就是A和B。

a and b can be written as ab. right? so, not and. so you first do the and. a and b, and then log function.

A和B可以写成AB的形式。对吧?那么,“与”的非,就是“与非”门。所以,你首先要执行“与”运算。也就是A和B,然后再经过“非”函数。

so, you do and first, and is ab, right? you have two variables. and is ab, log is just put one line. at the top. so

这就是“与非”门。先做“与”运算,结果就是AB,对吧?这里有两个变量。“与”是AB,“非”就是加一条横线。放在最上面。所以,

this is the definition of the nand function. and the output is like if any of the inputs variables are low, so if there's a zero, any of the variables, the final output will be one.

这就是“与非”函数的定义。它的输出是这样的:如果任何一个输入变量为低电平,也就是有一个0,最终输出就是1。

here you can see you have zero here, right? but always you get one as output. and if both input are one, you will find the final output is zero.

大家看这里,这里有一个0,对吧?但输出总是1。如果两个输入都是1,那么最终输出就是0。

we can do a simple computation, right? so if a is one, b is zero.

我们可以做一个简单的计算,对吧?那么,如果a是1,b是0。

so first we if not and, we should do and first.

所以,首先,我们对a和b进行非与运算,应该先做与运算。

zero.

结果是0。

right?

对吧?

so

那么,

exactly. you will get one zero, you will get one. similarly for the other combination.

没错。你会得到1和0,然后得到1。其他组合也是如此。

The combination here is the ant, right? here is the lot. So, ant, lot. so this is the symbol of land.

这种组合,这里是蚂蚁,对吧?这里是很多。所以,蚂蚁,很多。所以,这就是土地的象征。

This is the symbol we have learned here. This is ant, right? and this is lot. so just combine them together. you get this shape. and a circle.

这是我们在这里学到的符号。这是蚂蚁,对吧?这是很多。所以,把它们组合在一起。你就得到了这个形状。还有一个圆圈。

so this is symbol. for land. function.

所以,这就是一个符号。代表土地。功能。

let's join it here.

让我们把它连接在这里。

Okay, land.

好的,土地。

no function.

没有功能。

Similarly, now is lot over. or is here, right? this is the or. this is the and.

同样地,现在是“很多”在上面。“或”在这里,对吧?这就是“或”。这是“与”。

or is a bit bussy, right? a or b is

“或”有点复杂,对吧?A或B是

equals to a plus b. and is a times b.

等于A加B。“与”是A乘以B。

not is like this.

“非”是这样的。

It's over. Not over. Okay.

Not,N-O-R。就是“非或”。首先,你要先做“或”运算。结束了。还没结束。好的。

And Xor has also the same box. Let's join it here. And this one is the common used to use.

而且,XOR也有同样的盒子。我们把它在这里连接起来。这个是最常用的。

Exclusive or.

异或。

And the definition is

它的定义是,

a xor b is

a XOR b就是

not a and b or

非a。和b进行或运算。

and not b.

以及非b。

So totally we have six logical functions. or logical gate here.

所以,总共有六个逻辑函数。或者说,这里有六个逻辑门。

Corresponding laws to operate the variables. The first one is

接下来,我将介绍三个不同的定律。因为这些就是运算,对吧?相应的法律,用于操作这些变量。第一个是

commutativity.

交换律。

commutative law. a or b equals to b or a.

交换律。a 或 b,等于 b 或 a。

So this is the first law.

这就是第一条定律。

And also, a and b is equivalent to b and a.

另外,a 和 b 等同于 b 和 a。

So you can switch the position. just you can switch the positions of two variables. a can be at left side. or b can be the left side. So both are okay. So you can switch.

所以你可以交换它们的位置。就是,你可以交换两个变量的位置。a可以放在左边。或者b也可以放在左边。所以两种都可以。所以你可以交换。

a or b is equivalent to b or a. a and b is equals to b and a.

a 或 b 等同于 b 或 a。a 和 b 等于 b 和 a。

So the order makes no difference. The order is the position, right? a is at left, b is right. This is the order. order makes no difference.

所以顺序并不重要。顺序就是位置,对吧?a在左边,b在右边。这就是顺序。顺序并不重要。

Second law is associative. associative law.

第二条定律是结合律。结合律。

and okay, a or here is you do the or between b and c first. you do the or function between b and c first. and then you or it. you or it with a.

好的,a 或这里,你先对b和c进行“或”运算。也就是先对b和c执行“或”函数。然后再把它和a进行“或”运算。也就是用a去“或”上刚才的结果。

it's equivalent to you can first do the or function between a and b. and then or it with c. so this is the second law, associative.

这等价于,你可以先对a和b进行“或”运算。然后再把结果和c进行“或”运算。所以,这就是第二条定律,结合律。

so the result is the same. regardless. the grouping of the variables. whether you group a, b and c first or you group a and b first, it doesn't matter. whether you group b and c first or you group a and b first, it doesn't matter. The result is the same.

所以结果是一样的。无论顺序如何。也就是变量的分组方式。无论你是先把a、b和c分组,还是先把a和b分组,都没关系。无论是先把b和c分组,还是先把a和b分组,都不重要。结果都是一样的。

and also for and function, you do the and between b and c first, and then you and it with a. it's equivalent to you and a and b first, then and it with c.

另外,对于“与”函数来说,你可以先对b和c进行“与”运算,然后再把结果和a进行“与”运算。这等同于你先对a和b进行“与”运算,再把结果和c进行“与”运算。

and also it makes no difference.

同样,这也没有区别。

in what order the variables are grouped. so here you group the b and c first, right? and then it's equivalent to you group a and b first.

也就是变量的分组顺序。所以这里你是先把b和c分组,对吧?那么这就等同于先把a和b分组。

that's no different here.

这里没有区别。

it's the second law. associative law.

这是第二定律。也就是结合律。

okay, the third law, also the last law.

好的,第三条定律,也是最后一条。

distributive law. okay, you or b and c first. and then and it with a.

分配律。好的,“或”先对b和c进行运算。然后再与a进行“与”运算。

it's equivalent to a and b

这相当于a和b

or a and c.

“或”a和c。

it's very similar to what we have learned in mathematics. so, yeah.

这和我们数学中学过的非常相似。所以,是的。

all the three laws are similar to what we have learned in mathematics.

这三大定律都与我们在数学中学到的内容相似。

And XOR.

还有XOR。

A and A is A.

A和A就是A。

A and A not is zero. Okay, the first age. The first age is very, I think it's very easy to understand. right? Do we have any question about first age?

A和非A等于零。好的,第一个阶段。我认为第一个阶段非常容易理解。对吧?关于第一阶段,大家有什么问题吗?

Okay, the line is also intuitive. A not and not. A not not. A not not is the A itself.

好的,这条线也很直观。非A和非非A。非非A。非非A就是A本身。

And the ten. the tenth, A or A and B.

还有第十个。第十个,A或A与B。

we should use this hybrid law.

我们应该使用这个混合定律。

A and A or A and B. it's equivalent to A.

A与A或A与B。它等同于A。

Right? You or one and B first, and then and it with A.

对吧?你先算1和B,然后再和A进行与运算。

So one or B is one.

所以,1或B等于1。

So you finally get A.

所以最后得到的结果是A。

Okay, let's get the eleventh.

好的,接下来我们来看第十一个。

the eleventh, A.

第十一个,A。

or A not.

或者非A。

and B.

再与B进行与运算。

Okay, first let's think about A or A not. A or A not is one, right?

好的,首先我们来考虑A或非A。A或非A等于1,对吧?

Right. So this is one.

没错。所以,这里就是1。

And if we just, this is equivalent to A or B, right?

如果我们只看这个,它等同于A。再与B进行或运算,对吧?

Yeah.

是的。

Because this is one.

因为这是1。

And then you do the distributive law. So A and A is A and A. And second term is A and B.

然后你进行分配律。那么A和A,就是A和A。第二项是A和B。

The third one is A not.

第三项是非A。

A not and A.

非A和A。

The last one is

最后一项是

A not and B.

非A和B。

A and A is A.

A和A等于A。

Right?

对吧?

Plus AB.

加上AB。

A not 0.

非A和0。

Let's step further. A or AB.

让我们更进一步。A或AB。

You can write like this.

你可以这样写。

or 0 or A not B.

或者0,或者非A和B。

Okay. Then it's just A, right?

好的。那它就等于A,对吧?

Right.

对。

A plus A or AB.

A加上A或AB。

So you finally get A.

所以最后你得到了A。

Any questions?

还有问题吗?

Okay, no questions. If there is no questions, we will continue the last one.

好的,没有问题。如果没有问题,我们就继续讲最后一个。

The twolves just use the third law. distributive law.

对于“两者”,只需要使用第三定律。也就是分配律。

a or b

A或B,

and a or c.

和A或C。

okay.

好的。

distributive law a

分配律A,

is k.

就是K。

ac, ba, bc.

AC、BA、BC。

a and a is a.

A和A就是A。

and okay, so here you have the common a, right?

好的,那么这里有一个共同的A,对吧?

you can write like this.

你可以这样写。

yeah, like this.

对,就是这样。

okay, this is equivalent to a, right?

好的,这等同于A,对吧?

right. or ba.

没错。或者是BA。

or bc.

或者是BC。

and then here you also have the same a here.

然后这里,你也有一个相同的A。

and this is equivalent to a.

这也等同于A。

you can change a or bc.

你可以把它改成A或者BC。

any questions?

大家有什么问题吗?

okay, let's have a look at de morgan's theory.

好的,接下来我们来看一下德摩根定律。

the first theory is the complement the complement of a sum. a or b is the sum. the complement of the sum. this is the complement of a sum.

第一个定律是,补集之和的补集。A或B就是和。和的补集。这就是和的补集。

so this is the sum. the complement of the sum is

所以,这就是和。和的补集是

the blackness.

黑色的部分。

the complement of the sum is equal to the product of the complement. so the a complement is a not. the product of each complement.

和的补集等于各个补集的乘积。所以,A的补集就是A非。也就是每个补集的乘积。

so this is the first, this is the de morgan's theorem.

所以,这就是德摩根定理的第一条。

the complement of a sum is equal to the product of the complement. this is the sum. the product of the complement. is equal to the product of each complement.

和的补集等于补集的乘积。这就是和。这是补集的乘积。等于每个补集的乘积。

the complement of two or more variables.

两个或多个变量的补集。

or, or it is the same. it's the same as the complement of each individual variable anded.

或者,也是一样的。它等于每个单独变量的补集的与运算。

oh, sorry. give me a five minutes break.

哦,对不起。给我五分钟休息一下。

课堂最终稿

Before we begin the new lecture, let us finish the past exercise. Question 8: Convert the following decimal numbers to BCD. Please remember this. Any decimal number expressed in BCD can be represented using an appropriate number of nibbles.

在开始新讲课之前,我们先完成上一道练习。第8题:将下列十进制数转换为BCD码。请记住这一点。任何用BCD码表示的十进制数,都可以用适当数量的半字节来表示。

For example, if you have the number 14, each digit should be replaced by four bits. This is the BCD code. The BCD code has weights of 8, 4, 2, 1. Each digit should be replaced by four bits.

例如,如果你有一个数14,每一位数字都应该用四位来表示。这就是BCD码。BCD码的权值为8、4、2、1。每一位数字都应该用四位来替代。

As mentioned in the slides, L4-1 is also frequently used. If the question does not specify the density code, it is L4-1 94. Here is the explanation: L4-1 is the commonest density code. Therefore, if the question does not state that it is L4-1, you should assume it is L4-1, density code 94.

如幻灯片所述,L4-1 也是经常使用的密度代码。如果题目没有指定密度代码,则为 L4-1 94。解释如下:L4-1 是最常用的密度代码。因此,如果题目没有说明是 L4-1,则应默认为 L4-1,密度代码 94。

Let's come back to this question. Similarly, you just group every four digits. Let's take the example from Question 9B. This is the number given in Question 9B. Just the other way around: you group every four digits, and then convert them into the corresponding BCD decimal code.

我们回到这道题。类似地,你只需要每四位分组。以第9B题为例,这是第9B题给出的数。反过来操作即可:每四位分一组,然后将每组转换为对应的BCD十进制码。

But remember, this is a weight of eight, four, two, one. So the corresponding digit is six. And this one is four. Two. Six. So finally you will get three hundred forty-six.

但请记住,这里的权值是八、四、二、一。所以对应的数字是六。这个是四。二。六。最终得到三百四十六。

Binary to Gray code. Here is the second illustration, where you convert from binary to Gray.

二进制转格雷码。这是第二个示例,展示如何从二进制转换为格雷码。

Because we have learned how to use different number systems to express numbers, and now we want to understand how to combine different numbers and how to operate them. Here we learn a very important concept defined as the logical gate.

因为我们已经学会了如何使用不同的数制来表示数字,现在我们要理解如何组合不同的数字以及如何对它们进行运算。在这里,我们学习一个非常重要的概念,定义为逻辑门。

These two are very simple logic gates. When you combine multiple logic gates together, you get a very complex digital system. All complex digital systems are made up of very simple logic gates. And each gate has a function.

这两个是非常简单的逻辑门。当你将多个逻辑门组合在一起时,就能得到一个非常复杂的数字系统。所有复杂的数字系统都是由非常简单的逻辑门构成的。每个门都有一个功能。

A function can be expressed in Boolean logic. This is addition; this dot here is multiplication. Each gate has a function. You can combine the functions—you can combine addition with multiplication to get a different gate.

一个函数可以用布尔逻辑来表达。这里是加法,这个点表示乘法。每个门都有一个函数。你可以组合这些函数——将加法与乘法结合起来,就能得到不同的门。

Boolean logic only operates on binary variables. In a digital circuit, if the input is binary 1, it means the input has a high voltage level.

布尔逻辑仅作用于二进制变量。在数字电路中,如果输入为二进制1,则意味着该输入处于高电平。

For this gate, if the input is high, you get a high output. The magnitude of the output is consistent with the magnitude of the input. Similarly, if the input is low—binary zero—the output is also low.

对于这个门电路,如果输入为高电平,则输出也为高电平。输出的幅度与输入的幅度一致。类似地,如果输入为低电平——即二进制零——则输出也为低电平。

These are the key points in this lecture. First, we will learn what logical symbols are. Then, how can we do algebraic expressions between different logical symbols. And then, what is truth...

这些是本节课的要点。首先,我们将学习什么是逻辑符号。然后,如何在不同逻辑符号之间进行代数表达式运算。接下来,什么是真值……

What a truth table is, and what is the purpose of Karnaugh maps—these are the main purposes of this lecture. First, let's learn logical symbols. The first symbol is the NOT function.

什么是真值表,以及卡诺图的用途是什么——这些是本讲的主要目的。首先,让我们学习逻辑符号。第一个符号是NOT函数。

Express it by just adding an edge of 1 at the top of the bar variable. This is the expression of the loss function. The loss function is the complement of the bar variable if it is applied to it. So if the variable is 1, and

通过在变量上方加一条边为1来表示。这就是损失函数的表达式。损失函数是该变量的补集(如果对其应用的话)。所以如果变量为1,那么

You may have to draw very complex digital circuits. A complex digital circuit consists of many small logic gates. How can we express a NOT function? The symbol has an input and a triangle. Pay attention to the circle — this is the meaning of a NOT function.

你可能需要绘制非常复杂的数字电路。一个复杂的数字电路由许多小型逻辑门组成。我们如何表示一个非门函数?该符号有一个输入端和一个三角形。请注意那个圆圈——这就是非门函数的含义。

There are two different ways to represent the NOT function: either you can use a triangle, or you can use a square. This represents the NOT function. Especially the latter one—the triangle—is the most frequently used. The second logical symbol is the AND function. A and B.

表示非(NOT)函数有两种不同的方式:可以使用三角形,也可以使用方形。这代表非函数。其中三角形是最常用的。第二个逻辑符号是与(AND)函数。A 与 B。

You will get zero. And it will only give you one once both A and B are one. The symbol is like this.

你会得到零。只有当A和B都为1时,它才会输出1。符号是这样的。

This shape, or use the square. But the left side, this shape is the most frequently used. So in order to express the NOT function, you can use the symbol like this. This is the symbol to express the AND function. The OR function is the third one, the third logical symbol. A OR B can be rewritten as A plus B.

这个形状,或者用方形。但左侧这个形状是最常用的。为了表示非(NOT)函数,你可以使用这样的符号。这是用来表示与(AND)函数的符号。或(OR)函数是第三个逻辑符号。A OR B 可以改写为 A + B。

If there is one in any of the variables, the final output will be one. Here you can see B is one, and the final will be one. A is one, the final is one. So if there is one in the variables, the final output will be one. And it only happens when A and B are both zero that you will get zero as the output.

如果任一变量为一,最终输出即为一。这里可以看到,B为一时,最终输出为一;A为一时,最终输出也为一。因此,只要变量中存在一,最终输出就为一。只有当A和B都为零时,最终输出才为零。

So this is the OR function, and this is the symbol to express the OR function. It's not a triangle; it's not like this shape. It's a little bit different. It has a shape of a moon.

这是OR函数,这是用来表示OR函数的符号。它不是三角形,也不是这种形状。它略有不同,呈月牙形。

Similarly, there are two symbols to express the OR function, but the left one is the most frequently used. People usually use this symbol to express the OR function. We have learned the NOT function, the AND function, and the OR function.

类似地,有两个符号可以表示或运算,但左边那个是最常用的。人们通常使用这个符号来表示或运算。我们已经学习了非运算、与运算和或运算。

Let's learn something a little bit deeper, a little bit more complex: the NAND function. The NAND function is actually NOT AND.

我们来学习一个更深入、更复杂一点的内容:NAND函数。NAND函数实际上就是NOT AND。

This is the definition of the NAND function. The output is high if any of the input variables are low. If there is a zero in any of the variables, the final output will be one. Here you can see you have zero here, you have zero here, and you have zero here, but always you get one as output. And if both inputs are one, you will find that it gives zero.

这就是NAND函数的定义。当任一输入变量为低电平时,输出为高电平。如果任一变量中存在零,最终输出就为一。这里可以看到,这里有零,这里有零,这里也有零,但输出始终为一。而当两个输入都为一时,输出为零。

If we have NOT AND, the AND part can be expressed by referring back to the previous slide. A AND B can be written as AB. So NAND is NOT AND. You first perform the AND operation on A and B, then apply the NOT function. For NOT AND, you do AND first: with two variables, AND gives AB. NOT is simply placing an overline on top of the variables.

如果我们有NOT AND,AND部分可以参照上一张幻灯片来表达。A AND B可以写成AB。所以NAND就是NOT AND。你先对A和B执行AND运算,再施加NOT函数。对于NOT AND,先做AND:有两个变量时,AND的结果是AB。NOT就是在变量上方加一条横线。

We can do a simple computation. If A is one and B is zero, first we compute NOT A AND B, which gives zero. Then A AND NOT B gives one. So the result is one. Similarly for the other combinations.

我们可以做一个简单的计算。如果A为1,B为0,首先计算NOT A AND B,结果为0。然后A AND NOT B的结果为1。因此最终结果为1。其他组合同理。

Here you can see the combination. This is the AND gate, and this is the NOT gate. Combining them gives us NAND. So this is the symbol of NAND: the AND shape with a circle at the output.

这里可以看到组合方式。这是与门,这是非门。将它们组合起来就得到了与非门。所以与非门的符号是:与门的形状加上输出端的一个小圆圈。

This is a symbol for the land function. That is a joystick joint here. Land.

这是 land 函数的符号。这里是一个操纵杆关节。Land。

Now, the NOT function. Similarly, we have the OR function. OR is here — this is AND, and this is OR. OR is A plus B. A OR B equals A plus B.

接下来是NOT函数。类似地,我们还有OR函数。OR在这里——这是AND,这是OR。OR就是A加B,即A OR B等于A加B。

AND is A times B. NOT is the negation. So NOR—N-O-R—NOR is NOT OR. You first do the OR, then apply NOT. NOT OR: A plus B is OR; NOT OR is its negation. Here is the truth table. For example, when A is 1 and B is 0, A OR B is 1, because A is true and B is false, so A OR B is true.

AND 是 A 乘以 B。NOT 是取反。所以 NOR——N-O-R——NOR 就是 NOT OR。先做 OR 运算,再取反。NOT OR:A 加 B 是 OR;NOT OR 是其否定。这里是真值表。例如,当 A 为 1、B 为 0 时,A OR B 等于 1,因为 A 为真、B 为假,所以 A OR B 为真。

If the answer is low, it will be zero. This exercise is a combination of OR and NOT. When you combine them together, you get the NOR symbol. This is the OR part. For the circle, this is NOT. So this is NOR. We have learned five functions. Let us continue. There is another one—the last one.

如果答案是低电平,则结果为零。这个练习是 OR 和 NOT 的组合。将它们组合在一起,就得到 NOR 符号。这是 OR 部分。圆圈代表 NOT。所以这就是 NOR。我们已经学习了五个函数。继续往下,还有最后一个。

XOR also has a truth table, which is shown here. This is the commonly used form. Exclusive OR. And the definition is—

XOR 也有一个真值表,这里展示的就是。这是常用的形式。异或。其定义是——

In total, we have six logical functions, or logic gates, here.

总共有六个逻辑函数,也就是逻辑门。

Next, I will introduce three different laws. Since we have six operations between two variables, there are corresponding laws that govern these operations. The first one is the commutative law: A OR B equals B OR A.

接下来我将介绍三条不同的定律。由于两个变量之间存在六种运算,因此有相应的定律来规范这些运算。第一条是交换律:A OR B 等于 B OR A。

A OR B equals B OR A. This is the first law, the commutative law. And also, A AND B is equivalent to B AND A. You can switch the positions of two variables. A can be on the left side or B can be on the left side; both are okay. So you can switch the positions.

A OR B 等于 B OR A。这是第一条定律,即交换律。同样,A AND B 等价于 B AND A。你可以交换两个变量的位置。A 可以在左边,B 也可以在左边,两者都可以。所以你可以交换它们的位置。

A OR B is equivalent to B OR A. A AND B equals B AND A. The order makes no difference. Order refers to position — A is on the left, B is on the right; that is the order. The order makes no difference. The second law is the associative law.

A OR B 等价于 B OR A。A AND B 等于 B AND A。顺序不影响结果。顺序指的是位置——A 在左边,B 在右边,这就是顺序。顺序不影响结果。第二条定律是结合律。

Here, you do the OR function between B and C first, and then you OR it with A. This is equivalent to first doing the OR function between A and B, and then OR it with C. So this is the second law — the associativity law.

这里,先对 B 和 C 执行 OR 运算,然后将结果与 A 进行 OR 运算。这等价于先对 A 和 B 执行 OR 运算,再将结果与 C 进行 OR 运算。这就是第二条定律——结合律。

The result is the same regardless of the grouping of the variables. Whether you group B and C first or A and B first, it does not matter. For the AND function, if you compute B AND C first and then AND the result with A, this is equivalent to computing A AND B first and then ANDing the result with C. It makes no difference.

无论变量如何分组,结果都是相同的。先对B和C分组还是先对A和B分组,都没有影响。对于AND函数,先计算B AND C再将结果与A进行AND运算,等价于先计算A AND B再将结果与C进行AND运算。结果没有任何区别。

When you group the variables, say you group B and C first, it is equivalent to grouping A and B first. There is no difference. This is the associative law. Now the third law, also the last law: the distributive law. You OR B and C first, and then AND it with A.

当你对变量进行分组时,比如先将B和C分组,等价于先将A和B分组,结果没有区别。这就是结合律。接下来是第三条定律,也是最后一条:分配律。先将B和C进行或运算,再与A进行与运算。

And then ordering the product. Great. Let's have three votes. Let me summarize the voting. First of all...

然后是订购产品。很好。我们进行三轮投票。让我总结一下投票结果。首先……

C first, and then AND it with A. This is equivalent to A AND B OR A AND C. It is very similar to what we have learned in mathematics. All three laws are similar to what we have learned in mathematics. Now, this law states that if you OR several variables and then AND the result with a single variable, it is equivalent to AND-ing the single variable with each of the several variables first. For example, if A is a single variable, you AND A with B, AND A with C.

先取 C,再与 A 进行 AND 运算。这等价于 A AND B OR A AND C。这与我们在数学中学到的非常相似。这三条定律都与数学中的定律类似。接下来这条定律指出:如果将多个变量进行 OR 运算,再将结果与单个变量进行 AND 运算,等价于先将该单个变量分别与每个变量进行 AND 运算。例如,若 A 是单个变量,则将 A 与 B 做 AND,A 与 C 做 AND。

First law is commutative: A OR B is equivalent to B OR A; A AND B equals B AND A. Second, associative: A OR (B AND C) first, then OR it with A, is equivalent to (A OR B) AND (A OR C) first, and then OR it.

第一条是交换律:A 或 B 等价于 B 或 A;A 与 B 等于 B 与 A。第二条,结合律:先对 B 与 C 取或,再与 A 取或,等价于先对 A 或 B 与 A 或 C 取与,再取或。

A AND A is A. A AND NOT A is zero. The first eight are very easy to understand. Do you have any questions about the first eight? The next line is also intuitive: NOT(NOT A) is A itself.

A AND A 等于 A。A AND NOT A 等于零。前八条非常容易理解。大家对前八条有什么问题吗?下一行同样直观:NOT(NOT A) 就是 A 本身。

Consider the expression A OR A AND B. We should use the distributive law here. A OR A AND B is equivalent to A. You first get 1 OR B, then AND it with A.

考虑表达式 A OR A AND B。这里我们应该使用分配律。A OR A AND B 等价于 A。先得到 1 OR B,再与 A 进行 AND 运算。

One, four B is one. So you finally get A. Next, number eleven. Eleven is A or A not times D.

第一题,四B等于一,所以最终得到A。接下来,第十一题。第十一题是A或A非乘D。

First, consider A OR A'. This equals 1. Therefore, the expression simplifies to A OR B.

首先,考虑 A OR A',其值等于 1。因此,该表达式简化为 A OR B。

Because this is one. And then you apply the distributive law. The first pair is A and A. The second pair is A and B. The third one is A naught and A. The last one is A naught.

因为这一项等于一。然后应用分配律。第一对是 A 与 A。第二对是 A 与 B。第三对是 A 零与 A。最后一对是 A 零。

And B. A is A, right? Plus AB. A dot zero. Let's do the same for the other: A or AB. You can write one this.

和B。A就是A,对吧?加上AB。A点乘零。我们对另一个也做同样的处理:A或AB。你可以把它写成这样。

Then it is just A, right? A plus A₁. So finally, you get A. Any questions?

那么结果就是A,对吗?A加A₁。所以最终,你得到A。有什么问题吗?

If there are no questions, we will continue with the last topic: tautologies. Tautologies simply use the distributive law: A ∨ B ∧ A ∨ C.

如果没有问题,我们继续最后一个主题:重言式。重言式只需使用分配律:A ∨ B ∧ A ∨ C。

[Pause — instructor transitions to the next item; no substantive speech delivered in this interval.]

【停顿——教师过渡到下一项内容;此区间内无实质性讲授。】

Here you have the common matrix A. You can write it like this. This is equivalent to A: 4 plus P8.

这里有一个常见的矩阵A。你可以把它写成这样。这个形式等价于A:4加P8。

And then you also have the same chain here. This equivalent is A. Which one is A, or B, C? Any questions?

然后这里也有同样的链。这个等价项是A。哪一个是A,还是B、C?有什么问题吗?

Let's have a look at De Morgan's theory. The first part is the complement of a sum. A or B is the sum, right? The complement of the sum—this is the complement of a sum.

我们来看一下德摩根定律。第一部分是和的补。A或B是和,对吧?和的补——这就是一个和的补。

The complement of a sum is equal to the product of the complements. The product of the complements — A complement is A naught — the product of each complement. This is De Morgan's theorem.

和的补等于补的积。补的积——A的补记为A上划线——即各补的乘积。这就是德摩根定理。

The complement of a sum is equal to the product of the complements of each term. The complement of two or more variables—

一个和的补等于各项补的乘积。两个或多个变量的补——

Or it is the same as the complement of each individual variable ANDed. Let's take a minute break.

或者它等价于对每个单独变量取补后再进行 AND 运算。我们休息一分钟。

课程总结

课程概览

本节课分为两大部分。

第一部分是上一节练习的讲评,主要围绕三道题:第8题把十进制数转换为8421 BCD码;第9题把BCD码转换回十进制数;最后一题是二进制数加法,并重点讨论了“什么时候需要保留进位、什么时候需要忽略进位”。教师由此重申了BCD码的默认规则,以及二进制运算中进位处理的三种特殊情形。

第二部分进入新讲课“数字逻辑”(Digital Logic)。教师从“我们已经会用不同数制表示数字,现在要学习如何组合和运算这些数字”出发,引入逻辑门(logic gate)这一核心概念,说明复杂的数字系统都是由非常简单的逻辑门组合而成的。随后依次讲解NOT、AND、OR、NAND、NOR、XOR六个逻辑门,并介绍布尔代数的交换律、结合律、分配律,练习若干布尔恒等式化简,最后开始介绍德摩根定理(De Morgan’s theorem)。本节课只讲到德摩根定理的第一条形式,真值表、卡诺图等被列为本讲目标,但尚未展开详细内容。

主要内容

一、课前练习讲评:数制转换与二进制运算回顾

1. 第8题:十进制数转换为8421 BCD码

教师首先回顾了BCD编码的基本规则:要用BCD系统表示任意十进制数,就是把十进制数的每一位数字分别替换成相应的4位二进制码。每一位对应一个4位(nibble,半字节)的BCD码。

8421 BCD码的权值依次为8、4、2、1,因此每一位十进制数字都用四位按照8-4-2-1的权值编码。

课堂举的例子是十进制数14:

  • 十进制数字1转换为4位BCD:0001;
  • 十进制数字4转换为4位BCD:0100;
  • 所以14的8421 BCD表示为0001 0100。

这里的关键点是:BCD不是把整个十进制数一次性转换成二进制,而是“逐位数字分别编码”。例如14若按普通二进制整体转换是1110,但按BCD则是0001 0100,两者形式不同。

2. 第9题:BCD码转换为十进制数

第9题是反向操作:给出一个BCD数,要求转换成十进制数。教师特别指出,题目中并没有明确写出“8421 BCD”。但正如幻灯片中提到的,8421是最常用的BCD码,因此如果题目没有特别说明,就默认按8421 BCD处理。

转换方法是:把BCD数从右往左或从左往右每四位分成一组,每组按8、4、2、1的权值计算出对应的十进制数字,再把各数字依次写出来。

课堂以第9题(b)为例进行示范:将BCD数每四位分组,再逐组转换成对应的十进制数字。教师最后给出结果是十进制数346。材料中对该题具体BCD数字串的转录不够完整,但课堂结论为346。

3. 二进制加法的进位处理:何时保留、何时忽略

教师回顾二进制加减法时,提出了一个学生此前问过的问题:做二进制加法时到底要不要考虑进位?

课堂给出的结论是:只有三种情况需要“忽略进位”(disregard carries),其他情况都要像普通加法一样保留进位。

三种忽略进位的情况是:

  1. 求一个负数的二进制补码(two’s complement)时,忽略进位;
  2. 从二进制转换为格雷码(Gray code)时,忽略进位;
  3. 从格雷码转换为二进制时,忽略进位。

教师强调,这三种情况是课上明确讲过的“唯一三种忽略进位”的情形。除此之外,例如普通的二进制加法,就必须保留进位。

课堂举了一个直观例子:6加7等于13。如果做二进制加法时把进位丢掉,就可能得不到正确结果。因此普通加法不能忽略进位。

二、数字逻辑的引入:从数制表示到逻辑门

教师说明,前面课程已经学习了如何用不同数制表示数字;现在要进一步学习如何组合不同的数,以及如何对它们进行运算。这里引入一个非常重要的概念:逻辑门(logic gate)。

课堂中提出的基本逻辑是:

  • 加法可以看作一种逻辑门;
  • 乘法也可以看作一种逻辑门;
  • 这两种是非常简单的逻辑门;
  • 当多个逻辑门组合在一起时,就可以构成非常复杂的数字系统;
  • 所有复杂的数字系统,都是由非常简单的逻辑门组成的;
  • 每个逻辑门都有一个功能,这个功能可以用布尔逻辑(Boolean logic)来表示;
  • 不同的逻辑功能可以组合,例如把加法与乘法组合起来,得到不同的门。

教师进一步说明,布尔逻辑只作用于二进制变量(binary variables)。在数字电路中:

  • 如果输入是二进制1,表示该输入处于高电平(high level);
  • 如果输入是二进制0,表示该输入处于低电平(low level);
  • 输出的逻辑状态与输入的电平状态相对应:输入高,输出也高;输入低,输出也低。这是理解门电路输入输出关系的基础。

本节课列出的关键点是:

  1. 什么是逻辑符号(logical symbols);
  2. 如何在不同逻辑符号之间进行代数表达式运算;
  3. 什么是真值表(truth table);
  4. 卡诺图(Karnaugh map)的用途是什么。

其中,真值表和卡诺图在本节课中只是作为本讲目标提出,课堂尚未展开详细讲解。

三、基本逻辑门:NOT、AND、OR

1. NOT函数(非门)

NOT函数表示“取反”或“补运算”。表达式写法是在变量上方加一条横线,例如:

  • ¬A
  • A′

其逻辑功能是:

  • 如果变量A为1,则NOT A为0;
  • 如果变量A为0,则NOT A为1。

教师给出了简单的真值表:

A NOT A
0 1
1 0

NOT门的符号有两种常见画法:

  • 输入端后接一个三角形,输出端加一个小圆圈;
  • 或者用方形加输出端小圆圈。

其中三角形加小圆圈的画法最常用。输出端的小圆圈就是“取反”的含义,表示NOT函数。

教师强调,学生必须记住NOT函数的符号,因为最终可能需要绘制非常复杂的数字电路,而复杂数字电路就是由很多这样的小逻辑门组成的。

2. AND函数(与门)

AND函数表示逻辑“与”。A AND B可以写成:

  • AB
  • A·B

其逻辑功能是:

  • 只要A和B中有一个为0,输出就是0;
  • 只有当A和B都为1时,输出才是1。

真值表可表示为:

A B A AND B
0 0 0
0 1 0
1 0 0
1 1 1

AND门的符号有两种表示方式,其中左侧那种类似“D”形的符号最常用。

3. OR函数(或门)

OR函数表示逻辑“或”。A OR B可以重写为:

  • A + B

其逻辑功能是:

  • 只要A和B中有一个为1,最终输出就是1;
  • 只有当A和B都为0时,输出才是0。

真值表可表示为:

A B A OR B
0 0 0
0 1 1
1 0 1
1 1 1

OR门的符号也有两种,其中看起来像“月亮”或弯月形的符号最常用,与三角形和D形符号明显不同。

四、复合逻辑门:NAND、NOR、XOR

1. NAND函数(与非门)

NAND是“NOT AND”的缩写,即先做AND运算,再取反。表达式为:

  • ¬(AB)
  • (AB)′

其逻辑功能是:

  • 只要任一输入变量为0,最终输出就是1;
  • 只有当两个输入都为1时,输出才是0。

NAND的符号是:AND门的形状加上输出端的小圆圈。输出端圆圈代表NOT。

教师通过例子说明:

  • 输入中有0时,输出总是1;
  • 两个输入都为1时,输出为0。

2. NOR函数(或非门)

NOR是“NOT OR”的缩写,即先做OR运算,再取反。表达式为:

  • ¬(A + B)
  • (A + B)′

其逻辑功能是:

  • 只要任一输入为1,输出就是0;
  • 只有当所有输入都为0时,输出才是1。

NOR的符号是:OR门的形状加上输出端的小圆圈。

教师举了一个简单例子:当A为1、B为0时,A OR B为1;再取反后,NOR输出为0。

3. XOR函数(异或门)

XOR称为“异或”(exclusive OR)。教师给出的定义是:

A XOR B = (NOT A AND B) OR (A AND NOT B)

即:

A ⊕ B = (¬A ∧ B) ∨ (A ∧ ¬B)

其逻辑含义是:两个输入不同时输出为1,两个输入相同时输出为0。

XOR的真值表可表示为:

A B A XOR B
0 0 0
0 1 1
1 0 1
1 1 0

XOR的符号也常用一个方框来表示,课堂提到它与AND类似的“盒子”形状,并有一种最常用的画法。

至此,课堂共介绍了六个逻辑函数或逻辑门:

  1. NOT;
  2. AND;
  3. OR;
  4. NAND;
  5. NOR;
  6. XOR。

五、布尔代数的三条基本定律

教师介绍,由于两个变量之间存在六种运算,就需要相应的定律来规范这些运算。课堂重点讲了三条定律,并指出它们与数学中学过的定律非常相似。

1. 交换律(commutative law)

  • A OR B = B OR A;
  • A AND B = B AND A。

也就是说,两个变量的位置可以互换,顺序不影响结果。A可以在左边,B也可以在左边,结果相同。

2. 结合律(associative law)

对于OR运算:

  • (A OR B) OR C = A OR (B OR C)

对于AND运算:

  • (A AND B) AND C = A AND (B AND C)

也就是说,变量的分组方式不影响最终结果。先算B和C,再与A运算;或者先算A和B,再与C运算,结果相同。

3. 分配律(distributive law)

课堂给出的形式是:

  • A AND (B OR C) = (A AND B) OR (A AND C)

即单个变量A与“B OR C”的结果进行AND,等价于先分别把A与B、A与C做AND,再把两个结果OR起来。

教师还提到分配律的另一种形式:

  • (A OR B) AND (A OR C) = A OR (B AND C)

这说明分配律在布尔代数中可以有两种方向的用法,与普通代数中的分配律类似。

六、布尔恒等式与化简练习

课堂练习了若干布尔恒等式和化简,重点包括:

  • A AND A = A;
  • A AND NOT A = 0;
  • NOT(NOT A) = A,即双重取反等于原变量;
  • A OR (A AND B) = A。

对于A OR (A AND B) = A,教师用分配律解释:

A OR (A AND B) = A AND (1 OR B)

因为1 OR B = 1,所以:

A AND 1 = A

最终得到A。

课堂还出现了一条形如:

A OR (NOT A AND B)

的表达式。材料中教师现场的推导和字幕转录较混乱,但按照标准布尔代数,该式应化简为:

A OR (NOT A AND B) = A OR B

这一点需要结合标准规则复习,不能仅依赖材料中的转录文字。

教师多次询问学生是否有问题,学生未提出新的问题,课程继续。

七、德摩根定理(本节开始部分)

课堂最后开始介绍德摩根定理(De Morgan’s theorem)。教师讲到的第一条形式是“和的补”:

A OR B是“和”(sum),它的补是:

NOT(A OR B) = (NOT A) AND (NOT B)

即:

(A + B)′ = A′ · B′

教师解释:

  • “和的补”等于“各补的乘积”;
  • A的补就是NOT A;
  • 两个或多个变量的和的补,等于每个单独变量分别取补后再进行AND运算。

课堂在讲完这一部分后进入休息,德摩根定理的第二种形式,即“乘积的补等于各补之和”,在本节材料中尚未展开。

关键知识点与详细解释

  1. 8421 BCD的逐位编码规则
    BCD不是把整个十进制数一次性转换成二进制,而是把十进制数的每一位数字单独用4位二进制表示。8421表示这4位的权值分别为8、4、2、1。例如十进制14编码为0001 0100,而不是整体二进制1110。

  2. BCD默认采用8421
    如果题目没有明确说明BCD的具体类型,默认采用8421 BCD。原因是8421是最常用的BCD码。

  3. nibble(半字节)
    4位二进制数称为一个nibble。BCD编码中每一位十进制数字对应一个nibble。

  4. 二进制运算中忽略进位的三种情形
    只有以下三种情况忽略进位:求负数的二进制补码、二进制转格雷码、格雷码转二进制。其他情况,包括普通二进制加法,都要保留进位。6加7等于13,不能用丢掉进位的方式得到错误结果。

  5. 逻辑门是数字系统的基本构件
    逻辑门是对二进制变量进行逻辑运算的基本单元。加法、乘法等简单逻辑门可以组合成非常复杂的数字系统。每个门的功能都可以用布尔逻辑表达。

  6. 布尔逻辑只作用于二进制变量
    在数字电路中,二进制1对应高电平,二进制0对应低电平。门电路的输出逻辑状态与输入状态存在确定的对应关系。

  7. 六个基本逻辑门
    NOT:取反;AND:全1才1;OR:有1则1;NAND:NOT AND,有0则1;NOR:NOT OR,有1则0;XOR:不同为1,相同为0。

  8. 布尔代数的三条定律
    交换律:A OR B = B OR A,A AND B = B AND A。
    结合律:(A OR B) OR C = A OR (B OR C),(A AND B) AND C = A AND (B AND C)。
    分配律:A AND (B OR C) = (A AND B) OR (A AND C),以及(A OR B) AND (A OR C) = A OR (B AND C)。

  9. 常用布尔恒等式
    A AND A = A;A AND NOT A = 0;NOT(NOT A) = A;A OR (A AND B) = A。

  10. 德摩根定理的第一条形式
    (A OR B)的补 = (NOT A) AND (NOT B),即(A + B)′ = A′·B′。课堂只讲到这一条。

  11. 真值表与卡诺图
    教师把真值表和卡诺图列为本讲关键内容,但本节课尚未展开具体讲解。真值表用于列出所有输入组合及对应输出;卡诺图通常用于逻辑函数化简。

课堂示例与问题

  1. 十进制14转8421 BCD
    1 → 0001,4 → 0100,所以14 → 0001 0100。
    易错点:不要把它当成整体二进制转换,14的整体二进制是1110。

  2. 第9题BCD转十进制
    将BCD数每四位分组,按8-4-2-1权值转换为十进制数字,课堂示例最终得到346。
    易错点:题目未写8421时,默认按8421处理。

  3. 6+7=13的进位问题
    教师用这个例子说明普通二进制加法必须保留进位,不能忽略进位,否则结果会出错。

  4. NAND门输入含0时的输出
    只要有输入为0,NAND输出就是1;两个输入都为1时,输出为0。

  5. NOR门示例
    A=1,B=0时,A OR B=1,取反后NOR输出为0。

  6. 布尔恒等式练习
    A AND A = A;A AND NOT A = 0;NOT(NOT A) = A;A OR (A AND B) = A。教师用分配律和1 OR B = 1进行解释。

  7. 课堂问答
    教师多次问“Any questions?”。学生在此环节没有提出新的问题,教师继续讲解。此前有学生问过二进制加法是否考虑进位,教师在本次课中专门回答:只有三种情况忽略进位,其他情况保留进位。

AI 延伸解释

以下内容是为了帮助理解而补充,并非教师原话。

  1. 为什么BCD默认8421
    8421 BCD的权值与普通十进制位的“千、百、十、个”没有直接关系,它的四位权值就是8、4、2、1,因此每一位十进制数字0到9都可以用0000到1001表示。由于它直观、转换简单,所以成为最常用的BCD码。其他BCD码,如余3码、2421码等,也有各自规则,但在没有特别说明时通常默认8421。

  2. BCD与普通二进制的区别
    以14为例:

    • 普通二进制:14 = 1110;
    • 8421 BCD:14 = 0001 0100。
      两者数值相同,但编码结构不同。BCD适合直接显示十进制数字,例如数码管、计算器等场景。
  3. 三种忽略进位情形的理解

    • 求负数补码时,忽略最高位进位,是因为补码运算通常在固定位宽下进行,超出位宽的部分自然丢弃;
    • 二进制转格雷码时,最高位保留,其余位由相邻二进制位异或得到,不涉及普通加法进位;
    • 格雷码转二进制时,也按逐位异或或递推规则进行,同样不按普通加法处理进位。
      这些规则的具体推导可结合后续课程或教材中的例题进一步确认。
  4. 六个逻辑门的标准真值表
    NOT:0→1,1→0。
    AND:00→0,01→0,10→0,11→1。
    OR:00→0,01→1,10→1,11→1。
    NAND:00→1,01→1,10→1,11→0。
    NOR:00→1,01→0,10→0,11→0。
    XOR:00→0,01→1,10→1,11→0。

  5. XOR的常见性质
    A XOR 0 = A;A XOR 1 = NOT A;A XOR A = 0;A XOR NOT A = 1。XOR在加法器、奇偶校验和错误检测中非常常见。

  6. 德摩根定理的第二条形式
    课堂只讲了第一条。第二条是:
    NOT(A AND B) = (NOT A) OR (NOT B),即(AB)′ = A′ + B′。
    两条合起来可以概括为:取反后,AND与OR互换,变量分别取反。

  7. 卡诺图的用途
    卡诺图是一种把真值表按格雷码顺序排列成方格图的工具,用于化简布尔表达式。它通过把相邻为1的格子圈在一起,消去多余变量,得到更简单的逻辑表达式。具体方法需要后续课程展开。

  8. 高电平与低电平的实际电压
    在真实数字电路中,高电平和低电平不是抽象符号,而是电压范围。例如TTL电路通常以约5 V为高电平、0 V为低电平;CMOS电路则根据供电电压定义高低电平范围。具体阈值需参考器件手册。

英语术语学习表

English term 中文含义 课堂语境与用法 Example sentence
BCD 二-十进制编码 用4位二进制表示一位十进制数字 14 in 8421 BCD is 0001 0100.
8421 BCD 8421码 最常用的BCD码,权值为8、4、2、1 If the question does not specify, assume 8421 BCD.
nibble 半字节,4位二进制 每位十进制数字对应一个nibble Each decimal digit is represented by one nibble.
decimal number 十进制数 第8题要求把十进制数转换为BCD Convert the following decimal numbers to BCD.
binary number 二进制数 数字系统中的基本表示形式 Binary numbers use only 0 and 1.
Gray code 格雷码 二进制转格雷码时忽略进位 When converting binary to Gray code, disregard carries.
two’s complement 二进制补码 求负数补码时忽略进位 Computing the two’s complement of a negative number ignores the carry.
carry 进位 普通二进制加法要保留进位 Keep the carry in normal binary addition.
logic gate 逻辑门 数字系统的基本组成单元 All complex digital systems are made up of simple logic gates.
Boolean logic 布尔逻辑 用于表达逻辑门功能 Each gate has a function that can be expressed in Boolean logic.
binary variable 二进制变量 布尔逻辑只作用于二进制变量 Boolean logic only operates on binary variables.
high level 高电平 二进制1对应高电平 A binary 1 means the input has a high level.
low level 低电平 二进制0对应低电平 A binary 0 means the input has a low level.
NOT function 非函数,非门 对变量取反 The NOT function is the complement of the variable.
complement 补,取反 NOT运算也称为补运算 The complement of A is written as A′.
AND function 与函数,与门 全1才输出1 A AND B is written as AB.
OR function 或函数,或门 有1则输出1 A OR B can be rewritten as A + B.
NAND 与非门 NOT AND,先与后非 NAND outputs 1 if any input is 0.
NOR 或非门 NOT OR,先或后非 NOR is the combination of OR and NOT.
XOR 异或门 两个输入不同时输出1 A XOR B equals (NOT A AND B) OR (A AND NOT B).
truth table 真值表 列出所有输入组合及输出 The truth table shows all possible input combinations.
Karnaugh map 卡诺图 用于逻辑函数化简 The purpose of a Karnaugh map is to simplify logic expressions.
commutative law 交换律 A OR B = B OR A The commutative law allows us to switch the positions of variables.
associative law 结合律 分组方式不影响结果 The associative law applies to both OR and AND operations.
distributive law 分配律 A AND (B OR C) = (A AND B) OR (A AND C) We use the distributive law to simplify Boolean expressions.
De Morgan’s theorem 德摩根定理 和的补等于各补的乘积 De Morgan’s theorem states that (A + B)′ = A′B′.
digital circuit 数字电路 由逻辑门组成 A complex digital circuit consists of many small logic gates.
variable 变量 布尔代数中的输入量 The order of variables makes no difference in the commutative law.

复习提纲

一、数制与编码基础

  1. 能用自己的话解释什么是8421 BCD码。
  2. 能说明BCD编码为什么是“逐位编码”,而不是整体二进制转换。
  3. 能熟练完成十进制数到8421 BCD的转换,例如14、29、306等。
  4. 能熟练完成8421 BCD到十进制数的转换,注意每四位一组。
  5. 记住:题目没有说明BCD类型时,默认按8421 BCD处理。
  6. 理解nibble的含义:4位二进制数。

二、二进制运算与进位规则

  1. 能说出二进制加法中必须保留进位的普通情形。
  2. 能准确列出三种忽略进位的情形:
    • 求负数的二进制补码;
    • 二进制转格雷码;
    • 格雷码转二进制。
  3. 能用6+7=13的例子说明为什么普通加法不能丢掉进位。
  4. 能区分“普通二进制加法”和“补码运算”“格雷码转换”在进位处理上的不同。

三、逻辑门与布尔逻辑

  1. 能说明什么是逻辑门,以及逻辑门与复杂数字系统的关系。
  2. 能说明布尔逻辑只作用于二进制变量,二进制1对应高电平,二进制0对应低电平。
  3. 能画出并识别NOT、AND、OR、NAND、NOR、XOR的符号。
  4. 能写出六个逻辑门的表达式和真值表:
    • NOT:¬A;
    • AND:AB;
    • OR:A + B;
    • NAND:¬(AB);
    • NOR:¬(A + B);
    • XOR:¬A·B + A·¬B。
  5. 能解释NOT门符号中输出端小圆圈的含义。
  6. 能说明NAND和NOR分别是“先与后非”和“先或后非”。
  7. 能说明XOR的逻辑含义:不同为1,相同为0。

四、布尔代数定律与化简

  1. 能写出交换律,并说明变量位置可以互换。
  2. 能写出结合律,并说明变量分组方式不影响结果。
  3. 能写出分配律的两种常见形式:
    • A AND (B OR C) = (A AND B) OR (A AND C);
    • (A OR B) AND (A OR C) = A OR (B AND C)。
  4. 能熟练使用以下恒等式:
    • A AND A = A;
    • A AND NOT A = 0;
    • NOT(NOT A) = A;
    • A OR (A AND B) = A。
  5. 能理解A OR (A AND B) = A的推导过程:A AND (1 OR B) = A AND 1 = A。
  6. 能说出德摩根定理的第一条形式:(A + B)′ = A′·B′。
  7. 知道德摩根定理还有第二条形式,但本节课未展开: (AB)′ = A′ + B′。

五、核心问题与易错点

  1. BCD转换时,为什么不能把整个十进制数一次性转成二进制?
  2. 为什么题目没写8421时也可以默认8421?
  3. 二进制加法中,什么时候必须保留进位?什么时候可以忽略?
  4. NOT、AND、OR、NAND、NOR、XOR的真值表分别是什么?
  5. NAND和NOR的输出圆圈代表什么?
  6. 交换律、结合律、分配律在布尔代数中分别解决什么问题?
  7. 如何用分配律和1 OR B = 1推导A OR (A AND B) = A?
  8. 德摩根定理第一条如何用文字表述?
  9. 真值表和卡诺图分别有什么用途?本节课是否已经详细展开?

通过你的捐助帮助此项目持续运行

这个项目完全免费,赞助不是强制的,也不会影响任何功能的使用。实时转录会持续产生模型服务费用,软件开发和服务器维护也需要长期投入,由个人一直承担这些成本有些困难。如果这个项目对你有帮助,希望你愿意赞助一两块钱;不需要很多,大家的一点支持就足以让它运行很久。

支付宝

请使用支付宝扫码

微信

请使用微信扫码