当前位置:网站首页>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
边栏推荐
- 零基础利用Unity3D开发AR应用并远程下载3D模型
- 带参数的微信小程序二维码生成
- Go language slow entry - process control statement
- What does the service grid that has been popular for two years bring to microservices? (Reprinted)
- Unity shader screen post-processing
- Realize the reset function of steering wheel UI with touch rotation and finger departure in unity
- Some attention code explanations
- Atcoder beginer contest 240 g.reporting Takahashi (classical problems of Combinatorial Mathematics)
- Ugui learning notes (II) Scrollview related
- It is said that NVIDIA has held talks with Softbank and will offer more than US $32billion to acquire arm
猜你喜欢

Ugui learning notes (II) Scrollview related

Goweb开发之Beego框架实战:第一节 Beego框架介绍

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

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

: No such file or directory

The practice of beego framework in goweb development: Section I Introduction to beego framework

How to protect image security during construction

全链路灰度在数据库上我们是怎么做的?

Technology sharing | how to recover the erroneously deleted table and the data in the table?

Fine-grained Fact Verification with Kernel GA Network
随机推荐
高速电路中电容的选型和应用——详解
mysql 最大建议行数2000w,靠谱吗?
如何在构建阶段保护镜像安全
Unity shader procedural texture
Comprehensively design an oppe homepage -- after sales service of the page
数据库故障容错之系统时钟故障
Goweb开发之Beego框架实战:第一节 Beego框架介绍
堡垒机的作用
Use of influxdb2
总数据量超万亿行,玉溪卷烟厂通过正确选择时序数据库轻松应对
Ugui learning notes (IV) ugui event system overview and Usage Summary
充分利用----英文
Comprehensively design an oppe homepage -- page service part
Deep understanding of deepsea and salt deployment tools – storage6
高速电路中电阻的选择
Round 1A 2022 - Code jam 2022 c.weightlifting (interval DP)
Read excel xlsx format file in unity
C # traversal set
线性代数及矩阵论(十)
Unity shader transparent effect