標(biāo)題: 基于FPGA的數(shù)字跑表代碼 [打印本頁]

作者: 迪西    時(shí)間: 2019-1-2 14:08
標(biāo)題: 基于FPGA的數(shù)字跑表代碼
基于Verilog HDL 語言FPGA的數(shù)字跑表代碼分享給大家


源程序:
  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
復(fù)制代碼

全部資料51hei下載地址:
u7utu7.zip (1.39 MB, 下載次數(shù): 46)


作者: sawyou    時(shí)間: 2019-6-14 16:14
tks,just need it!
作者: 2333bb    時(shí)間: 2020-6-15 09:31
sawyou 發(fā)表于 2019-6-14 16:14
tks,just need it!

??我要看下這個(gè)
作者: pswang225    時(shí)間: 2020-6-17 21:35
剛好需要,謝謝!




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1