七选一表决器 显示同意不同意七选一表决器 显示同意不同意
表决器
Library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith;
entity bjq7 is
port(input1,input2:in std_logic_vector(6 downto 0);
en,clr:in std_logic;
c1,c2,c3:out std_logic_vector(2 downto 0)); end;...
七选一
决器 显示同意不同意
表决器
Library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith;
entity bjq7 is
port(input1,input2:in std_logic_vector(6 downto 0);
en,clr:in std_logic;
c1,c2,c3:out std_logic_vector(2 downto 0)); end;
architecture one of bjq7 is
begin
process(input1,input2,en,clr)
variable cnt1,cnt2,cnt3:std_logic_vector (2 downto 0);
begin
cnt1:="000";cnt2:="000";cnt3:="000";
if(clr='0')then
cnt1:="000";cnt2:="000";cnt3:="000";
elsif(en='1')then
for i in 6 downto 0 loop
if input1(i)='0' and input2(i)='1' then
cnt1:=cnt1+1;
elsif input1(i)='1' and input2(i)='0' then
cnt2:=cnt2+1;
elsif input1(i)='1' and input2(i)='1' then
cnt3:=cnt3+1;
end if;
end loop;
end if;
c1<= cnt1;
c2<= cnt2;
c3<= cnt3;
end process;
end;
BCD七段译码器
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY bcd7 IS
PORT (A :IN STD_LOGIC_VECTOR(2 DOWNTO 0);
Y :OUT STD_LOGIC_VECTOR(6 DOWNTO 0));
END ENTITY bcd7;
ARCHITECTURE one OF bcd7 IS
BEGIN
PROCESS (A)
BEGIN
IF
A="0000" THEN Y<="1111110"; ELSIF A="0001" THEN Y<="0110000"; ELSIF A="0010" THEN Y<="1101101"; ELSIF A="0011" THEN Y<="1111001"; ELSIF A="0100" THEN Y<="0110011"; ELSIF A="0101" THEN Y<="1011011"; ELSIF A="0110" THEN Y<="0011111"; ELSIF A="0111" THEN Y<="1110000"; ELSE Y<="0000000";
END IF;
END PROCESS;
END ;
计数器
library ieee;
use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity cnt3 is
port(clk2:in std_logic;
sel:out std_logic_vector (2 downto 0));
end;
architecture one of cnt3 is signal cnt:std_logic_vector (2 downto 0);
begin
sel<=cnt;
process(clk2)
begin
if clk2'event and clk2='1' then
if (cnt="101") then cnt<="000";
else
cnt<=cnt+2;
end if;
end if;
end process;
end;
三选一
library ieee;
use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity mux31 is
port( A:in std_logic_vector(2 downto 0);
B:in std_logic_vector(2 downto 0);
C:in std_logic_vector(2 downto 0);
s:in std_logic_vector(2 downto 0);
y: out std_logic_vector(2 downto 0);
co2,co1:out std_logic);
end;
architecture one of mux31 is
begin
y<=C when s="000" else
B when s="010" else
A when s="100";
process(A,B,C)
begin
if(A>B) then
co1<='1' ;co2<='0';
else
co1<='0';co2<='1';
end if;
end process;
end ;
本文档为【七选一表决器 显示同意不同意】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。