bjq.vhdl
来自「主持人按开始抢答后」· VHDL 代码 · 共 57 行
VHDL
57 行
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity bjq is
port
(b1,b2,b3,clkin1:in std_logic;
bout:out std_logic);
end bjq;
architecture Behavioral of bjq is
signal num1:integer range 0 to 160;
signal num2:integer range 0 to 160;
signal num3:integer range 0 to 160;
signal bout1,bout2,bout3: std_logic;
begin
bout<=bout1 and bout2 and bout3 ;
process(b1,clkin1) is
begin
if b1='1' then
if rising_edge(clkin1) then
if num1/=0 then
num1<=num1-1;
bout1<='0';
else bout1<='1';
end if;
end if;
else bout1<='1';num1<=160;
end if;
end process;
process(b2,clkin1) is
begin
if b2='1' then
if rising_edge(clkin1) then
if num2/=0 then
num2<=num2-1;
bout2<='0';
else bout2<='1';
end if;
end if;
else bout2<='1';num2<=160;
end if;
end process;
process(b3,clkin1) is
begin
if b3='1' then
if rising_edge(clkin1) then
if num3/=0 then
num3<=num3-1;
bout3<='0';
else bout3<='1';
end if;
end if;
else bout3<='1';num3<=160;
end if;
end process;
end Behavioral;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?