基于FPGA的电子万年历显示年月日设计Verilog代码VIVADO仿真
创始人
2024-12-27 07:41:06
0

名称:基于FPGA的电子万年历显示年月日设计Verilog代码VIVADO仿真(文末获取)

软件:VIVADO

语言:Verilog

代码功能:电子万年历显示年月日

1. 工程文件

2. 程序文件

3. 程序编译

4. RTL图

5. Testbench

6. 仿真图

部分代码展示:

/* --万年历 */ `timescale  1ns/100ps module wannianli ( input sysclk,//1s时钟 input reset_n,//低电平复位 //输出年月日,时分秒 output [7:0]   year_high_dis,// output [7:0]   year_low_dis,// output [7:0]   month_dis,// output [7:0]   day_dis,// output [7:0]   hour_dis,// output [7:0]   minute_dis,// output [7:0]   second_dis// ); //定义计数常数 parameter   second_cnt   = 60;//60秒 parameter   minute_cnt   = 60;//60分 parameter   hour_cnt   = 24;//24时 //定义计数器 reg [7:0]   year_high  =  8'd0; reg [7:0]   year_low   =  8'd0; reg [3:0]   month     =  4'd0; reg [4:0]   day       =  5'd0; reg [4:0]   hour      =  5'd0; reg [5:0]   minute    =  6'd0; reg [5:0]   second    =  6'd0; //闰年控制2月时间及大月小月控制------------------------------------------------------------------------------ wire  month_flag = (day == 28)&!(year_low[1:0] == 0 & year_low !=0 | year_high[1:0] ==0 & year_low ==0)&(month == 2)|                    (day == 29)& (year_low[1:0] == 0 & year_low !=0 | year_high[1:0] ==0 & year_low ==0)&(month == 2)|                    (day == 30)& ((month == 4)|(month == 6)|(month == 9)|(month == 11))|                    (day == 31)& ((month == 1)|(month == 3)|(month == 5)|(month == 7)|(month == 8)|(month == 10)|(month == 12)); //------------------------------------------------------------------------------ always@(posedge sysclk or negedge reset_n) begin   if (!reset_n)//复位,修改该处可以修改起始时间,目前设置为2019.12.31日22:10:00   begin     second  <= 6'd0;     minute  <= 6'd10;     hour    <= 5'd22;     day     <= 5'd30;     month   <= 4'd12;     year_low  <= 8'd19;     year_high  <= 8'd20;   end   else begin           if ((second == second_cnt - 1'b1)) //秒计时到59           begin             second <= 6'd0;//秒回0             if (minute == minute_cnt - 1'b1)  //分计时到59             begin               minute <= 6'd0;//分回0               if (hour == hour_cnt - 1'b1)  //时计时到23               begin                 hour <= 5'd0;//时回0                 if (month_flag) //month_flag指示当月最后一天,根据闰年及大小月判断,闰年2月为29,否则28;大月31,小月30                 begin                   day <= 5'd1;//回到1号                   if (month == 12) //12月                   begin                     month <= 5'd1;//回到1月                     if (year_low == 100 -1'b1)//年低位最大到99                     begin                       year_low <= 8'd0;//回0                       if (year_high == 100 -1'b1)//年高位最大到99                       begin                         year_high <= 8'd0;//回0                       end                       else if (year_low == 100 -1'b1)//计数到99年,年高位加1                       begin                         year_high <= year_high + 1'b1;                       end 
源代码

 扫描文章末尾的公众号二维码

相关内容

热门资讯

透视方针!wepoker好友局... 透视方针!wepoker好友局透视,wepoker透视脚本免费下载pc(脚本)详细教程(好像真的有挂...
透视了解!wpk辅助哪里买(透... 透视了解!wpk辅助哪里买(透视)wpk刷入池率脚本,教程窍要(有挂透明挂)-哔哩哔哩1、任何wpk...
在玩家背景下!aapoker能... 在玩家背景下!aapoker能控制牌吗,aapoker透视脚本(透视)烘培教程(总是真的是有挂)-哔...
透视办法!wepoker怎么发... 透视办法!wepoker怎么发冤家牌,wepoker免费脚本咨询(脚本)科普教程(其实真的是有挂)-...
透视透视!如何下载wpk透视版... 透视透视!如何下载wpk透视版(透视)wpk软件是真的吗,教程课程(有挂头条)-哔哩哔哩1、很好的工...
于此同时!aa poker辅助... 于此同时!aa poker辅助,aapoker怎么拿好牌(透视)阶段教程(竟然真的有挂)-哔哩哔哩1...
透视手筋!wepoker怎么买... 透视手筋!wepoker怎么买辅助,wepoker买钻石有用吗(脚本)了解教程(总是真的有挂)-哔哩...
透视推荐!wpk免费辅助(透视... 透视推荐!wpk免费辅助(透视)wpk系统是否存在透视行为,教程技法(有挂存在)-哔哩哔哩wpk系统...
据目击者称!aapoker公共... 据目击者称!aapoker公共底牌,aapoker脚本怎么用(透视)阶段教程(竟然是有挂)-哔哩哔哩...
透视模块!wepoker透视苹... 透视模块!wepoker透视苹果系统,wepoker免费辅助器(脚本)曝光教程(其实有挂)-哔哩哔哩...