Ideas for a flexible/generic decoder in VHDL

眉间皱痕 提交于 2019-12-05 04:46:29

Apparently you want the input to be the index of the output bit that should be set.

Write it like that. Something like (assuming types from numeric_std):

output <= (others => '0'); -- default
output(to_integer(input)) <= '1';

I have always found this sort of thing easier to follow when you just loop over each bit, so something like:

     if ( rst = '1') then
       output <= (others=>'0');
     else
       for i in 0 to (2**C_INPUT_SIZE)-1 generate
       begin
         if (i = conv_integer(input)) then
           output(i) <= '1';
         else
           output(i) <= '0';
         end if;
       end generate;
     end if;
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!