• 新手一枚,学习两个月的板子
  • 芯片制造中的阻挡层沉积技术介绍
  • 接地搭接电缆布局屏蔽!!!
  • 北美液冷生态解码:超微spuermicro,24年营
  • SK海力士全球首发HBM4-16层堆叠、2.0TB/s

黑金AX4010 FPGA开发板流水灯例程 EP4CE10F17C8

[复制链接]
查看1129 | 回复42 | 2024-4-27 00:04:02 | 显示全部楼层 |阅读模式

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

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

×
  1. `timescale 1ns / 1ps
  2. module LED
  3. (
  4.     input           clk,           // system clock 50Mhz on board
  5.     input           rst_n,         // reset ,low active
  6.     output reg[3:0] led            // LED,use for control the LED signal on board
  7. );
  8. //define the time counter
  9. reg [31:0]      timer;
  10. // cycle counter:from 0 to 4 sec
  11. always@(posedge clk or negedge rst_n)
  12. begin
  13.     if (rst_n == 1'b0)
  14.         timer <= 32'd0;                     //when the reset signal valid,time counter clearing
  15.     else if (timer == 32'd199_999_999)      //4 seconds count(50M*4-1=199999999)
  16.         timer <= 32'd0;                     //count done,clearing the time counter
  17.     else
  18.         timer <= timer + 32'd1;             //timer counter = timer counter + 1
  19. end
  20. // LED control
  21. always@(posedge clk or negedge rst_n)
  22. begin
  23.     if (rst_n == 1'b0)
  24.         led <= 4'b0000;                     //when the reset signal active
  25.     else if (timer == 32'd49_999_999)       //time counter count to 1st sec,LED1 lighten
  26.         led <= 4'b0001;
  27.     else if (timer == 32'd99_999_999)       //time counter count to 2nd sec,LED2 lighten
  28.         led <= 4'b0010;
  29.     else if (timer == 32'd149_999_999)      //time counter count to 3rd sec,LED3 lighten
  30.         led <= 4'b0100;
  31.     else if (timer == 32'd199_999_999)      //time counter count to 4th sec,LED4 lighten
  32.         led <= 4'b1000;
  33. end
  34. endmodule
复制代码
回复

使用道具 举报

烧中烧火 | 2024-4-27 07:05:09 | 显示全部楼层
回复

使用道具 举报

power3 | 2024-4-27 08:04:56 | 显示全部楼层
回复

使用道具 举报

1005959182 | 2024-4-27 08:05:43 | 显示全部楼层
回复

使用道具 举报

fcwy03 | 2024-4-27 08:21:49 | 显示全部楼层
回复

使用道具 举报

ize | 2024-4-27 08:35:00 | 显示全部楼层
回复

使用道具 举报

清心如水 | 2024-4-27 08:52:12 | 显示全部楼层
回复

使用道具 举报

flash2005 | 2024-4-27 08:57:56 | 显示全部楼层
sigmastar系统开发  瑞萨系统开发  AI视觉系统开发
回复

使用道具 举报

790 | 2024-4-27 09:00:26 | 显示全部楼层
回复

使用道具 举报

zhs133125 | 2024-4-27 09:01:14 | 显示全部楼层
回复

使用道具 举报

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

本版积分规则