题解 | #简易秒表#

简易秒表

http://www.nowcoder.com/practice/6493ca8c7b67499f918e1fa33b4cdeda

一个比较简单的秒表计数器。

`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)
            second <= 0;
        else
            second <= minute==60? 0:
                      second==60? 1: 
                      second+1;
    end
  
  	// 分
    always@(posedge clk or negedge rst_n) begin
        if(~rst_n)
            minute <= 0;
        else
            minute <= minute==60? 60:
                      second==60? minute+1:
                      minute;
    end
	
	
endmodule
Verilog篇题解 文章被收录于专栏

本人对牛客网verilog篇题目一些理解

全部评论
自测输入的代码应该怎么写呀
点赞 回复 分享
发布于 2022-10-25 15:36 北京

相关推荐

03-29 12:10
门头沟学院 C++
挣K存W养DOG:散漫消极者淘汰,一眼坑爹。实习几个月转正的时候说你加班太少,能力还行态度不够积极裁了,马上老实。
点赞 评论 收藏
分享
04-18 15:58
已编辑
门头沟学院 设计
kaoyu:这一看就不是计算机的,怎么还有个排斥洗碗?
点赞 评论 收藏
分享
评论
4
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务