当前位置:网站首页>Verilog 每日一题(VL26 简易秒表)
Verilog 每日一题(VL26 简易秒表)
2022-07-28 16:23:00 【别再出error了】
题目描述
请编写一个模块,实现简易秒表的功能:具有两个输出,当输出端口second从1-60循环计数,每当second计数到60,输出端口minute加一,一直到minute=60,暂停计数。
模块的接口信号图如下:


解题:
这一题的思路比较简单,second的计数从1到60循环,满60minute进1,当minute进位到60时,再来一个上升沿,second置零,minute不变直到置零信号到来。
`timescale 1ns/1ns
module count_module(
input clk,
input rst_n,
output reg [5:0]second,
output reg [5:0]minute
);
always @(posedge clk or negedge rst_n) begin
if(~rst_n) begin //低电平置零
second = 0;
minute = 0;
end
else if(minute == 6'd60) begin //判断是minute否时满60,满60则minute不变,second置零
second = 0; minute = 60;
end
else if(second == 6'd60) begin //second满60到下一计数周期,minute+1
second = 1;
minute = minute+1;
end
else second = second + 1;
end
endmodule
边栏推荐
- Some attention code explanations
- The 16th program design competition of Dalian University of Technology (Problem Solver)
- Visual Studio 2015 团队开发之Azure DevOps篇
- Unity3d simple implementation of water surface shader
- It is said that NVIDIA has held talks with Softbank and will offer more than US $32billion to acquire arm
- Leetcode 2022.04.10 China Merchants Bank special competition D. store promotion (DP)
- WPF command button transparent style
- 飞马D200S无人机与机载激光雷达在大比例尺DEM建设中的应用
- Differences between CNSA and CASC and CASIC
- Message Passing for Complex Question Answering over Knowledge Graphs
猜你喜欢

在android开发过程中遇到.sqlite文件处理

Atcoder regular contest 133 d.range XOR (digital dp+ classification discussion)

Classroom attendance system based on QT design (using RDS for MySQL cloud database)

The maximum recommended number of rows for MySQL is 2000W. Is it reliable?

Goweb开发之Beego框架实战:第三节 程序执行流程分析

Verilog 每日一题(VL14 自动贩售机1--FSM常见题型)

微信小程序现金红包返回“IP地址非你在商户平台设置的可用IP地址”错误终极解决方法

Analysis of browser decoding process

Verilog 每日一题(VL6 数据串转并电路)

Unity shader transparent effect
随机推荐
How to protect image security during construction
线性代数及矩阵论(九)
Huawei mate 40 series exposure: large curvature hyperboloid screen, 5nm kylin 1020 processor! There will also be a version of Tianji 1000+
Rsync service deployment and parameter details
Why do I choose to use go language?
Educational codeforces round 126 (rated for Div. 2) f.teleporters (two sets and two points)
WPF command button transparent style
Visual Studio 2015 团队开发之Azure DevOps篇
Message Passing for Complex Question Answering over Knowledge Graphs
Make full use of English
部分情况下Error:(xx, xx) Failed to resolve: xxxxxx解决。
飞马D200S无人机与机载激光雷达在大比例尺DEM建设中的应用
UNIQUE VISION Programming Contest 2022(AtCoder Beginner Contest 248)G. GCD cost on the tree
我为什么选择使用Go语言?
C# 导入Excel文件数据的几种方法
GEAR: Graph-based Evidence Aggregating and Reasoning for Fact Verification
Vscode界面介绍
Read excel xlsx format file in unity
Microservice Architecture - service registry and service gateway (6.8) (Reprint)
Proof of the third scene (f) in 22 years