• 方案介绍
  • 附件下载
  • 相关推荐
申请入驻 产业图谱

多功能时钟设计Verilog代码Quartus仿真

09/30 08:35
156
加入交流群
扫码加入
获取工程师必备礼包
参与热点资讯讨论

2-241029195310Q1.doc

共1个文件

名称:多功能时钟设计Verilog代码Quartus仿真

软件:Quartus

语言:Verilog

代码功能:

多功能时钟设计

1、具有计时功能,可以调时

2、具有万年历功能,可以设置年月日

3、通过按键切换显示年月日还是时分秒

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

演示视频:

设计文档:

1. 工程文件

2. 程序文件

3. 程序编译

4. RTL图

5. 仿真图

日期模块仿真

时钟模块

显示模块

分频模块

按键模块

部分代码展示:

//万年历
`timescale??1ns/100ps
module?calendar
(
input??CLK,//1KHz
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

点击链接获取代码文件:http://www.hdlcode.com/index.php?m=home&c=View&a=index&aid=1278

  • 2-241029195310Q1.doc
    下载

相关推荐