使用多路复用器实现 5 变量函数
如果我有一个 5 变量函数(如下)并且我想使用多路复用器来实现它,我该怎么做(使用尽可能少的多路复用器):
f(A,B,C,D,E) = A + C'D + BD' + B'D + B'CE
这是家庭作业,所以不提供解决方案,只是提供指导这是如何运作的。
谢谢!
If I have a 5-variable function (below) and I want to implement it using a multiplexer, how would I do that (using the minimum possible multiplexer):
f(A,B,C,D,E) = A + C'D + BD' + B'D + B'CE
This is homework, so don't provide a solution, just a guidance of how that works.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
既然你明确提到
还有另一种方法,您只需要一个 2^(n-1) 输入多路复用器来实现输入功能(因此,在您的情况下,具有 2^4 个输入和 4 个选择输入的 MUX 将就够了)。这个想法是使用真值表的前 n-1 个输入作为 MUX 的选择输入,而其余一个则根据需要连接到数据输入以给出所需的结果。
由于我还无法发布图像,请参阅具体示例: https:// /www.dropbox.com/s/v8osbd8gtwhtfor/n-1inputmux.png
或者了解如何使用 MUX 实现简单逻辑门:https://www.dropbox.com/s/7cqbodha7lcoi9y/n-1inputmuxbasics.png
来源:
http://sifaka.uwaterloo.ca/~akenning/ course/ece124/
http://6004.mit.edu/
(我不能发布两个以上的真实链接......)
Since you explicitly mention
there's another way of doing it in which you only need a 2^(n-1) input multiplexer to implement a n input function (so, in your case, a MUX with 2^4 inputs and 4 select inputs would suffice). The idea is to use the first n-1 inputs of the truth table as select inputs for the MUX while the remaining one is connected to the data inputs as appropriate to give the desired result.
Since I can't post images yet, see this for a concrete example: https://www.dropbox.com/s/v8osbd8gtwhtfor/n-1inputmux.png
Or for how to implement simple logic gates with MUXes: https://www.dropbox.com/s/7cqbodha7lcoi9y/n-1inputmuxbasics.png
Sources:
http:// sifaka.uwaterloo.ca/~akenning/courses/ece124/
http:// 6004.mit.edu/
(I can't post more than two real links...)
Fanhoso 和 Ignacio Vazquez-Abrams 通过的答案已经过时或完全无用。
f(A,B,C,D,E) = A + C'D + BD' + B'D + B'CE
出现次数最多的变量将成为选择器输入,如下所示以最有效的方式使用它们(否则,必要的门的数量将会增加)。因此在本例中它将是 AE|BCD(其中 BCD 形式为选择器输入)。
f(A,B,C,D,E) = Σ{ 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16, 17 , 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }
按照新的变量顺序对最小项(以二进制形式)进行排序:
例如,选择器输入线上的 001 传输到数据输入线上的输入号 1。从00|001 (2),可以获得其他数字,即01|001 (3)。
开始绘制方案之前的最后一件事是定义如何将信号 AE 与数据输入线连接,这意味着我们需要知道获得所需输出需要哪些门。在此示例中,输入行 1 包含:
<前><代码> (2) 00010 -> 00|001|
(3)00011→ 01|001|
因此,有必要将 A'(E 表示“不关心”)与数据输入行号 1 连接。当然,一旦您将所有小项正确分组。
The answers passed by Fanhoso and Ignacio Vazquez-Abrams are outdated or totally useless.
f(A,B,C,D,E) = A + C'D + BD' + B'D + B'CE
The variables that appear the most, will become selector inputs, as this way they're used in the most efficient way (otherwise, the amount of necessary gates would increase). So in this case it'll be AE|BCD (where BCD form SELECTOR INPUTS).
f(A,B,C,D,E) = Σ{ 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }
Sort the minterms (in binary form), in the new variables order:
For example 001 on the selector inputs line transfers to input number 1 on the data input line. From 00|001 (2), it's possible to obtain other numbers i.e. 01|001 (3).
The last thing before starting to draw a scheme, is to define how to connect signals AE with data input lines, meaning we need to know which gates are necessary to obtain desired outputs. In this example the input line 1 consists of:
So it's necessary to connect A' (E is "don't care") with the data input line number 1. Of course, the combination in your case will be totally different, once you group properly all the minterms.
Ignacio 接受的答案是错误的,因为当 4x1 MUX 就足够时,它需要 32x1 MUX。
使用 MUX 实现 5 变量函数的算法类似于4 变量函数的算法:
电路真值表 真值表
f = (a ∨ ((Øc ∧ d) ∨ ((b ∧ Ød) ∨ ((Øb ∧ d) ∨ (Øb ∧ (c ∧ e)))))):
对于第 0、1、4、14、15 行,
F
为 false。您可以使用如下所示的真值表生成器 一个来验证真值表是否正确。
K-map
选择多路复用器
需要 4x1 MUX。选择行将为
a
和b
。 4x1 MUX 的真值表如下:我们需要表达函数
f0
、f1
、f2
、f3 表示为
c
、d
、e
。这是使用 k-map 分组来完成的(在下一节中)。最小化 k-map
分组仅按行进行。
f0 = ((Øa ∧ (Øb ∧ d)) ∨ (Øa ∧ (Øb ∧ (c ∧ e))))
f1 = ((Øa ∧ (b ∧ Ød)) ∨ (Øa ∧ (b ∧ Øc)))
f2 = (a ∧ Øb)
f3 = (a ∧ b)
电路
子
电路
f0
f1
f2
f3
主电路
真值表验证
最终电路的真值表由 logisim (电路模拟器)是:
这与我们之前找到的真值表。这说明电路是正确的。
您可以在此处访问 logisim 电路。
Accepted answer by Ignacio is wrong because it requires a 32x1 MUX when a 4x1 MUX suffices.
The algorithm to implement a 5-variable function using MUX is similar to the algorithm for a 4-variable function:
Truth table
The truth table for
f = (a ∨ ((¬c ∧ d) ∨ ((b ∧ ¬d) ∨ ((¬b ∧ d) ∨ (¬b ∧ (c ∧ e))))))
:F
is false for rows 0, 1, 4, 14, 15.You can use a truth table generator like this one to verify that the truth table is correct.
K-map
Choosing multiplexer
A 4x1 MUX is required. The select lines will be
a
andb
. The truth table for the 4x1 MUX is as follows:We need to express the functions
f0
,f1
,f2
,f3
in terms ofc
,d
,e
. This is done using k-map groupings (in the next section).Minimizing k-map
The groupings are done only row-wise.
f0 = ((¬a ∧ (¬b ∧ d)) ∨ (¬a ∧ (¬b ∧ (c ∧ e))))
f1 = ((¬a ∧ (b ∧ ¬d)) ∨ (¬a ∧ (b ∧ ¬c)))
f2 = (a ∧ ¬b)
f3 = (a ∧ b)
Circuit
Subcircuits
f0
f1
f2
f3
Main circuit
Truth table verification
The truth table of the final circuit as computed by logisim (a circuit simulator) is:
This is exactly the same as the truth table that we found earlier. This means that the circuit is correct.
The logisim circuit can be accessed here.
5 个变量表示 2**5 (32) 个输入多路复用器,输入为 0 到 31。将这些项转换为二进制数并将相应的输入保持为高电平。对于
B'CE
我们有:这给了我们 4 个数字,因为我们有 2 个不关心的数字。这四个数字是:
将输入 5、7、21 和 23 保持为高电平。
对其余术语重复上述操作。
5 variables means a 2**5 (32) input multiplexer, with inputs 0 through 31. Convert the terms into binary numbers and hold the corresponding inputs high. For
B'CE
we have:This gives us 4 numbers, since we have 2 don't cares. The four numbers are:
Hold inputs 5, 7, 21, and 23 high.
Repeat for the rest of the terms.