正文

38译码器的几种描述方法2007-10-26 20:21:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/yanyoushuai/30508.html

分享到:

library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity decoder38 is port (Q0: out std_logic_vector(7 downto 0);   Q1: in std_logic_vector(2 downto 0);   en: in std_logic);end entity decoder38;-----the num.1 method to descriptarchitecture code1 of decoder38 is begin process(Q1,en) variable temp : std_logic_vector(7 downto 0); begin  if en = '1' then temp := "ZZZZZZZZ";---"en" is effective on low voltage;   else    case Q1 is     when "000" => temp := "00000001";     when "001" => temp := "00000010";     when "010" => temp := "00000100";     when "011" => temp := "00001000";     when "100" => temp := "00010000";     when "101" => temp := "00100000";     when "110" => temp := "01000000";     when "111" => temp := "10000000";    end case;  end if;  Q0 <= temp; end process;end architecture code1; ----the num.2 method to descriptarchitecture code2 of decoder38 is begin process(Q1,en)  variable temp : std_logic_vector(7 downto 0);  begin  if en = '1' then temp := "ZZZZZZZZ";   else     temp(0) := (not Q1(2)) and (not Q1(1)) and (not Q1(0));    temp(1) := (not Q1(2)) and (not Q1(1)) and Q1(0);    temp(2) := (not Q1(2)) and  Q1(1) and (not Q1(0));    temp(3) := (not Q1(2)) and  Q1(1) and Q1(0);    temp(4) := Q1(2) and (not Q1(1)) and (not Q1(0));    temp(5) := Q1(2) and (not Q1(1)) and Q1(0);    temp(6) := Q1(2) and Q1(1) and (not Q1(0));    temp(7) := Q1(2) and Q1(1) and Q1(0);  end if; Q0 <= temp; end process;end architecture code2; ----the num.3 mothed to descriptarchitecture code3 of decoder38 is begin  process(Q1,en)   variable temp : std_logic_vector(7 downto 0);   begin   if (en = '1') then temp := "ZZZZZZZZ";    elsif (Q1 = "000") then temp := "00000001";    elsif (Q1 = "001") then temp := "00000010";    elsif (Q1 = "010") then temp := "00000100";    elsif (Q1 = "011") then temp := "00001000";    elsif (Q1 = "100") then temp := "00010000";    elsif (Q1 = "101") then temp := "00100000";    elsif (Q1 = "110") then temp := "01000000";         else temp := "10000000";   end if;   Q0 <= temp;  end process;end architecture code3; ----use the configuration statement to select architectureconfiguration conf1 of decoder38 is for code3 end for;end configuration conf1;

阅读(6939) | 评论(0)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

暂无评论
您需要登录后才能评论,请 登录 或者 注册