在线咨询 切换到宽版
eetop公众号 创芯大讲堂 创芯人才网

 找回密码
登录 注册

手机号码,快捷登录

手机号码,快捷登录

搜全文
查看: 2299|回复: 2

[求助] 新手求助,用VHDL实现流水灯

[复制链接]
发表于 2015-6-16 20:32:53 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
用vhdl实现流水灯,但是只有固定一位在亮,代码如下,时钟50MHz
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;

entity led_water is
        port(
                        clk                :        in                std_logic;
                        output        :        out        std_logic_vector(3 downto 0));
end led_water;

architecture arch_ledwater of led_water is
signal counter        :        std_logic_vector(25 downto 0);
signal buff                :        std_logic_vector(1 downto 0);
begin
        process(clk,buff)
        begin
                if clk'event and clk = '1' then
                counter <= counter+1;
                end if;
                if counter = "10111110101111000010000000" then
                buff <= buff+1;
                counter <= "00000000000000000000000000";
                end if;
                case buff is
                        when "00" => output <= "1110";
                        when "01" => output <= "1101";
                        when "10" => output <= "1011";
                        when "11" => output <= "0111";
                        when others => NULL;
                end case;
        end process;
end arch_ledwater;
发表于 2015-6-23 20:33:50 | 显示全部楼层
起码得有个复位信号吧, 复位后counter和buff都设为0
回复 支持 反对

使用道具 举报

发表于 2015-6-27 17:06:38 | 显示全部楼层
原理上,实际运行时没有复位信号也是可以的
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则


手机版| 小黑屋| 关于我们| 联系我们| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备11010502037710 )

GMT+8, 2026-6-19 03:17 , Processed in 0.028106 second(s), 6 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表