thg_fly 发表于 2011-5-28 15:21:19

求VHDL的流水灯程序!!!!!!

求VHDL的流水灯程序!!!!!!

fpgaw 发表于 2011-5-31 08:32:13

跑马灯?

porereading 发表于 2011-6-2 21:18:45

邮箱?   qq:956693281

栗子 发表于 2011-7-18 09:56:39

--***************************************************************
--流水灯
--a1,a2,a3,a4,a5,a6,a7,a8代表8个灯
--控制8个灯的循环点亮,q1对时钟的上升沿计数 ,q1的变化对应8个灯的状态

--****************************************************************
library ieee;
use ieee.std_logic_1164.all;   
--use ieee.std_logic_signed.all;
use ieee.std_logic_unsigned.all;
--use ieee.std_logic_arith.all;

entity lxd is
port (
      --reset: in std_logic;--系统复位信号
          clk:in std_logic; --1hz时钟信号
       a1,a2,a3,a4,a5,a6,a7,a8: out std_logic);
end lxd;
architecture bhv of lxd is
signal q: std_logic ;
signal q1: std_logic_vector(3 downto 0);       

signal c: std_logic_vector(7 downto 0);       
signal clk1: std_logic;
begin
process(clk)--对系统时钟3000000分频;
   variable cnt:integer range 0 to 30000000 ;
   variable q: std_logic;

begin
if clk'event and clk='1'then
if cnt =29999999 then
cnt:=0 ; q:='1';
   else
    cnt:=cnt+1; q:='0';
end if;
endif;
clk1<=q;
end process;



process(clk)   --------控制灯显示,q1对时钟的上升沿计数         
begin
if clk'event and clk='1'then
if q1 ="1111" then q1<="0000";
else q1<=q1+1;
end if;
end if;
end process;

process(q1)
begin
case q1 is
when "0000" =>c<="01111111";
when "0001" =>c<="10111111";
when "0010" =>c<="11011111";
when "0011" =>c<="11101111";
when "0100" =>c<="11110111";
when "0101" =>c<="11111011";
when "0110" =>c<="11111101";
when "0111" =>c<="11111110";
when "1000" =>c<="11111110";
when "1001" =>c<="11111101";
when "1010" =>c<="11111011";
when "1011" =>c<="11110111";
when "1100" =>c<="11101111";
when "1101" =>c<="11011111";
when "1110" =>c<="10111111";
when "1111" =>c<="01111111";
when others =>c<="11111111";
end case;
a1<=c(0);a2<=c(1);a3<=c(2);a4<=c(3);a5<=c(4);a6<=c(5);a7<=c(6);a8<=c(7);
end process;
end bhv;

蓝余 发表于 2011-7-18 11:43:11

楼上回帖很给力!

liujilei311 发表于 2011-7-18 15:24:06

的确很给力哦!!!!!

liujilei311 发表于 2011-7-18 15:24:07

的确很给力哦!!!!!

xiaoxiaohe 发表于 2011-9-18 14:28:22

很好,4楼的回答
页: [1]
查看完整版本: 求VHDL的流水灯程序!!!!!!