数字秒表verilog电子秒表跑表,代码/视频

名称:数字秒表verilog电子秒表跑表

软件:Quartus

语言:Verilog

代码功能:

设计电子秒表,秒表时间精确到0.01秒,可通过按键控制秒表启动、暂停、复位。

代码需要在Mini_Star开发板验证。

开发板资料:

MiniStar_Nano核心板原理图.pdf

MiniStar_Nano底板原理图r.pdf

Mini_Star_4K板指导手册.pdf

演示视频:http://www.hdlcode.com/index.php?m=home&c=View&a=index&aid=197

代码下载:

名称:数字秒表verilog电子秒表跑表(代码在文末付费下载)软件:Quartus语言:Verilog代码功能: 秒表的设计精确到0.01秒,可通过按键控制秒表启动、暂停、复位。 代码需要在Mini_Star开发板验证名称:数字秒表verilog电子秒表跑表(代码在文末付费下载)软件:Quartus语言:Verilog代码功能: 秒表的设计精确到0.01秒,可通过按键控制秒表启动、暂停、复位。 代码需要在Mini_Star开发板验证。开发板资料:MiniStar_Nano核心板原理图.pdfMiniStar_Nano底板原理图r.pdfMini_Star_4K板指导手册.pdf演示视频:FPGA代码http://www.hdlcode.com/index.php?m=home&c=View&a=index&aid=197

FPGA代码资源下载网:hdlcode.com

部分代码展示

复制代码
//跑表模块
module stopwatch(
input clk_in,
input clk_100Hz,//100Hz--对应10ms
input start_key,//启动//暂停
input reset_key,//复位
output [7:0] stopwatch_Millisecond,//10毫秒
output [7:0] stopwatch_second,//秒
output [7:0] stopwatch_minute//分
);
parameter idle_state=3'd0;
parameter cnt_time_state=3'd1;
parameter hold_time_state=3'd2;
parameter reset_time_state=3'd3;
reg [2:0] state=3'd0;
//计时状态机
always@(posedge clk_in)
if(reset_key)
state<=reset_time_state;//复位状态
else
case(state)
reset_time_state://复位状态
state<=idle_state;
idle_state://空闲状态
if(start_key)
state<=cnt_time_state;
else
state<=idle_state;
cnt_time_state://计时状态
if(start_key)
state<=hold_time_state;
else
state<=cnt_time_state;
hold_time_state://暂停状态
if(start_key)
state<=cnt_time_state;
else
state<=hold_time_state;
default:;
endcase
reg [7:0] Millisecond_cnt=8'd0;//10毫秒
reg [7:0] second_cnt=8'd0;//秒
reg [7:0] minute_cnt=8'd0;//分
always@(posedge clk_in)
if(state==reset_time_state)//复位状态
minute_cnt<=8'd0;
else
if(state==cnt_time_state && clk_100Hz==1)//计时状态
if(Millisecond_cnt==8'd99 && second_cnt==8'd59)//59秒99‘时向前记1分
if(minute_cnt<8'd59)
minute_cnt<=minute_cnt+8'd1;//计时到990ms,下一次就到1秒了
else
minute_cnt<=8'd0;
else
minute_cnt<=minute_cnt;
else;
always@(posedge clk_in)
if(state==reset_time_state)//复位状态
second_cnt<=8'd0;
else
if(state==cnt_time_state && clk_100Hz==1)//计时状态
if(Millisecond_cnt==8'd99)//990ms时向前记1秒
if(second_cnt<8'd59)
second_cnt<=second_cnt+8'd1;//计时到990ms,下一次就到1秒了
else
second_cnt<=8'd0;
else
second_cnt<=second_cnt;
else;
always@(posedge clk_in)
if(state==reset_time_state)//复位状态
Millisecond_cnt<=8'd0;
else
if(state==cnt_time_state && clk_100Hz==1)//计时状态
if(Millisecond_cnt<8'd99)//计时到990ms,下一次就到1秒了
Millisecond_cnt<=Millisecond_cnt+8'd1;
else
Millisecond_cnt<=8'd0;//计时到990ms,下一次就到1秒了
else;
assign stopwatch_Millisecond=Millisecond_cnt;
assign stopwatch_second=second_cnt;
assign stopwatch_minute=minute_cnt;
endmodule

设计文档:

  1. 工程文件
  1. 程序文件
  1. 程序编译
  1. RTL图
  1. 管脚分配
  1. Testbench
  1. 仿真图

整体仿真图

分频模块

控制模块

按键模块

显示模块

相关推荐
ZPC82104 天前
docker 镜像备份
人工智能·算法·fpga开发·机器人
ZPC82104 天前
docker 使用GUI ROS2
人工智能·算法·fpga开发·机器人
tiantianuser4 天前
RDMA设计53:构建RoCE v2 高速数据传输系统板级测试平台2
fpga开发·rdma·高速传输·cmac·roce v2
博览鸿蒙4 天前
FPGA 和 IC,哪个前景更好?怎么选?
fpga开发
FPGA_小田老师4 天前
xilinx原语:ISERDESE2原语详解(串并转换器)
fpga开发·iserdese2·原语·串并转换
tiantianuser4 天前
RDMA设计50: 如何验证网络嗅探功能?
网络·fpga开发·rdma·高速传输·cmac·roce v2
Lzy金壳bing4 天前
基于Vivado平台对Xilinx-7K325t FPGA芯片进行程序在线更新升级
fpga开发·vivado·xilinx
unicrom_深圳市由你创科技4 天前
医疗设备专用图像处理板卡定制
图像处理·人工智能·fpga开发
tiantianuser4 天前
RDMA设计52:构建RoCE v2 高速数据传输系统板级测试平台
fpga开发·rdma·高速传输·cmac·roce v2
luoganttcc5 天前
Taalas 将人工智能模型蚀刻到晶体管上,以提升推理能力
人工智能·fpga开发