Why does my selected signal assignment not work?

2019-08-29 13:02发布

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');

I also tried this:

with s select x <= a when '1';
with s select y <= a when '0';

标签: vhdl vivado
1条回答
劳资没心,怎么记你
2楼-- · 2019-08-29 13:42

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'

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!

I would recommend you to use a simple if statement to create a demux.

Example:

if s='1' then x <= a; else y <= a; end if;

查看更多
登录 后发表回答