8~3优先编码器的VHDL程序怎么写

[复制链接]
4893|2
 楼主| 81eightone 发表于 2009-3-22 07:31 | 显示全部楼层 |阅读模式
2009上道的 发表于 2009-9-23 14:13 | 显示全部楼层
library ieee;
use ieee.std_logic_1164.all;
entity coder is
port(din:in std_logic_vector(0 to 7);
        output:out std_logic_vector(0 to 2)):
end coder;
architecture behav of coder is
signal sint:std_logic_vector(4 downto 0);
begin
process(din)
begin
   if (din(7)='0') then output<="000";
   elsif(din(6)='0') then output<="100";
   elsif(din(5)='0') then output<="010";
   elsif(din(4)='0') then ouput<="110";
   elsif(din(3)='0') then output<="001";
   elsif(din(2)='0') then output<="101";
   elsif(din(1)='0') then output<="011";
   else output<="111";
end if;
end process;
end behav;
2009上道的 发表于 2009-9-23 14:14 | 显示全部楼层
输出端口那里打错了,你自己改改
您需要登录后才可以回帖 登录 | 注册

本版积分规则

21

主题

75

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部