Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Logic 全加器门_Logic - Fatal编程技术网

Logic 全加器门

Logic 全加器门,logic,Logic,我不知道这个问题是否被认为与stackoverflow有关(如果不是,我很抱歉,但我已经搜索过了,在任何地方都没有找到答案) 我编写了一个全加器 输出: Truth Table : a1 a2 b1 b2 S1 S2 C ______________________________ 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0

我不知道这个问题是否被认为与stackoverflow有关(如果不是,我很抱歉,但我已经搜索过了,在任何地方都没有找到答案)

我编写了一个全加器

输出:

Truth Table : 

a1  a2   b1   b2   S1   S2   C
______________________________
0   0    0    0    0    0    0
0   0    0    1    0    1    0
0   0    1    0    1    0    0
0   0    1    1    1    1    0
0   1    0    0    0    1    0
0   1    0    1    0    0    1
0   1    1    0    1    1    0
0   1    1    1    1    0    1
1   0    0    0    1    0    0
1   0    0    1    1    1    0
1   0    1    0    0    1    0
1   0    1    1    0    0    1
1   1    0    0    1    1    0
1   1    0    1    1    0    1
1   1    1    0    0    0    1
1   1    1    1    0    1    1

如果有人计算过,他们能告诉我我的输出是否正确吗?这是一个加法器!只要检查它是否正在添加。让我们看这一排:

 a2 a1     b2 b1     C S2 S2 
  1  0      1  1     1  0  1 
在这里,我以一种更易于阅读的方式对列进行了重新排序:首先是高阶位

a
输入为10=2(基数为10)。
b
输入为11=3(基数为10)。输出为101,即 是5(以10为基数)。所以这个是对的:2+3==5

我让你检查一下其他几排

a1  a2   b1   b2   S1   S2   C   a  b  s  c
______________________________
0   0    0    0    0    0    0   0  0  0  0 nothing plus nothing is nothing
0   0    0    1    0    1    0   0  2  2  0 nothing plus two is two
0   0    1    0    1    0    0   0  1  1  0 nothing plus one is one
0   0    1    1    1    1    0   0  3  3  0 nothing plus three is three
0   1    0    0    0    1    0   2  0  2  0 two plus nothing is two
0   1    0    1    0    0    1   2  2  0  1 two plus two is four (four not in 0-3)
0   1    1    0    1    1    0   2  1  3  0 two plus 1 is three
0   1    1    1    1    0    1   2  3  1  1 two plus three is five (one and four)  
1   0    0    0    1    0    0   1  0  1  0 one plus nothing is one
1   0    0    1    1    1    0   1  2  3  0 one plus two is three
1   0    1    0    0    1    0   1  1  2  0 one plus one is two
1   0    1    1    0    0    1   1  3  0  1 one plus three is four
1   1    0    0    1    1    0   3  0  3  0 three plus nothing is three
1   1    0    1    1    0    1   3  2  1  1 three plus two is five (one and four)
1   1    1    0    0    0    1   3  1  0  1 three plus one is four
1   1    1    1    0    1    1   3  3  2  1 three plus three is 6 (two and four)

看起来不错。对16行进行稍微不同的排序将使它们以更合理的顺序流动。

我在谷歌上搜索了“全加真值表”,结果铺天盖地。表面上看,它看起来是正确的。当然,这有点令人困惑,因为从正常编号的角度来看,表格是“颠倒的”,但这可能是呈现真值表格的最佳方式(尽管我为NASA设计了集成电路,但我只做过半打次)。我能以某种方式手动测试它吗?对于这个问题,可能是一个更好的网站。当然你可以测试它。把两个带开关和灯的全加器连接在一起,然后去做。我不知道你是怎么得到6部分的,很抱歉我错过了你把列顺序倒排的机会。现在修好了。谢谢,很多。但是为什么它会好起来呢?如果你先做高阶位,而不是别的?因为数字就是这样写的。在23中,最高顺序的数字是2(不是3)。现在,行是按位顺序(a1、a2、b1、b2)驱动的,结果是A的组合值表示为0,2,1,3,而不是0,1,2,3。这并不影响答案的正确性。