题解 | #简易秒表#

简易秒表

https://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) begin
            second <= 0;
            minute <= 0;
        end
        else if(minute<60)begin
            if(second==60begin
                minute <= minute + 1;
                second <= 1;
            end
            else begin
                minute <= minute;
                second <= second + 1;
            end
        end
        else begin
            minute <= minute;
            second <= second;
        end
    end
    
endmodule
全部评论

相关推荐

03-27 01:58
已编辑
西北工业大学 Java
在平静中度过当下:如果这个bg也简历挂的话可能他们现在不缺人了吧,我也是这两天投的,阿里和快手投的岗都是简历秒挂
点赞 评论 收藏
分享
明明就不饿:看不懂你到底会啥,什么岗位
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务