找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 3532|回復(fù): 0
收起左側(cè)

FPGA流水燈設(shè)計vhdl源程序

[復(fù)制鏈接]
ID:577010 發(fā)表于 2019-7-3 11:42 | 顯示全部樓層 |閱讀模式
自己做的FPGA流水燈設(shè)計
0.png

vhdl源程序如下:
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.std_logic_unsigned .all;
  4. entity liushuideng is
  5. port(clk:in std_logic;
  6. led:out std_logic_vector(7 downto 0));
  7. end entity;
  8. architecture bhv of liushuideng is
  9. signal clk1:std_logic;
  10. begin
  11. process(clk)
  12. variable num:integer range 1 to 25000000;
  13. begin
  14. if rising_edge (clk)then
  15. if num=25000000 then num:=1;clk1<=not clk1;
  16. else num:=num+1;
  17. end if;
  18. end if;
  19. end process;
  20. process(clk1)
  21. variable n:integer range 0 to 3;
  22. begin
  23. if rising_edge (clk1) then
  24. if n=3 then n:=0;
  25. else n:=n+1;
  26. end if ;
  27. end if;
  28. case n is
  29. when 0=>led<="10001000";
  30. when 1=>led<="01000100";
  31. when 2=>led<="00100010";
  32. when 3=>led<="00010001";
  33. when others=>led<="00000000";
  34. end case;
  35. end process;
  36. end bhv;
復(fù)制代碼

所有資料51hei提供下載:
liushuideng.zip (7.42 MB, 下載次數(shù): 40)


回復(fù)

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機教程網(wǎng)

快速回復(fù) 返回頂部 返回列表