找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 3875|回复: 3
打印 上一主题 下一主题
收起左侧

基于FPGA的数字跑表代码

[复制链接]
跳转到指定楼层
楼主
基于Verilog HDL 语言FPGA的数字跑表代码分享给大家


源程序:
  1. `timescale 1ns / 1ps
  2. //////////////////////////////////////////////////////////////////////////////////
  3. // Company:
  4. // Engineer:
  5. //
  6. // Create Date:    20:33:30 09/26/2018
  7. // Design Name:
  8. // Module Name:    count
  9. // Project Name:
  10. // Target Devices:
  11. // Tool versions:
  12. // Description:
  13. //
  14. // Dependencies:
  15. //
  16. // Revision:
  17. // Revision 0.01 - File Created
  18. // Additional Comments:
  19. //
  20. //////////////////////////////////////////////////////////////////////////////////
  21. module count(
  22.     input clk_100Hz,
  23.     input rst,
  24.     input E,
  25.     output wire [3:0] s1,
  26.     output wire [3:0] s2,
  27.     output wire [3:0] s3,
  28.     output wire [3:0] s4,
  29.     output wire [3:0] s5,
  30.     output wire [3:0] s6
  31.     );
  32.     reg [3:0]i;
  33.     reg [3:0] count[1:6];
  34.     initial
  35.         begin
  36.             for(i=1;i<5;i=i+1)
  37.                 begin
  38.                     count[i]=4'b0000;
  39.                 end
  40.              i=0;
  41.         end
  42.      always @ (posedge clk_100Hz)
  43.         begin
  44.             if(rst)
  45.                 begin            
  46.                      for(i=1;i<7;i=i+1)
  47.                         count[i]=4'b0000;
  48.                 end
  49.             else if(!E)
  50.                 begin            
  51.                      for(i=1;i<7;i=i+1)
  52.                         count[i]=count[i];
  53.                 end
  54.             else
  55.                 begin
  56.                     if(count[1]<10)  
  57.                         count[1]=count[1]+1;
  58.                     if(count[1]==10)         
  59.                       begin            
  60.                           count[1]=0;     
  61.                           count[2]=count[2]+1;
  62.                       end               
  63.                      if(count[2]==10)         
  64.                         begin            
  65.                             count[2]=0;     
  66.                             count[3]=count[3]+1;
  67.                         end
  68.                     if(count[3]==10)         
  69.                         begin            
  70.                             count[3]=0;     
  71.                             count[4]=count[4]+1;
  72.                         end
  73.                     if(count[4]==6)         
  74.                         begin            
  75.                             count[4]=0;     
  76.                             count[5]=count[5]+1;
  77.                         end
  78.                     if(count[5]==10)         
  79.                         begin            
  80.                             count[5]=0;     
  81.                             count[6]=count[6]+1;
  82.                         end
  83.                     if(count[6]==6)
  84.                         begin            
  85.                              for(i=1;i<7;i=i+1)
  86.                                 count[i]=4'b0000;
  87.                         end
  88.                     end
  89.         end
  90.         assign s1 = count[1];
  91.         assign s2 = count[2];
  92.         assign s3 = count[3];
  93.         assign s4 = count[4];
  94.         assign s5 = count[5];
  95.         assign s6 = count[6];
  96. endmodule
复制代码

全部资料51hei下载地址:
u7utu7.zip (1.39 MB, 下载次数: 45)

评分

参与人数 1黑币 +50 收起 理由
admin + 50 共享资料的黑币奖励!

查看全部评分

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:163730 发表于 2019-6-14 16:14 | 只看该作者
tks,just need it!
回复

使用道具 举报

板凳
ID:666179 发表于 2020-6-15 09:31 来自手机 | 只看该作者
sawyou 发表于 2019-6-14 16:14
tks,just need it!

??我要看下这个
回复

使用道具 举报

地板
ID:684776 发表于 2020-6-17 21:35 | 只看该作者
刚好需要,谢谢!
回复

使用道具 举报

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

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表