select_food2.vhd
来自「这是一个自动售货机的vhdl源码」· VHDL 代码 · 共 34 行
VHD
34 行
library ieee;
use ieee.std_logic_1164.all;
entity select_food2 is
port(s_dog,s_ham,s_dham: in std_logic;
reset:in std_logic;
led_dog,led_ham,led_dham:out std_logic);
end select_food2;
ARCHITECTURE choice of select_food2 is
signal sel:std_logic_vector(2 downto 0);
begin
sel<=s_dog&s_ham&s_dham;
process(sel)
type data_out is array (0 to 2)of std_logic;
variable output:data_out;
begin
if reset='1' then
output:=('0','0','0');
else
case sel is
when"100"=>output:=('1','0','0');
when"010"=>output:=('0','1','0');
when"001"=>output:=('0','0','1');
when others=>output:=('0','0','0');
end case;
--else output:=('0','0','0');
end if;
led_dog<=output(0);
led_ham<=output(1);
led_dham<=output(2);
end process;
end choice;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?