用vhdl设计一个三位数码管动态显示控制电路 怎么做!!!

2024-12-12 11:52:23
推荐回答(1个)
回答1:

下面是74LS49的VHDL描述,74LS49就是一个驱动共阴极数码管的译码器:
LIBRARY IEEE;
USE IEEE.Std_logic_1164.ALL;
ENTITY ls49 IS
PORT(bl_n:IN Std_logic;
bi:IN Std_logic_vector(3 DOWNTO 0);
a,b,c,d,e,f,g:OUT Std_logic);
END ls49;
ARCHITECTURE behave_49 OF ls49 IS
SIGNAL s:Std_logic_vector(6 DOWNTO 0);
BEGIN
PROCESS(bi,bl_n)
BEGIN
IF bl_n = ′0′ THEN
s ′0′);
ELSE
CASE bi IS
WHEN ″0000″ => s <= B″011_1111″;
WHEN ″0001″ => s <= B″000_0110″;
WHEN ″0010″ => s <= B″101_1011″;
WHEN ″0011″ => s <= B″100_1111″;
WHEN ″0100″ => s <= B″110_0110″;
WHEN ″0101″ => s <= B″110_1101″;
WHEN ″0110″ => s <= B″111_1101″;
WHEN ″0111″ => s <= B″010_0111″;
WHEN ″1000″ => s <= B″111_1111″;
WHEN ″1001″ => s <= B″110_1111″;
WHEN ″1010″ => s <= B″101_1000″;
WHEN ″1011″ => s <= B″100_1100″;
WHEN ″1100″ => s <= B″110_0010″;
WHEN ″1101″ => s <= B″111_1001″;
WHEN ″1110″ => s <= B″111_1000″;
WHEN ″1111″ => s <= B″000_0000″; -- 熄灭
WHENOTHERS=> s ′0′); -- 熄灭
END CASE;
END IF;
END PROCESS;
a <= s(0);
b <= s(1);
c <= s(2);
d <= s(3);
e <= s(4);
f <= s(5);
g <= s(6);
END behave_49;
Serial Port