简单秒表设计仿真verilog跑表,源码/视频

名称:简单秒表设计仿真

软件:Quartus

语言:Verilog

代码功能:

秒表显示最低计时为10ms,最大为59:99,超出返回00:00

具有复位、启动、暂停三个按键

四个数码管分别显示4个时间数字。

演示视频:简单秒表设计仿真verilog跑表_Verilog/VHDL资源下载

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

代码下载:

简单秒表设计仿真verilog跑表_Verilog/VHDL资源下载名称:简单秒表设计仿真(代码在文末付费下载)软件:Quartus语言:Verilog代码功能:秒表显示最低计时为10ms,最大为59:99,超出返回00:00具有复位、启动、暂停三个按键四个数码管分别显示4个时间数字。演示视频:FPGA代码资源下载网:hdlcode.com部分代码展示module stopwatch(input clk,//100Hz--对应10msinput start_keyhttp://www.hdlcode.com/index.php?m=home&c=View&a=index&aid=200

部分代码展示

复制代码
module stopwatch(
input clk,//100Hz--对应10ms
input start_key,//启动
input stop_key,//暂停
input reset_key,//复位
output reg [7:0] display0,//输出数码管显示
output reg [7:0] display1,//输出数码管显示
output reg [7:0] display2,//输出数码管显示
output reg [7:0] display3//输出数码管显示
);
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)
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(stop_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;//秒
always@(posedge clk)
if(state==reset_time_state)//复位状态
second_cnt<=8'd0;
else
if(state==cnt_time_state)//计时状态
if(Millisecond_cnt==8'd99)//990ms时向前记1秒
if(second_cnt<8'd59)
second_cnt<=second_cnt+8'd1;//计时到990ms,下一次就到1秒了

设计文档:

1.工程文件

2.程序代码

3.程序运行

4.Testbench

5.仿真图

秒表显示最低计时为10ms,最大为59:99,超出返回00:00

具有复位、启动、暂停三个按键

四个数码管分别显示4个时间数字。

1、整体仿真图

2、复位功能

3、启动按键

4、暂停按键

5、10ms毫秒计时

6、秒计时

相关推荐
upper202014 小时前
从零开始动手做Verilog实验--04--11阶FIR滤波器
fpga开发
Ryan-Lily17 小时前
铰链基于灵敏度的拓扑优化-CAE操作过程
abaqus·仿真
nuoxin11417 小时前
SSD201-富利威
arm开发·驱动开发·fpga开发·ffmpeg·射频工程
哄娃睡觉17 小时前
FPGA、ARM、MCU、DSP的区别
fpga开发
不会武功的火柴2 天前
ModelSim入门实战(三): 批处理一键仿真与波形调试
嵌入式硬件·fpga·仿真·modelsim·ic验证·rtl
Ryan-Lily2 天前
曲轴基于灵敏度的拓扑优化-CAE操作过程
abaqus·仿真
nature_forest2 天前
vivado2018.2固化程序方法之.bin文件固化法
windows·fpga开发
m0_46644103詹湛2 天前
FPGA时序优化与高速接口实战手册
笔记·学习·fpga开发·硬件架构·verilog
upper20202 天前
从零开始做Verilog实验--01--4位计数器
fpga开发
upper20202 天前
从零开始动手做Verilog实验--02--模为60的BCD加法器
fpga开发