求(EDA)一个七人表决器的程序

用VHDL语言编写
2025-02-23 20:45:32
推荐回答(1个)
回答1:

库和实体简单 就不给你写了 实体名叫biaojue 输入是7位的名叫biaojue 输出一位q
architecture a of biaojue
signal tmp:std_logic_vector(2 downto 0);
tmp<="000";
begin
tmp<=tmp+biaojue(0);
tmp<=tmp+biaojue(1);
tmp<=tmp+biaojue(2);
tmp<=tmp+biaojue(3);
tmp<=tmp+biaojue(4);
tmp<=tmp+biaojue(5);
tmp<=tmp+biaojue(6);
tmp<=tmp+biaojue(7);
process cmp(tmp)
q<=0;
if tmp>3 then
q<='1';
endif;
end process;
end a