可调万年历(识别闰年)设计Verilog代码Quartus仿真

名称:可调万年历(识别闰年)设计Verilog代码Quartus仿真

软件:Quartus

语言:Verilog

代码功能:

可调万年历(识别闰年)设计

1、设计万年历,可以按键调节年、月、日

2、输出年月日

3、自动识别闰年


FPGA代码Verilog/VHDL代码资源下载:www.hdlcode.com


演示视频:

设计文档:

设计文档.doc

1.工程文件


2.程序文件



3.程序编译


4.RTL图


5.仿真图









部分代码展示:

//万年历
`timescale  1ns/100ps
module calendar
(
input  CLK,
input  RST,
input day_add,//天加
input day_sub,//天减
input month_add,//月加
input month_sub,//月减
input year_add,//年加
input year_sub,//年减
output reg [7:0]   year_h,//年高位
output reg [7:0]   year_l,//年低位
output reg [3:0]   month,//月
output reg [4:0]   day//天
);
reg month_add_cin=0;
reg month_sub_cin=0;
reg year_add_cin=0;
reg year_sub_cin=0;
reg [4:0]   day_max  =  5'd30;//定义月最大天数
always@(posedge CLK or posedge RST)
begin
  if (RST)
day_max <= 5'd30;
  else
if(!(year_l[1:0] == 0 & year_l !=0 | year_h[1:0] ==0 & year_l ==0)&(month == 2))
day_max <= 5'd28;//非闰年2月
else if((year_l[1:0] == 0 & year_l !=0 | year_h[1:0] ==0 & year_l ==0)&(month == 2))
day_max <= 5'd29;//闰年2月
else if((month == 4)|(month == 6)|(month == 9)|(month == 11))
day_max <= 5'd30;//小月
else if((month == 1)|(month == 3)|(month == 5)|(month == 7)|(month == 8)|(month == 10)|(month == 12))
day_max <= 5'd31;//大月
else
day_max <= 5'd30;
end

代码文件(付费下载):



1、代码文件需要付费后才可见。
2、支付问题请联系微信公众号客服。
3、优质Verilog/VHDL代码资源,所见即所得。
Verilog/VHDL资源下载 » 可调万年历(识别闰年)设计Verilog代码Quartus仿真

发表评论

模板文件不存在: ./template/plugins/comment/pc/index.htm

注册为本站会员,充值100得150,详情咨询客服

目前为止共有 *** 位优秀的会员加入! 立刻加入会员