3-8 线译码器模块
3-8 线译码器模块DECODER3_8 如图1.6 所示。DECODER3_8 模块的输入端是A[2..0]接收时钟脉冲计数器CN8 模块的输出信号,经过译码后输出信号Q[7..0]分别接八个数码管的阴极Vss7、Vss6、Vss5、Vss4、Vss3、Vss2、Vss1、Vss0,使对应的数码管的阴极为低电平,对应的数码管被点亮。要显示八位数字,需要八个输出端,所以做成3-8 线译码器。
图 1.6 3-8 线译码器模块DECODER3_8
library ieee;
use ieee.std_logic_1164.all;
entity decoder3_8 is
port(a:in std_logic_vector(2 downto 0);
qut std_logic_vector(7 downto 0));
end decoder3_8;
architecture rtl of decoder3_8 is
begin
process(a)
begin
case a is
when "000"=>q<="11111110";
when "001"=>q<="11111101";
when "010"=>q<="11111011";
when "011"=>q<="11110111";
when "100"=>q<="11101111";
when "101"=>q<="11011111";
when "110"=>q<="10111111";
when others=>q<="01111111";
end case;
end process;
end rtl;