⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 number.vhd

📁 VGA彩色信号控制器设计:用VHDL语言编写程序
💻 VHD
字号:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity number is
 port(vs_in,clk,rset : in std_logic;
      hcnt_in,vcnt_in : in std_logic_vector(9 downto 0);
      q : out std_logic_vector(2 downto 0));
end entity number;
architecture one of number is
signal full : std_logic;
signal cnt : integer range 0 to 9;
signal q0,q1,q2,q3,q4,q5,q6,q7,q8,q9 : std_logic_vector(2 downto 0);
begin



process(vs_in)
variable cc : integer range 0 to 30;
begin
if vs_in'event and vs_in ='0' then
   if cc=30 then
      cc:=0;
      full<='1';
    else cc:=cc+1;
         full<='0';
    end if;
end if;
end process;
process(clk,rset,full)
begin
if full'event and full ='1' then
   if rset='0' then cnt<=0;
   elsif cnt=9 then
      cnt<=0;
    else cnt<=cnt+1;
   end if;
end if;
end process;
process(clk,cnt,q0,q1,q2,q3,q4,q5,q6,q7,q8,q9)
begin
if clk'event and clk='1' then
case cnt is
 when 0 => q <=q0;
 when 1 => q <=q1;
 when 2 => q <=q2;
 when 3 => q <=q3;
 when 4 => q <=q4;
 when 5 => q <=q5;
 when 6 => q <=q6;
 when 7 => q <=q7;
 when 8 => q <=q8;
 when 9 => q <=q9;
 when others=>null;
end case;
end if;
end process;
process(clk,hcnt_in,vcnt_in)
begin
if clk'event and clk='1' then
  if ((hcnt_in>=200 and hcnt_in<500)and(vcnt_in>=100 and vcnt_in<500)and(not((hcnt_in>=250 and hcnt_in<450)and(vcnt_in>=150 and vcnt_in<450))))
   then q0<="111";
  else q0<="000";
  end if;
end if;
end process;
process(clk,hcnt_in,vcnt_in)
begin
if clk'event and clk='1' then
  if ((hcnt_in>=450 and hcnt_in<500)and(vcnt_in>=100 and vcnt_in<500))
   then q1<="110";
  else q1<="000";
  end if;
end if;
end process;
process(clk,hcnt_in,vcnt_in)
begin
if clk'event and clk='1' then
  if ((hcnt_in>=200 and hcnt_in<500)and(vcnt_in>=100 and vcnt_in<500)and(not((hcnt_in>=200 and hcnt_in<450)and(vcnt_in>=150 and vcnt_in<275)))and(not((hcnt_in>=250 and hcnt_in<500)and(vcnt_in>=325 and vcnt_in<450))))
   then q2<="101";
  else q2<="000";
  end if;
end if;
end process;
process(clk,hcnt_in,vcnt_in)
begin
if clk'event and clk='1' then
  if ((hcnt_in>=200 and hcnt_in<500)and(vcnt_in>=100 and vcnt_in<500)and(not((hcnt_in>=200 and hcnt_in<450)and(vcnt_in>=150 and vcnt_in<275)))and(not((hcnt_in>=200 and hcnt_in<450)and(vcnt_in>=325 and vcnt_in<450))))
   then q3<="100";
  else q3<="000";
  end if;
end if;
end process;
process(clk,hcnt_in,vcnt_in)
begin
if clk'event and clk='1' then
  if ((hcnt_in>=200 and hcnt_in<500)and(vcnt_in>=100 and vcnt_in<500)and(not((hcnt_in>=250 and hcnt_in<450)and(vcnt_in>=100 and vcnt_in<275)))and(not((hcnt_in>=200 and hcnt_in<450)and(vcnt_in>=325 and vcnt_in<500))))
   then q4<="011";
  else q4<="000";
  end if;
end if;
end process;
process(clk,hcnt_in,vcnt_in)
begin
if clk'event and clk='1' then
  if ((hcnt_in>=200 and hcnt_in<500)and(vcnt_in>=100 and vcnt_in<500)and(not((hcnt_in>=225 and hcnt_in<500)and(vcnt_in>=150 and vcnt_in<275)))and(not((hcnt_in>=200 and hcnt_in<450)and(vcnt_in>=325 and vcnt_in<450))))
   then q5<="010";
  else q5<="000";
  end if;
end if;
end process;
process(clk,hcnt_in,vcnt_in)
begin
if clk'event and clk='1' then
  if ((hcnt_in>=200 and hcnt_in<500)and(vcnt_in>=100 and vcnt_in<500)and(not((hcnt_in>=250 and hcnt_in<500)and(vcnt_in>=150 and vcnt_in<275)))and(not((hcnt_in>=250 and hcnt_in<450)and(vcnt_in>=325 and vcnt_in<450))))
   then q6<="001";
  else q6<="000";
  end if;
end if;
end process;
process(clk,hcnt_in,vcnt_in)
begin
if clk'event and clk='1' then
  if ((hcnt_in>=200 and hcnt_in<500)and(vcnt_in>=100 and vcnt_in<500)and(not((hcnt_in>=200 and hcnt_in<450)and(vcnt_in>=150 and vcnt_in<500))))
   then q7<="111";
  else q7<="000";
  end if;
end if;
end process;
process(clk,hcnt_in,vcnt_in)
begin
if clk'event and clk='1' then
  if ((hcnt_in>=200 and hcnt_in<500)and(vcnt_in>=100 and vcnt_in<500)and(not((hcnt_in>=250 and hcnt_in<450)and(vcnt_in>=150 and vcnt_in<275)))and(not((hcnt_in>=250 and hcnt_in<450)and(vcnt_in>=325 and vcnt_in<450))))
   then q8<="110";
  else q8<="000";
  end if;
end if;
end process;
process(clk,hcnt_in,vcnt_in)
begin
if clk'event and clk='1' then
  if ((hcnt_in>=200 and hcnt_in<500)and(vcnt_in>=100 and vcnt_in<500)and(not((hcnt_in>=250 and hcnt_in<450)and(vcnt_in>=150 and vcnt_in<275)))and(not((hcnt_in>=200 and hcnt_in<450)and(vcnt_in>=325 and vcnt_in<450))))
   then q9<="101";
  else q9<="000";
  end if;
end if;
end process;
end architecture one;











⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -