名称:秒表设计Verilog代码Quartus仿真
软件:Quartus
语言:Verilog
代码功能:
秒表设计
1、具有启动,暂停,复位功能
2、显示分、秒、毫秒
3、毫秒精确到10毫秒
FPGA代码Verilog/VHDL代码资源下载:www.hdlcode.com
演示视频:
设计文档:
1. 工程文件
2. 程序文件
3. 程序编译
4. RTL图
5. 仿真图
整体仿真
按键上升沿模块仿真
控制模块仿真
显示模块仿真
部分代码展示:
//跑表模块 module stopwatch1226( input clk_50M, 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_50M) 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
点击链接获取代码文件:http://www.hdlcode.com/index.php?m=home&c=View&a=index&aid=1056
阅读全文
346