七人表决器VHDL代码

**

七人表决器VHDL代码

library ieee;
use ieee.std_logic_1164.all;
entity voter7777 is
port( vote:in std_logic_vector(6 downto 0);
pass:out std_logic );
end;
architecture a of voter7777 is
begin
process (vote)
variable cont:integer range 0 to 7;
begin
cont:=0;
for i in 6 downto 0 loop
if vote(i)='1’then
cont:=cont+1;
end if;
end loop;
if cont>3 then
pass<=‘1’;
else
pass<=‘0’;
end if;
end process;
end a;

**

运行

**
七人表决器VHDL代码_第1张图片

你可能感兴趣的:(七人表决器VHDL代码)