综合资讯 技术文章 原文阅读 在线商城 下载专区 DATASHEET 技术论坛 商务频道

电子技术 | 技术资料 | 嵌入式系统 | 单片机专题 | DSP专题
EDA/PLD专题 | 电源技术专题 | 电子制作专题 | 其他综合 | 芯片选型

所在的位置:首页在线阅读EDA/PLD专题VHDL程序举例-组合逻辑正文
 
最高优先级编码器

-- Highest Priority Encoder
-- download from www.pld.com.cn & www.fpga.com.cn


LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
entity priority is
        port(I : in bit_vector(7 downto 0); --inputs to be prioritised
                A : out bit_vector(2 downto 0); --encoded output
                GS : out bit);  --group signal output
end priority;

architecture v1 of priority is
begin
        process(I)
        begin
                GS <= '1'; --set default outputs
                A <= "000";
                if I(7) = '1' then
                        A <= "111";
                elsif I(6) = '1' then
                        A <= "110";
                elsif I(5) = '1' then
                        A <= "101";
                elsif I(4) = '1' then
                        A <= "100";
                elsif I(3) = '1' then
                        A <= "011";
                elsif I(2) = '1' then
                        A <= "010";
                elsif I(1) = '1' then
                        A <= "001";
                elsif I(0) = '1' then
                        A <= "000";
                else
                        GS <= '0';
                end if;
        end process;    
end v1;

返回 上一页 下一页   信息发布:工号01   转引自: 【 】 【打印】 【关闭

关于我们 ┋ 友情链接


深圳市福田区海滨广场福业大厦12C
电话:0755-88305880 25960580 传真:0755-88305880
Copyright©2005-2007 无忧电子开发网版权所有

粤ICP备05064233号