为什么我选择的信号分配不起作用? [英] Why does my selected signal assignment not work?
问题描述
我在 VHDL
代码中选择的信号分配有什么问题?
What did I do wrong with the selected signal assignment in my VHDL
code?
with s select x <= a when (s = '1')
else y <= a when (s = '0');
我也试过这个:
with s select x <= a when '1';
with s select y <= a when '0';
推荐答案
您想做什么并不完全清楚.从您向我们展示的内容来看,在我看来,您想创建一个由信号 s(1 个输入,2 个输出)控制的解复用器,其中 x <= a when s='1' 和 y <= a when s='0'
It's not completly clear what you want to do. From what you showed us, it seems to me that you want to create a demux controlled by signal s (1 input, 2 outputs), where x <= a when s='1' and y <= a when s='0'
在您想要创建多路复用器(n 个输入,1 个输出)的情况下,应该使用 select.也就是说,与解复用器相反!
The use of select should be done in cases when you want to create a mux (n inputs, 1 output). That is, the opposite of a demux!
我建议您使用简单的 if 语句来创建多路分配器.
I would recommend you to use a simple if statement to create a demux.
示例:
if s='1' then x <= a;否则 y <= a;结束如果;
这篇关于为什么我选择的信号分配不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!